#include "controler.h" main_window cfg_main_gui; custom_window cfg_custom_gui; config_settings_gui main_config; config_all* all_config; int index_selected = 0; void wrapper_filters_user_show() { filters_set_name("usrquota"); filters_show(NULL, glade_path); } void wrapper_filters_group_show() { filters_set_name("grpquota"); filters_show(NULL, glade_path); } void wrapper_filters_project_show() { filters_set_name("prjquota"); filters_show(NULL, glade_path); } void wrapper_add_user_show() { char* activ_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(cfg_custom_gui.user.comboBox)); activ_text= yon_char_divide_search(activ_text, " ", -1); set_disk(activ_text); set_temp_menu("usrquota", "add"); set_all_config(all_config); set_vector(&all_config->v_user); temp_show(NULL, glade_path); int i = 0; g_signal_connect(G_OBJECT(get_widget_temp()->btnSaveTempSave),"clicked",G_CALLBACK(entry_user_disk),&i); } void wrapper_edit_user_show() { int index = wrapper_select_tree_view(&cfg_custom_gui.user); char* activ_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(cfg_custom_gui.user.comboBox)); activ_text= yon_char_divide_search(activ_text, " ", -1); set_disk(activ_text); set_temp_menu("usrquota", "edit"); temp_set_index(index); set_all_config(all_config); temp_show(NULL, glade_path); set_vector(&all_config->v_user); set_edit_gui_data_base(all_config, index); int i = 0; g_signal_connect(G_OBJECT(get_widget_temp()->btnSaveTempSave),"clicked",G_CALLBACK(entry_user_disk),&i); } void wrapper_add_group_show() { char* activ_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(cfg_custom_gui.group.comboBox)); activ_text = yon_char_divide_search(activ_text, " ", -1); set_disk(activ_text); set_temp_menu("grpquota", "add"); set_all_config(all_config); set_vector(&all_config->v_group); temp_show(NULL, glade_path); int i = 0; g_signal_connect(G_OBJECT(get_widget_temp()->btnSaveTempSave),"clicked",G_CALLBACK(entry_groups_disk),&i); } void wrapper_edit_group_show() { int index = wrapper_select_tree_view(&cfg_custom_gui.group); char* activ_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(cfg_custom_gui.group.comboBox)); activ_text= yon_char_divide_search(activ_text, " ", -1); set_disk(activ_text); set_temp_menu("grpquota", "edit"); temp_set_index(index); set_all_config(all_config); set_vector(&all_config->v_group); temp_show(NULL, glade_path); set_edit_gui_data_base(all_config, index); int i = 0; g_signal_connect(G_OBJECT(get_widget_temp()->btnSaveTempSave),"clicked",G_CALLBACK(entry_groups_disk),&i); } void wrapper_add_project_show() { set_temp_menu("prjquota", "add"); set_all_config(all_config); set_vector(&all_config->v_project); temp_show(NULL, glade_path); int i = 0; g_signal_connect(G_OBJECT(get_widget_temp()->btnSaveTempSave),"clicked",G_CALLBACK(entry_project_disk),&i); } void wrapper_edit_project_show() { int index = wrapper_select_tree_view(&cfg_custom_gui.project); set_temp_menu("prjquota", "edit"); temp_set_index(index); set_all_config(all_config); temp_show(NULL, glade_path); set_vector(&all_config->v_project); set_edit_gui_data_base(all_config, index); int i = 0; g_signal_connect(G_OBJECT(get_widget_temp()->btnSaveTempSave),"clicked",G_CALLBACK(entry_project_disk),&i); } void block_spin_time(hotebook* widgets,void (*f)()) { g_signal_handlers_block_by_func(G_OBJECT(widgets->spinWeeksSize), G_CALLBACK(f), NULL); g_signal_handlers_block_by_func(G_OBJECT(widgets->spinDaysSize), G_CALLBACK(f), NULL); g_signal_handlers_block_by_func(G_OBJECT(widgets->spinHoursSize), G_CALLBACK(f), NULL); g_signal_handlers_block_by_func(G_OBJECT(widgets->spinMinutesSize), G_CALLBACK(f), NULL); g_signal_handlers_block_by_func(G_OBJECT(widgets->spinWeeksFile), G_CALLBACK(f), NULL); g_signal_handlers_block_by_func(G_OBJECT(widgets->spinDaysFile), G_CALLBACK(f), NULL); g_signal_handlers_block_by_func(G_OBJECT(widgets->spinHoursFile), G_CALLBACK(f), NULL); g_signal_handlers_block_by_func(G_OBJECT(widgets->spinMinutesFile), G_CALLBACK(f), NULL); } void unlock_spin_time(hotebook* widgets,void (*f)()) { g_signal_handlers_unblock_by_func(G_OBJECT(widgets->spinWeeksSize), G_CALLBACK(f), NULL); g_signal_handlers_unblock_by_func(G_OBJECT(widgets->spinDaysSize), G_CALLBACK(f), NULL); g_signal_handlers_unblock_by_func(G_OBJECT(widgets->spinHoursSize), G_CALLBACK(f), NULL); g_signal_handlers_unblock_by_func(G_OBJECT(widgets->spinMinutesSize), G_CALLBACK(f), NULL); g_signal_handlers_unblock_by_func(G_OBJECT(widgets->spinWeeksFile), G_CALLBACK(f), NULL); g_signal_handlers_unblock_by_func(G_OBJECT(widgets->spinDaysFile), G_CALLBACK(f), NULL); g_signal_handlers_unblock_by_func(G_OBJECT(widgets->spinHoursFile), G_CALLBACK(f), NULL); g_signal_handlers_unblock_by_func(G_OBJECT(widgets->spinMinutesFile), G_CALLBACK(f), NULL); } void entry_user_disk(GtkWidget *self,int* flag_update) { block_spin_time(&cfg_custom_gui.user, wrapper_get_spin_time_gui_user); if (flag_update) { all_config->flag_set_data = 1; all_config->flag_save = 3; temp_on_destroy_subwindow(self); } get_status_disk(&cfg_custom_gui.user); char* activ_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(cfg_custom_gui.user.comboBox)); activ_text= yon_char_divide_search(activ_text, " ", -1); int find = fill_tree_view_user_group(all_config, activ_text, &cfg_custom_gui.user,"usrquota", 0); if (find == 0) { g_object_ref(cfg_custom_gui.user.liststore); gtk_list_store_clear(cfg_custom_gui.user.liststore); } unlock_spin_time(&cfg_custom_gui.user, wrapper_get_spin_time_gui_user); } void entry_groups_disk(GtkWidget *self,int* flag_update) { block_spin_time(&cfg_custom_gui.group, wrapper_get_spin_time_gui_group); if (flag_update) { all_config->flag_set_data = 1; all_config->flag_save = 3; temp_on_destroy_subwindow(self); } get_status_disk(&cfg_custom_gui.group); char* activ_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(cfg_custom_gui.group.comboBox)); activ_text= yon_char_divide_search(activ_text, " ", -1); int find = fill_tree_view_user_group(all_config, activ_text, &cfg_custom_gui.group,"grpquota", 0); if (find == 0) { g_object_ref(cfg_custom_gui.group.liststore); gtk_list_store_clear(cfg_custom_gui.group.liststore); } unlock_spin_time(&cfg_custom_gui.group, wrapper_get_spin_time_gui_group); } void entry_project_disk(GtkWidget *self,int* flag_update) { block_spin_time(&cfg_custom_gui.project, wrapper_get_spin_time_gui_project); if (flag_update) { all_config->flag_set_data = 1; all_config->flag_save = 3; temp_on_destroy_subwindow(self); } int find = fill_tree_view_project(all_config, &cfg_custom_gui.project,"prjquota", 0); if (find == 0) { g_object_ref(cfg_custom_gui.project.liststore); gtk_list_store_clear(cfg_custom_gui.project.liststore); } unlock_spin_time(&cfg_custom_gui.project, wrapper_get_spin_time_gui_project); } void tree_view_select_user(GtkWidget* self) { tree_view_select(NULL,&all_config->v_user , &cfg_custom_gui.user); } void tree_view_select_group(GtkWidget* sel) { tree_view_select(NULL,&all_config->v_group ,&cfg_custom_gui.group); } void tree_view_select_project(GtkWidget* self) { tree_view_select(NULL,&all_config->v_project , &cfg_custom_gui.project); } void tree_view_select(GtkWidget* self, vector* vec_temp, hotebook* widgets) { if (self) {} if (vec_temp->vectorList.total > 0) { tree_view_edit(all_config, vec_temp, widgets); GtkTreeIter iter; GtkTreeModel *model = GTK_TREE_MODEL(widgets->liststore); GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->tree_view)); if(gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_widget_set_sensitive(widgets->btnAdd,1); gtk_widget_set_sensitive(widgets->btnDel,1); gtk_widget_set_sensitive(widgets->btnEdit,1); } else { if (main_config.lock_save_global == 0 || main_config.lock_save_local == 0) { gtk_widget_set_sensitive(widgets->btnAdd,1); } gtk_widget_set_sensitive(widgets->btnDel,0); gtk_widget_set_sensitive(widgets->btnEdit,0); } } } void wrapper_get_spin_time_gui_user() { get_spin_time_gui(&all_config->v_user , &cfg_custom_gui.user); entry_user_disk(0, 0); } void wrapper_get_spin_time_gui_group() { get_spin_time_gui(&all_config->v_group ,&cfg_custom_gui.group); entry_groups_disk(0, 0); } void wrapper_get_spin_time_gui_project() { get_spin_time_gui(&all_config->v_project , &cfg_custom_gui.project); entry_project_disk(0, 0); } void get_spin_time_gui(vector* vec_u_g_p, hotebook* widgets) { if (index_selected != -1) { config_u_g_p* _config = (config_u_g_p*)vec_u_g_p->pfVectorGet(vec_u_g_p, index_selected); int spin_week_size = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinWeeksSize)); int spin_days_size = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinDaysSize)); int spin_hours_size = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinHoursSize)); int spin_minutes_size = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinMinutesSize)); int second_size = spin_week_size*7*24*3600+spin_days_size*24*3600+spin_hours_size*3600+spin_minutes_size*60; int spin_week_file = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinWeeksFile)); int spin_days_file = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinDaysFile)); int spin_hours_file = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinHoursFile)); int spin_minutes_file = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widgets->spinMinutesFile)); int second_file = spin_week_file*7*24*3600+spin_days_file*24*3600+spin_hours_file*3600+spin_minutes_file*60; _config->deferring_size = second_size; _config->deferring_file = second_file; vec_u_g_p->pfVectorSet(vec_u_g_p, index_selected, _config); set_time_spin(widgets,_config->deferring_file, _config->deferring_size); } } void template_remove(vector* vec_temp, hotebook* widgets) { int index = wrapper_select_tree_view(widgets); if (index!=-1) { config_u_g_p* _config = (config_u_g_p*)vec_temp->pfVectorGet(vec_temp, index); char* load_key = yon_char_new(_config->loaded_keys); all_config->v_remove.pfVectorAdd(&all_config->v_remove, load_key); model_clear_cfg(_config); vec_temp->pfVectorDelete(vec_temp, index); all_config->flag_save = 1; } } void user_remove() { GtkTreeIter iter; GtkTreeModel *model = GTK_TREE_MODEL(cfg_custom_gui.user.liststore); GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cfg_custom_gui.user.tree_view)); if(gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_list_store_remove(cfg_custom_gui.user.liststore, &iter); } template_remove(&all_config->v_user, &cfg_custom_gui.user); } void group_remove() { GtkTreeIter iter; GtkTreeModel *model = GTK_TREE_MODEL(cfg_custom_gui.group.liststore); GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cfg_custom_gui.group.tree_view)); if(gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_list_store_remove(cfg_custom_gui.group.liststore, &iter); } template_remove(&all_config->v_group ,&cfg_custom_gui.group); } void project_remove() { GtkTreeIter iter; GtkTreeModel *model = GTK_TREE_MODEL(cfg_custom_gui.project.liststore); GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cfg_custom_gui.project.tree_view)); if(gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_list_store_remove(cfg_custom_gui.project.liststore, &iter); } template_remove(&all_config->v_project , &cfg_custom_gui.project); } int wrapper_select_tree_view(hotebook* widgets) { int index = 0; GtkTreeIter iter; GtkTreeModel *model = GTK_TREE_MODEL(widgets->liststore); GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->tree_view)); if(gtk_tree_selection_get_selected(selection, &model, &iter)) { char* str_iter = gtk_tree_model_get_string_from_iter(model, &iter); index = atoi(str_iter); index_selected = index; } else { //index_selected = -1; } return index; } void wrapper_all_save() { int flag_mess_save = 0; if (all_config->flag_load == 0) { flag_mess_save = wrapper_template_save(all_config, CMD_ALL_SAVE, CMD_ALL_REMOVE); } else { flag_mess_save = wrapper_template_save(all_config, CMD_ALL_SAVE, CMD_ALL_REMOVE); } if (flag_mess_save) { yon_ubl_status_box_render(GLOBAL_LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); all_config->flag_load=0; } else { yon_ubl_status_box_render(MESS_NOTHING_SAVE, BACKGROUND_IMAGE_SUCCESS_TYPE); } } void wrapper_global_save() { if (wrapper_template_save(all_config, CMD_SAVE_GLOBAL, CMD_REMOVE_GLOBAL)) { yon_ubl_status_box_render(GLOBAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); all_config->flag_load-=1; } else { yon_ubl_status_box_render(MESS_NOTHING_SAVE, BACKGROUND_IMAGE_SUCCESS_TYPE); } } void wrapper_system_save() { if (wrapper_template_save(all_config, CMD_SAVE_SYSTEM, CMD_REMOVE_SYSTEM)) { yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); all_config->flag_load-=1; } else { yon_ubl_status_box_render(MESS_NOTHING_SAVE, BACKGROUND_IMAGE_SUCCESS_TYPE); } } void load_system_cfg() { all_config->flag_load = 0; load_template_load_cfg(all_config, CMD_LOAD_SYSTEM); yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS_LABEL, BACKGROUND_IMAGE_SUCCESS_TYPE); entry_project_disk(0, 0); } void load_global_cfg() { all_config->flag_load = 1; load_template_load_cfg(all_config, CMD_LOAD_GLOBAL); yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); entry_project_disk(0, 0); } void control_event(main_window* _config_main_gui, custom_window* _config_custom_gui) { g_signal_connect(G_OBJECT(_config_main_gui->LoadLocalMenuItem), "activate", G_CALLBACK(load_system_cfg), NULL); g_signal_connect(G_OBJECT(_config_main_gui->LoadGlobalMenuItem), "activate", G_CALLBACK(load_global_cfg), NULL); g_signal_connect(G_OBJECT(_config_main_gui->SaveGlobalMenuItem), "activate", G_CALLBACK(wrapper_global_save), NULL); g_signal_connect(G_OBJECT(_config_main_gui->SaveLocalMenuItem), "activate", G_CALLBACK(wrapper_system_save), NULL); g_signal_connect(G_OBJECT(_config_main_gui->SaveMenuItem), "activate", G_CALLBACK(wrapper_all_save), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->user.btnAdd),"clicked",G_CALLBACK(wrapper_add_user_show), glade_path); g_signal_connect(G_OBJECT(_config_custom_gui->user.btnEdit),"clicked",G_CALLBACK(wrapper_edit_user_show), glade_path); g_signal_connect(G_OBJECT(_config_custom_gui->user.btnDel),"clicked",G_CALLBACK(user_remove), glade_path); g_signal_connect(G_OBJECT(_config_custom_gui->group.btnAdd),"clicked",G_CALLBACK(wrapper_add_group_show), glade_path); g_signal_connect(G_OBJECT(_config_custom_gui->group.btnEdit),"clicked",G_CALLBACK(wrapper_edit_group_show), glade_path); g_signal_connect(G_OBJECT(_config_custom_gui->group.btnDel),"clicked",G_CALLBACK(group_remove), glade_path); g_signal_connect(G_OBJECT(_config_custom_gui->project.btnAdd),"clicked",G_CALLBACK(wrapper_add_project_show), glade_path); g_signal_connect(G_OBJECT(_config_custom_gui->project.btnEdit),"clicked",G_CALLBACK(wrapper_edit_project_show), glade_path); g_signal_connect(G_OBJECT(_config_custom_gui->project.btnDel),"clicked",G_CALLBACK(project_remove), glade_path); g_signal_connect(G_OBJECT(_config_custom_gui->user.btnFilter),"clicked",G_CALLBACK(wrapper_filters_user_show), glade_path); g_signal_connect(G_OBJECT(_config_custom_gui->group.btnFilter),"clicked",G_CALLBACK(wrapper_filters_group_show), glade_path); g_signal_connect(G_OBJECT(_config_custom_gui->project.btnFilter),"clicked",G_CALLBACK(wrapper_filters_project_show), glade_path); g_signal_connect(G_OBJECT(_config_custom_gui->user.comboBox),"changed",G_CALLBACK(entry_user_disk), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->group.comboBox),"changed",G_CALLBACK(entry_groups_disk), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->user.tree_view), "cursor-changed", G_CALLBACK(tree_view_select_user), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->group.tree_view), "cursor-changed", G_CALLBACK(tree_view_select_group), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->project.tree_view), "cursor-changed", G_CALLBACK(tree_view_select_project), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->user.spinWeeksSize), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_user), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->user.spinDaysSize), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_user), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->user.spinHoursSize), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_user), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->user.spinMinutesSize), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_user), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->user.spinWeeksFile), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_user), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->user.spinDaysFile), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_user), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->user.spinHoursFile), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_user), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->user.spinMinutesFile), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_user), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->group.spinWeeksSize), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_group), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->group.spinDaysSize), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_group), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->group.spinHoursSize), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_group), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->group.spinMinutesSize), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_group), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->group.spinWeeksFile), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_group), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->group.spinDaysFile), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_group), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->group.spinHoursFile), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_group), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->group.spinMinutesFile), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_group), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->project.spinWeeksSize), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_project), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->project.spinDaysSize), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_project), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->project.spinHoursSize), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_project), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->project.spinMinutesSize), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_project), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->project.spinWeeksFile), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_project), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->project.spinDaysFile), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_project), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->project.spinHoursFile), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_project), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->project.spinMinutesFile), "value-changed", G_CALLBACK(wrapper_get_spin_time_gui_project), NULL); g_signal_connect(G_OBJECT(_config_custom_gui->user.cmbSetStatusDisk), "changed", G_CALLBACK(template_set_status_disk), &_config_custom_gui->user); g_signal_connect(G_OBJECT(_config_custom_gui->group.cmbSetStatusDisk), "changed", G_CALLBACK(template_set_status_disk), &_config_custom_gui->group); } void template_set_status_disk(GtkWidget* self,hotebook* widgets) { int menu_id_disk = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->comboBox)); int menu_id = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cmbSetStatusDisk)); char* activ_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->comboBox)); activ_text = yon_char_divide_search(activ_text, " ", -1); vector* v_disk_status = &all_config->v_disk_status; int flag = 0; if (v_disk_status->vectorList.total> 0 && menu_id_disk >= 0 && menu_id >= 0) { for (int i = 0; i < v_disk_status->pfVectorTotal(v_disk_status); i++) { disk_status* _config = (disk_status*)v_disk_status->pfVectorGet(v_disk_status, i); if (strstr(_config->device, activ_text) && strstr(_config->device,widgets->name)) { flag = 1; _config->status = menu_id; all_config->flag_set_data = 1; } } } if (flag == 0) { disk_status* disk_cfg = malloc(sizeof(disk_status)); disk_cfg->device = yon_char_unite("DISK_QUOTA[",widgets->name,":",activ_text, "]",NULL); disk_cfg->status = menu_id; v_disk_status->pfVectorAdd(v_disk_status, disk_cfg); all_config->flag_set_data = 1; } } void get_status_disk(hotebook* widgets) { int menu_id_disk = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->comboBox)); vector* v_disk_status = &all_config->v_disk_status; if (v_disk_status->vectorList.total> 0 && menu_id_disk>=0) { char* activ_text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->comboBox)); activ_text = yon_char_divide_search(activ_text, " ", -1); int status = 0; for (int i = 0; i < v_disk_status->pfVectorTotal(v_disk_status); i++) { disk_status* _config = (disk_status*)v_disk_status->pfVectorGet(v_disk_status, i); if (strstr(_config->device, activ_text) && strstr(_config->device,widgets->name)) { status = 1; gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->cmbSetStatusDisk), _config->status); } if (!status) { gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->cmbSetStatusDisk), -1); } } } else { gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->cmbSetStatusDisk), -1); } } /* void main_visible_columns(GtkWidget *self) { gboolean *flags_filters = filters_get_flag(); gtk_tree_view_column_set_visible(widgets->tvc0, flags_filters[0]); gtk_tree_view_column_set_visible(widgets->tvc1, flags_filters[1]); gtk_tree_view_column_set_visible(widgets->tvc2, flags_filters[2]); gtk_tree_view_column_set_visible(widgets->tvc3, flags_filters[3]); gtk_tree_view_column_set_visible(widgets->tvc4, flags_filters[4]); gtk_tree_view_column_set_visible(widgets->tvc5, flags_filters[5]); gtk_tree_view_column_set_visible(widgets->tvc6, flags_filters[6]); gtk_tree_view_column_set_visible(widgets->tvc7, flags_filters[7]); filters_on_hide_subwindow(self); } */ int main(int argc, char *argv[]){ all_config = malloc(sizeof(config_all)); all_config->flag_not_data = 0; local=setlocale(LC_ALL, ""); bindtextdomain(LocaleName, yon_char_unite(LocalePath, "/", NULL)); //bind_textdomain_codeset(LocaleName, "UTF-8"); textdomain(LocaleName); config_init(&main_config); int size_array_size_pow = 0; array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_KB); array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_MB); array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_GB); array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_TB); int option_index=0; int show_help=0; int debug_mode=0; { struct option long_options[] = { {"help", 0, 0, 'h'}, {"version", 0, 0, 'V'}, {"lock-help", 0,0, 1}, {"lock-save", 0,0, 2}, {"lock-save-local", 0,0, 3}, {"lock-save-global", 0,0, 4}, {"lock-load-global", 0,0, 5}, {"socket-id", 1, 0, 's'}, {"socket-ext-id", 1,0, 'e'}, {"socket-trd-id", 1,0, 't'}, {"debug", 0,0, 'd'}, { NULL, 0, NULL, 0 } }; for (int i=0;iHeadOverlay,widgets->HeadBox,widgets->HeadImage,banner_path); yon_ubl_status_box_setup(widgets->StatusIcon,widgets->StatusBox,widgets->StatusLabel); if (getuid()!=0) { load_global_cfg(); yon_ubl_status_box_render(ROOT_WARNING_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); } else { load_system_cfg(); yon_ubl_status_box_render(TITLE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); } yon_ubl_setup_sockets(widgets->PlugBox,widgets->LeftBox,widgets->RightBox,main_config.socket_id,main_config.load_socket_id,main_config.save_socket_id); yon_window_config_setup(GTK_WINDOW(widgets->Window)); yon_window_config_load(config_path); GtkCssProvider *css=gtk_css_provider_new(); gtk_css_provider_load_from_resource(css,CssPath); gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), GTK_STYLE_PROVIDER(css), -1); gtk_main(); }