diff --git a/Makefile b/Makefile index d72855b..9e329df 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ uninstall: install: check uninstall @echo "Install ..." #################################################### УДАЛИТЬ ПЕРЕД КОММИТОМ ################################################################################ -# @gcc source/ubl-cmake.h compile/resources.c compile/ubl-cmake.h source/view_check_user_table.c source/view_check_user_table.h source/view_filters.c source/model/vector.c source/model/vector.h source/view_filters.h source/view_temp_u_g_p.c source/view_temp_u_g_p.h source/controler.h source/controler.c source/model/philos_utils.h source/model/philos_utils.c source/model/my_device.h source/model/save.h source/model/save.c source/model/my_device.c source/model/model.h source/model/load.h source/model/load.c source/model/model.c source/ubl-settings-diskquota.c source/ubl-settings-diskquota.h source/ubl-strings.h source/model/ubl-utils.c source/model/ubl-utils.h -o ubl-settings-diskquota `pkg-config --cflags --libs gtk+-3.0 vte-2.91 webkit2gtk-4.0 webkit2gtk-web-extension-4.0` -g + @gcc source/ubl-cmake.h compile/resources.c compile/ubl-cmake.h source/view_check_user_table.c source/view_check_user_table.h source/view_filters.c source/model/vector.c source/model/vector.h source/view_filters.h source/view_temp_u_g_p.c source/view_temp_u_g_p.h source/controler.h source/controler.c source/model/philos_utils.h source/model/philos_utils.c source/model/my_device.h source/model/save.h source/model/save.c source/model/my_device.c source/model/model.h source/model/load.h source/model/load.c source/model/model.c source/ubl-settings-diskquota.c source/ubl-settings-diskquota.h source/ubl-strings.h source/model/ubl-utils.c source/model/ubl-utils.h -o ubl-settings-diskquota `pkg-config --cflags --libs gtk+-3.0 vte-2.91 webkit2gtk-4.0 webkit2gtk-web-extension-4.0` -g #################################################### УДАЛИТЬ ПЕРЕД КОММИТОМ ################################################################################ @for FILE_PO in $(wildcard *.po); do \ LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \ diff --git a/screenshot/screenshot.png b/screenshot/screenshot.png index 51bf4ab..fba0817 100644 Binary files a/screenshot/screenshot.png and b/screenshot/screenshot.png differ diff --git a/source/controler.c b/source/controler.c index 1e1f071..9bfcd8f 100644 --- a/source/controler.c +++ b/source/controler.c @@ -209,7 +209,7 @@ void tree_view_select_project(GtkWidget* self) { block_spin_time(&cfg_custom_gui.project, wrapper_get_spin_time_gui_project); tree_view_select(NULL,&all_config.v_project , &cfg_custom_gui.project); unlock_spin_time(&cfg_custom_gui.project, wrapper_get_spin_time_gui_project); - unlock_tree_view(&cfg_custom_gui.group, wrapper_get_spin_time_gui_project); + unlock_tree_view(&cfg_custom_gui.project, wrapper_get_spin_time_gui_project); } @@ -224,6 +224,7 @@ void tree_view_select(GtkWidget* self, vector* vec_temp, hotebook* widgets) { gtk_widget_set_sensitive(widgets->btnAdd,1); gtk_widget_set_sensitive(widgets->btnDel,1); gtk_widget_set_sensitive(widgets->btnEdit,1); + gtk_widget_set_sensitive(widgets->boxSpins, 1); } else { if (main_config.lock_save_global == 0 || main_config.lock_save_local == 0) { @@ -231,8 +232,17 @@ void tree_view_select(GtkWidget* self, vector* vec_temp, hotebook* widgets) { } gtk_widget_set_sensitive(widgets->btnDel,0); gtk_widget_set_sensitive(widgets->btnEdit,0); + gtk_widget_set_sensitive(widgets->boxSpins, 0); } } + else { + gtk_widget_set_sensitive(widgets->btnDel,0); + gtk_widget_set_sensitive(widgets->btnEdit,0); + if (index_selected != -1) { + gtk_widget_set_sensitive(widgets->boxSpins, 0); + } + } + } void wrapper_get_spin_time_gui_user() { @@ -280,6 +290,7 @@ void get_spin_time_gui(vector* vec_u_g_p, hotebook* widgets) { void template_remove(vector* vec_temp, hotebook* widgets) { int index = wrapper_select_tree_view(widgets); if (index!=-1) { + index_selected = -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); @@ -469,6 +480,7 @@ void template_set_status_disk(GtkWidget* self,hotebook* widgets) { 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->device = yon_char_new(activ_text); disk_cfg->status = menu_id; v_disk_status->pfVectorAdd(v_disk_status, disk_cfg); all_config.flag_set_data = 1; @@ -609,6 +621,7 @@ int main(int argc, char *argv[]){ control_event(widgets, &cfg_custom_gui); block_button_add_edit_del(&cfg_custom_gui.user); block_button_add_edit_del(&cfg_custom_gui.group); + tree_view_select(NULL,&all_config.v_project , &cfg_custom_gui.project); yon_ubl_header_setup_resource(widgets->HeadOverlay,widgets->HeadBox,widgets->HeadImage,banner_path); yon_ubl_status_box_setup(widgets->StatusIcon,widgets->StatusBox,widgets->StatusLabel); diff --git a/source/model/load.c b/source/model/load.c index 10f56e5..2861fea 100644 --- a/source/model/load.c +++ b/source/model/load.c @@ -81,6 +81,10 @@ void load_pars_keys_u_g(config_u_g_p* _config, char* str_key, int index) { } else { _config->UNIX_file = yon_char_new(arr_keys[1]); + if (size_point == 3) { + _config->actors.pfVectorAdd(&_config->actors,yon_char_new(arr_keys[2])); + } + } } } @@ -90,13 +94,13 @@ void load_pars_keys_u_g(config_u_g_p* _config, char* str_key, int index) { } void load_pars_keys_p(config_u_g_p* _config, char* str_key, int index) { - puts(str_key); if (strstr(str_key, "prjquota")) { if (yon_char_find_count(str_key, ":") || yon_char_find_count(str_key, ",")) { int size_point = 0; char** arr_keys = philos_str_split(yon_char_new(str_key), &size_point, ":"); _config->type_arr = yon_char_new(arr_keys[0]); int size_users = 0; + printf("%d users\n", yon_char_find_count(str_key, ":")); if (yon_char_find_count(str_key, ":") == 2) { _config->UNIX_file = yon_char_new(arr_keys[1]); int size_comma = 0; @@ -151,9 +155,9 @@ void load_pars_values(config_u_g_p* _config, char* str_value, int index) { if (index_split == 3 || index_split == 5) { philos_set_pow_size_memory(yon_char_new(arr_values[0]), &_config->soft_restriction_size_pow, array_size_pow); philos_set_size_memory_integer(yon_char_new(arr_values[0]), &_config->soft_restriction_size); - philos_set_size_memory_integer(yon_char_new(arr_values[1]), &_config->soft_restriction_file); - philos_set_pow_size_memory(yon_char_new(arr_values[2]), &_config->severe_limitation_size_pow, array_size_pow); - philos_set_size_memory_integer(yon_char_new(arr_values[2]), &_config->severe_limitation_size); + philos_set_pow_size_memory(yon_char_new(arr_values[1]), &_config->severe_limitation_size_pow, array_size_pow); + philos_set_size_memory_integer(yon_char_new(arr_values[1]), &_config->severe_limitation_size); + philos_set_size_memory_integer(yon_char_new(arr_values[2]), &_config->soft_restriction_file); philos_set_size_memory_integer(yon_char_new(arr_values[3]), &_config->severe_limitation_file); if (index_split == 5) { _config->deferring_size = atoll(arr_values[4]); diff --git a/source/model/model.c b/source/model/model.c index 91b20e5..618c734 100644 --- a/source/model/model.c +++ b/source/model/model.c @@ -102,7 +102,7 @@ int fill_tree_view_project(config_all* all_config,hotebook* widget , char* str_f } } if (flag_gui_add != 0) { - gtk_tree_view_set_model(GTK_TREE_VIEW(widget->spinWeeksFile), model); + gtk_tree_view_set_model(GTK_TREE_VIEW(widget->tree_view), model); } return flag_searhc; } @@ -196,11 +196,11 @@ char quota_fill_generate(char* str_quota, config_u_g_p* _config, GtkListStore* l } -int pars_status_generate(vector* vec_remove, char* disk) { +int pars_status_generate(vector* vec_status, char* disk) { int flag = -1; - if (vec_remove->vectorList.total > 0) { - for (int i = 0; i < vec_remove->vectorList.total; i++) { - disk_status* _config = (disk_status*)vec_remove->pfVectorGet(vec_remove, i); + if (vec_status->vectorList.total > 0) { + for (int i = 0; i < vec_status->vectorList.total; i++) { + disk_status* _config = (disk_status*)vec_status->pfVectorGet(vec_status, i); if (strstr(_config->device, disk)) { flag=1; } @@ -212,7 +212,7 @@ int pars_status_generate(vector* vec_remove, char* disk) { return flag; } -int fill_tree_view_generate(vector* vec_fill, vector* vec_remove, char* str_fill, GtkWidget* tree_view, GtkListStore* liststoreGeneral) { +int fill_tree_view_generate(vector* vec_fill, vector* vec_status_disk, char* str_fill, GtkWidget* tree_view, GtkListStore* liststoreGeneral) { GtkTreeModel *model = GTK_TREE_MODEL(liststoreGeneral); if (vec_fill->vectorList.total > 0) { for (int i = 0; i < vec_fill->vectorList.total; i++) { @@ -223,7 +223,7 @@ int fill_tree_view_generate(vector* vec_fill, vector* vec_remove, char* str_fill char* deferring_file = wrapper_str_time(_config->deferring_file); quota_fill_generate(str_fill, _config,liststoreGeneral,&iter); gtk_list_store_set(liststoreGeneral,&iter, - 0,pars_status_generate(vec_remove,_config->UNIX_file), + 0,pars_status_generate(vec_status_disk,_config->UNIX_file), 1,quota_type(str_fill), 2,_config->UNIX_file, 6,philos_format_cfg_str_size_memory("", _config->soft_restriction_size,_config->soft_restriction_size_pow), diff --git a/source/model/model.h b/source/model/model.h index 7f15180..42028e7 100644 --- a/source/model/model.h +++ b/source/model/model.h @@ -64,5 +64,5 @@ char* format_actors(vector* vec_actors); void model_free_vector_string(vector* vec_str); int fill_tree_view_user_group(config_all* all_config, char* disk, hotebook* widget,char* str_fill , int flag_gui_add); int fill_tree_view_project(config_all* all_config, hotebook* widget, char* str_fill , int flag_gui_add); -int fill_tree_view_generate(vector* vec_fill, vector* vec_remove, char* str_fill, GtkWidget* tree_view, GtkListStore* liststoreGeneral); +int fill_tree_view_generate(vector* vec_fill, vector* vec_status_disk, char* str_fill, GtkWidget* tree_view, GtkListStore* liststoreGeneral); #endif \ No newline at end of file diff --git a/source/model/save.c b/source/model/save.c index b25f370..235a027 100644 --- a/source/model/save.c +++ b/source/model/save.c @@ -2,7 +2,7 @@ #define SAVE_H #include "save.h" -char* save_str_users(config_u_g_p* config, int index) { +char* save_str_users(config_u_g_p* config, int index, char* start_split) { char* cmd = yon_char_new(""); char split_simvol[2] = {0}; split_simvol[0] = 0; @@ -12,7 +12,7 @@ char* save_str_users(config_u_g_p* config, int index) { if (vec_actors->vectorList.total> 0) { for (int i = 0; i < vec_actors->vectorList.total; i++) { if (i==0) { - cmd = yon_char_unite(cmd, ":", NULL); + cmd = yon_char_unite(cmd, start_split, NULL); } str_actors = (char*)vec_actors->pfVectorGet(vec_actors, i); cmd = yon_char_unite(cmd, split_simvol, str_actors, NULL); @@ -43,12 +43,12 @@ char* template_format_save(vector* vec_temp) { char* save_format_status_cmd_all(vector* vec_temp, vector* vec_status_disk) { char* cmd = yon_char_new(""); - if (vec_status_disk->vectorList.total > 0 && vec_status_disk->vectorList.total > 0) { - for (int i=0; i < vec_status_disk->vectorList.total; i++) { + if (vec_temp->vectorList.total > 0 && vec_status_disk->vectorList.total > 0) { + for (int i=0; i < vec_temp->vectorList.total; i++) { config_u_g_p* _config = (config_u_g_p*)vec_temp->pfVectorGet(vec_temp, i); for (int j=0; j < vec_status_disk->vectorList.total;j++) { disk_status* config_disk_status = (disk_status*)vec_status_disk->pfVectorGet(vec_status_disk, j); - if (strstr(config_disk_status->device, _config->device) && strstr(config_disk_status->device, _config->type_arr) ) { + if (strstr(config_disk_status->device, _config->UNIX_file) && strstr(config_disk_status->device, _config->type_arr) ) { cmd = yon_char_unite(cmd, " ", save_format_status_cmd(config_disk_status, _config)); } } @@ -133,11 +133,13 @@ char* save_format_key(config_u_g_p* config, int index) { else { key = yon_char_unite(key, config->UNIX_file,":AUTO", NULL); } + key = yon_char_unite(key, save_str_users(config, index, ",") , "]", NULL); } else { key = yon_char_unite(key, config->UNIX_file, NULL); + key = yon_char_unite(key, save_str_users(config, index, ":") , "]", NULL); } - key = yon_char_unite(key, save_str_users(config, index) , "]", NULL); + return key; } diff --git a/source/model/save.h b/source/model/save.h index 8fb591b..0e4a241 100644 --- a/source/model/save.h +++ b/source/model/save.h @@ -4,7 +4,7 @@ #include "model.h" char* template_format_save(vector* vec_temp); char* save_format_key(config_u_g_p* _config, int index); -char* save_str_users(config_u_g_p* _config, int index); +char* save_str_users(config_u_g_p* _config, int index, char* start_split); char* save_format_str_value(config_u_g_p* config, int index); char* save_format_status_cmd(disk_status* config_disk_status, config_u_g_p* config); char* template_format_remove_save(config_all* _all_config, char* source_remove_cmd); diff --git a/source/ubl-settings-diskquota.c b/source/ubl-settings-diskquota.c index 8a3e069..73561e4 100644 --- a/source/ubl-settings-diskquota.c +++ b/source/ubl-settings-diskquota.c @@ -132,9 +132,9 @@ void config_init(config_settings_gui* main_config){ void wrapper_fill_tree_view_generate(config_all* all_config, custom_window* custom) { g_object_ref(custom->liststoreGeneral); gtk_list_store_clear(custom->liststoreGeneral); - fill_tree_view_generate(&all_config->v_user, &all_config->v_remove, "usrquota",custom->treeViewGeneral, custom->liststoreGeneral); - fill_tree_view_generate(&all_config->v_group, &all_config->v_remove, "grpquota",custom->treeViewGeneral, custom->liststoreGeneral); - fill_tree_view_generate(&all_config->v_project, &all_config->v_remove, "prjquota",custom->treeViewGeneral, custom->liststoreGeneral); + fill_tree_view_generate(&all_config->v_user, &all_config->v_disk_status, "usrquota",custom->treeViewGeneral, custom->liststoreGeneral); + fill_tree_view_generate(&all_config->v_group, &all_config->v_disk_status, "grpquota",custom->treeViewGeneral, custom->liststoreGeneral); + fill_tree_view_generate(&all_config->v_project, &all_config->v_disk_status, "prjquota",custom->treeViewGeneral, custom->liststoreGeneral); } diff --git a/source/view_temp_u_g_p.c b/source/view_temp_u_g_p.c index 9cbf6d9..3f04a71 100644 --- a/source/view_temp_u_g_p.c +++ b/source/view_temp_u_g_p.c @@ -404,10 +404,9 @@ config_u_g_p* get_temp_gui_data_base(config_u_g_p* _config) { &_config->severe_limitation_file, NULL ); - _config->type_arr = yon_char_new(flag_temp_u_g_p); + // _config->status_set= 0; if (strstr(flag_temp_u_g_p,"prjquota")) { - _config->UNIX_file = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryCatalogProject)); char* actors = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryProjectName)); if (strlen(actors)>1) { if (_config->actors.vectorList.total > 0) { @@ -426,11 +425,17 @@ config_u_g_p* get_temp_gui_data_base(config_u_g_p* _config) { char* id = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryProjectId)); _config->id = atoi(id); } + if (strcmp(set_add_edit, "add")==0) { + char* file_dir = (char*)gtk_entry_get_text(GTK_ENTRY(temp_widgets->entryCatalogProject)); + _config->UNIX_file = yon_char_new(file_dir); + _config->type_arr = yon_char_new(flag_temp_u_g_p); + } } else { - _config->UNIX_file = yon_char_new(disk); if (strcmp(set_add_edit, "add")==0) { table_u_g_get_actors(&_config->actors); + _config->UNIX_file = yon_char_new(disk); + _config->type_arr = yon_char_new(flag_temp_u_g_p); } } return _config; diff --git a/ubl-settings-diskquota.glade b/ubl-settings-diskquota.glade index 5a2177f..49273ad 100644 --- a/ubl-settings-diskquota.glade +++ b/ubl-settings-diskquota.glade @@ -2185,7 +2185,7 @@ Project - User + Users True @@ -2197,7 +2197,7 @@ Project - Group + Groups True @@ -4732,7 +4732,7 @@ limit True True adjustment31 - liststoreGeneral + liststoreProject 0