Добавил вывод сообщения "Нечего сохранять"

pull/4/head
Igor Belitskiy 2 years ago
parent b09c95fa41
commit 78674ed79b

@ -739,7 +739,7 @@ void tree_view_del_line() {
gtk_list_store_clear(main_config.list); gtk_list_store_clear(main_config.list);
char* key_del = save_format_key(main_config.size_tree_view-1); char* key_del = save_format_key(main_config.size_tree_view-1);
if (key_del != NULL) { if (key_del != NULL) {
main_config.array_del_line = yon_char_parsed_append(main_config.array_del_line, &main_config.size_array_del_line, key_del); main_config.array_del_line = yon_char_parsed_append(main_config.array_del_line, &main_config.size_array_del_line, yon_char_new(key_del));
free(key_del); free(key_del);
} }
main_config.type_quota = yon_char_parsed_shrink(main_config.type_quota, &main_config.size_tree_view,index); main_config.type_quota = yon_char_parsed_shrink(main_config.type_quota, &main_config.size_tree_view,index);
@ -779,23 +779,40 @@ void tree_view_del_line() {
} }
} }
void wrapper_all_save() { void wrapper_all_save() {
int flag_mess_save = 0;
if (main_config.flag_load == 0) { if (main_config.flag_load == 0) {
template_format_str_save(main_config.load_system_cfg, CMD_ALL_SAVE, CMD_ALL_REMOVE); flag_mess_save = template_format_str_save(main_config.load_system_cfg, CMD_ALL_SAVE, CMD_ALL_REMOVE);
} }
else { else {
template_format_str_save(main_config.load_global_cfg, CMD_ALL_SAVE, CMD_ALL_REMOVE); flag_mess_save = template_format_str_save(main_config.load_global_cfg, CMD_ALL_SAVE, CMD_ALL_REMOVE);
} }
yon_ubl_status_box_render(GLOBAL_LOCAL_SAVE_SUCCESS,BACKGROUND_IMAGE_SUCCESS_TYPE); if (flag_mess_save) {
yon_ubl_status_box_render(GLOBAL_LOCAL_SAVE_SUCCESS,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
else {
yon_ubl_status_box_render(MESS_NOTHING_SAVE, BACKGROUND_IMAGE_SUCCESS_TYPE);
}
} }
void wrapper_global_save() { void wrapper_global_save() {
template_format_str_save(main_config.load_global_cfg, CMD_SAVE_GLOBAL, CMD_REMOVE_GLOBAL); if (template_format_str_save(main_config.load_global_cfg, CMD_SAVE_GLOBAL, CMD_REMOVE_GLOBAL)) {
yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS,BACKGROUND_IMAGE_SUCCESS_TYPE); yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
else {
yon_ubl_status_box_render(MESS_NOTHING_SAVE, BACKGROUND_IMAGE_SUCCESS_TYPE);
}
} }
void wrapper_system_save() { void wrapper_system_save() {
template_format_str_save(main_config.load_system_cfg, CMD_SAVE_SYSTEM, CMD_REMOVE_SYSTEM); if (template_format_str_save(main_config.load_system_cfg, CMD_SAVE_SYSTEM, CMD_REMOVE_SYSTEM)) {
yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS,BACKGROUND_IMAGE_SUCCESS_TYPE); yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
else {
yon_ubl_status_box_render(MESS_NOTHING_SAVE, BACKGROUND_IMAGE_SUCCESS_TYPE);
}
} }
@ -813,8 +830,6 @@ char* save_format_value(int index) {
split_simvol[0] = 0; split_simvol[0] = 0;
split_simvol[1] = 0; split_simvol[1] = 0;
if (strstr(main_config.soft_raw_limit[index], "-") == NULL) { if (strstr(main_config.soft_raw_limit[index], "-") == NULL) {
puts(main_config.soft_raw_limit[index]);
printf("%d\n", main_config.soft_raw_limit_size[index]);
value = yon_char_unite(philos_format_cfg_str_size_memory("MemoryHigh", main_config.soft_raw_limit[index],main_config.soft_raw_limit_size[index]),NULL); value = yon_char_unite(philos_format_cfg_str_size_memory("MemoryHigh", main_config.soft_raw_limit[index],main_config.soft_raw_limit_size[index]),NULL);
split_simvol[0] = ','; split_simvol[0] = ',';
split_simvol[1] = '\0'; split_simvol[1] = '\0';
@ -862,7 +877,6 @@ int check_save(dictionary* load_cfg) {
} }
for_dictionaries(ptr_dict_gui, main_config.save_cfg_gui) { for_dictionaries(ptr_dict_gui, main_config.save_cfg_gui) {
for_dictionaries(ptr_dict_load, load_cfg) { for_dictionaries(ptr_dict_load, load_cfg) {
key_gui = ptr_dict_gui->key; key_gui = ptr_dict_gui->key;
value_gui = (char*)ptr_dict_gui->data; value_gui = (char*)ptr_dict_gui->data;
key_load = ptr_dict_load->key; key_load = ptr_dict_load->key;
@ -892,16 +906,19 @@ int template_format_str_save(dictionary* load_cfg, char* source_set_cmd, char* s
} }
else if (cmd_remove != NULL) { else if (cmd_remove != NULL) {
yon_config_save(cmd_remove); yon_config_save(cmd_remove);
puts(cmd_remove);
} }
else if (cmd_set != NULL) { else if (cmd_set != NULL) {
yon_config_save(cmd_set); yon_config_save(cmd_set);
puts(cmd_remove);
} }
else { else {
return 0; return 0;
} }
if (cmd_remove != NULL) {
free(cmd_remove);
}
if (cmd_set != NULL) {
free(cmd_set);
}
return 1; return 1;
} }
@ -909,6 +926,9 @@ char* template_format_str_set_save(dictionary* load_cfg, char* source_set_cmd) {
yon_dictionary_free_all(main_config.save_cfg_gui, NULL); yon_dictionary_free_all(main_config.save_cfg_gui, NULL);
char* cmd = yon_char_new(source_set_cmd); char* cmd = yon_char_new(source_set_cmd);
main_config.save_cfg_gui = yon_dictionary_create_empty(); main_config.save_cfg_gui = yon_dictionary_create_empty();
if (check_save(load_cfg)) {
return NULL;
}
int flag_save = 0; int flag_save = 0;
for (size_t index = 0; index < main_config.size_tree_view; index++) { for (size_t index = 0; index < main_config.size_tree_view; index++) {
char* key = NULL; char* key = NULL;
@ -940,9 +960,13 @@ char* template_format_str_set_save(dictionary* load_cfg, char* source_set_cmd) {
char* template_format_str_remove_save(char* source_remove_cmd) { char* template_format_str_remove_save(char* source_remove_cmd) {
char* cmd = yon_char_new(source_remove_cmd); char* cmd = yon_char_new(source_remove_cmd);
int flag_save = 0; int flag_save = 0;
if (main_config.size_array_del_line == 0) {
return NULL;
}
for (size_t index = 0; index < main_config.size_array_del_line; index++) { for (size_t index = 0; index < main_config.size_array_del_line; index++) {
char* key = main_config.array_del_line[index]; char* key = main_config.array_del_line[index];
if (key != NULL) { if (key != NULL) {
puts(key);
cmd = yon_char_unite(cmd, " " , key, " ", NULL); cmd = yon_char_unite(cmd, " " , key, " ", NULL);
flag_save = 1; flag_save = 1;
free(key); free(key);

@ -42,4 +42,5 @@
#define STR_DEL_TABLE _("Quota deleted") #define STR_DEL_TABLE _("Quota deleted")
#define STR_NO_SELECT_TABLE _("Quota deleted") #define STR_NO_SELECT_TABLE _("Quota deleted")
#define STR_QUOTAS_ADD _("Quota deleted") #define STR_QUOTAS_ADD _("Quota deleted")
#define ALL_SAVE_SUCCESS _("Save configuration") #define ALL_SAVE_SUCCESS _("Save configuration")
#define MESS_NOTHING_SAVE _("Nothing to save!")

@ -2736,6 +2736,7 @@ translated and supported by community.</property>
<property name="width-request">640</property> <property name="width-request">640</property>
<property name="height-request">500</property> <property name="height-request">500</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="window-position">center</property>
<property name="default-width">700</property> <property name="default-width">700</property>
<property name="default-height">500</property> <property name="default-height">500</property>
<property name="icon-name">com.ublinux.ubl-settings-resourcequota</property> <property name="icon-name">com.ublinux.ubl-settings-resourcequota</property>

Loading…
Cancel
Save