|
|
|
@ -34,7 +34,9 @@ void wrapper_add_user_show() {
|
|
|
|
|
}
|
|
|
|
|
void wrapper_edit_user_show() {
|
|
|
|
|
int index = wrapper_select_tree_view(&cfg_custom_gui.user);
|
|
|
|
|
printf("%d\n", index);
|
|
|
|
|
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);
|
|
|
|
@ -58,6 +60,9 @@ void wrapper_add_group_show() {
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
@ -111,9 +116,13 @@ void unlock_spin_time(hotebook* widgets,void (*f)()) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
@ -121,11 +130,18 @@ void entry_user_disk(GtkWidget *self,int* flag_update) {
|
|
|
|
|
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);
|
|
|
|
@ -133,9 +149,13 @@ void entry_groups_disk(GtkWidget *self,int* flag_update) {
|
|
|
|
|
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) {
|
|
|
|
|
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);
|
|
|
|
@ -143,6 +163,7 @@ void entry_project_disk(GtkWidget *self,int* flag_update) {
|
|
|
|
|
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) {
|
|
|
|
@ -218,10 +239,12 @@ 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() {
|
|
|
|
@ -231,7 +254,7 @@ void user_remove() {
|
|
|
|
|
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);
|
|
|
|
|
template_remove(&all_config->v_user, &cfg_custom_gui.user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void group_remove() {
|
|
|
|
@ -255,9 +278,7 @@ void project_remove() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int wrapper_select_tree_view(hotebook* widgets) {
|
|
|
|
|
block_spin_time(widgets, wrapper_get_spin_time_gui_user);
|
|
|
|
|
block_spin_time(widgets, wrapper_get_spin_time_gui_group);
|
|
|
|
|
block_spin_time(widgets, wrapper_get_spin_time_gui_project);
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->liststore);
|
|
|
|
@ -270,9 +291,6 @@ int wrapper_select_tree_view(hotebook* widgets) {
|
|
|
|
|
else {
|
|
|
|
|
//index_selected = -1;
|
|
|
|
|
}
|
|
|
|
|
unlock_spin_time(widgets, wrapper_get_spin_time_gui_user);
|
|
|
|
|
unlock_spin_time(widgets, wrapper_get_spin_time_gui_group);
|
|
|
|
|
unlock_spin_time(widgets, wrapper_get_spin_time_gui_project);
|
|
|
|
|
return index;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -377,6 +395,59 @@ void control_event(main_window* _config_main_gui, custom_window* _config_custom_
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|