diff --git a/icons/actions/com.ublinux.libublsettingsui-gtk3.arrow-down-ngon-symbolic.svg b/icons/actions/com.ublinux.libublsettingsui-gtk3.arrow-down-ngon-symbolic.svg index 6c5c415..c5a7179 100644 --- a/icons/actions/com.ublinux.libublsettingsui-gtk3.arrow-down-ngon-symbolic.svg +++ b/icons/actions/com.ublinux.libublsettingsui-gtk3.arrow-down-ngon-symbolic.svg @@ -1,6 +1,52 @@ - - - - - - \ No newline at end of file + + + + + + + + + + diff --git a/icons/actions/com.ublinux.libublsettingsui-gtk3.arrow-down-round-symbolic.svg b/icons/actions/com.ublinux.libublsettingsui-gtk3.arrow-down-round-symbolic.svg index ecb4598..6fa4c13 100644 --- a/icons/actions/com.ublinux.libublsettingsui-gtk3.arrow-down-round-symbolic.svg +++ b/icons/actions/com.ublinux.libublsettingsui-gtk3.arrow-down-round-symbolic.svg @@ -1,14 +1,44 @@ - - + - - - - - - - - - - \ No newline at end of file + + + + + + + diff --git a/libublsettingsui-gtk3.pot b/libublsettingsui-gtk3.pot index d0bb2b3..c226b19 100644 --- a/libublsettingsui-gtk3.pot +++ b/libublsettingsui-gtk3.pot @@ -384,3 +384,7 @@ msgstr "" #: source/libublsettingsui-gtk3.h:492 msgid "Exit" msgstr "" + +#: source/libublsettingsui-gtk3.h:493 +msgid "Access to file denied" +msgstr "" diff --git a/libublsettingsui-gtk3_ru.po b/libublsettingsui-gtk3_ru.po index 934b5e6..1767057 100644 --- a/libublsettingsui-gtk3_ru.po +++ b/libublsettingsui-gtk3_ru.po @@ -390,4 +390,8 @@ msgstr "Изменения не сохранены ни в локальный, #: source/libublsettingsui-gtk3.h:492 msgid "Exit" -msgstr "Выход" \ No newline at end of file +msgstr "Выход" + +#: source/libublsettingsui-gtk3.h:493 +msgid "Access to file denied" +msgstr "Отказано в доступе к файлу" \ No newline at end of file diff --git a/source/libublsettingsui-gtk3-filechooser.c b/source/libublsettingsui-gtk3-filechooser.c index 3d40bd7..d287a79 100644 --- a/source/libublsettingsui-gtk3-filechooser.c +++ b/source/libublsettingsui-gtk3-filechooser.c @@ -51,6 +51,7 @@ void on_file_chooser_selected(GtkWidget *self, filechooser_window *window){ (action == GTK_FILE_CHOOSER_ACTION_SAVE&&!yon_file_is_directory(data)) || (action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER&&yon_file_is_directory(data)) ){ + // gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(window->MainFileChooser),g_path_get_basename(data)); yon_char_parsed_add_or_create_if_exists(paths_success,&success_size,data); } diff --git a/source/libublsettingsui-gtk3-save.c b/source/libublsettingsui-gtk3-save.c index 070dbeb..a4bb549 100644 --- a/source/libublsettingsui-gtk3-save.c +++ b/source/libublsettingsui-gtk3-save.c @@ -28,7 +28,7 @@ void _yon_saving_threaded(char *final_command){ int file_save; config_str file_return = yon_config_load_file(file,&file_save); fclose(file); - file_return = yon_char_parsed_append(file_return,&file_save,final_command); + file_return = yon_char_parsed_prepend(file_return,&file_save,final_command); if (save_success_function) { struct save_return *data = malloc(sizeof(struct save_return)); @@ -70,6 +70,13 @@ struct loaded_config *yon_save_window_get_saved_parameters(template_saving_windo return final; } +// struct __yon_save_section{ +// int save_size; +// config_str save_config; +// int remove_size; +// config_str remove_config; +// } __yon_save_section; + config_str yon_loaded_config_convert_to_save_command(struct loaded_config *target, int *size,char *path){ (*size)=0; @@ -138,13 +145,24 @@ config_str yon_loaded_config_convert_to_save_command(struct loaded_config *targe for_dictionaries(current,sections){ char *dull_command = NULL; if (current->status>=0){ - dull_command = ubconfig_set_command_full(path,current->key,(char*)current->data); + dull_command = !commands?ubconfig_set_command_full(path,current->key,(char*)current->data):yon_char_unite("-- set ",current->key," ",(char*)current->data,NULL); } else { - dull_command = ubconfig_remove_command_full(path,current->key,(char*)current->data); + dull_command = !commands?ubconfig_remove_command_full(path,current->key,(char*)current->data):yon_char_unite("-- remove ",current->key," ",(char*)current->data, NULL); } yon_char_parsed_add_or_create_if_exists(commands,size,dull_command); free(dull_command); } + // struct yon_temp_command_sections *current; + // for_dictionaries(current,sections){ + // char *dull_command = NULL; + // if (current->status>=0){ + // dull_command = ubconfig_set_command_full(path,current->key,(char*)current->data); + // } else { + // dull_command = ubconfig_remove_command_full(path,current->key,(char*)current->data); + // } + // yon_char_parsed_add_or_create_if_exists(commands,size,dull_command); + // free(dull_command); + // } } return commands; } @@ -378,29 +396,38 @@ struct loaded_config *yon_config_convert_parameter(config_str parsed, int size){ for (int i=0;ikey=key; + loaded->key=yon_char_new(key); loaded->first=loaded; loaded->next=NULL; loaded->prev=NULL; - loaded->section=NULL; - loaded->data=value; + loaded->section=yon_char_new(section); + loaded->data=yon_char_new(value); } else { loaded->next = (struct loaded_config*)malloc(sizeof(struct loaded_config)); struct loaded_config *next=loaded->next; next->first=loaded->first; next->prev=loaded; - next->key=key; + next->key=yon_char_new(key); next->first=loaded->first; next->next=NULL; - next->section=NULL; - next->data=value; + next->section=yon_char_new(section); + next->data=yon_char_new(value); loaded=next; } + if (!yon_char_is_empty(value)) free(value); + if (!yon_char_is_empty(key)) free(key); + if (!yon_char_is_empty(section)) free(section); } return loaded; } @@ -464,7 +491,7 @@ struct loaded_config *yon_config_get_compared(char *command){ if (config&&size>0){ for (int i=0;itype!=YON_CONFIG_CUSTOM? yon_config_get_type_path(window->type):window->custom_save_path); yon_config_parameter_prepare_elements(commands,&size); - char *final_command = yon_char_parsed_to_string(commands,size,";"); + char *final_command = yon_char_parsed_to_string(commands,size," "); char *new_str_closed = yon_char_replace(final_command,"\n","\\n"); if (presave_function) @@ -585,6 +612,11 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){ if (!path&&type == YON_CONFIG_CUSTOM){ path = yon_custom_config_init(GTK_FILE_CHOOSER_ACTION_SAVE); if (!path) return NULL; + if ((access(path,0)==F_OK&&access(path,4)!=F_OK)){ + if (yon_status_box_is_set()){ + yon_ubl_status_box_render(ACCESS_DENIED_LABEL(path),BACKGROUND_IMAGE_FAIL_TYPE); + } + } } va_list args; diff --git a/source/libublsettingsui-gtk3.c b/source/libublsettingsui-gtk3.c index 117c69c..47bd817 100644 --- a/source/libublsettingsui-gtk3.c +++ b/source/libublsettingsui-gtk3.c @@ -233,9 +233,19 @@ int yon_ubl_connect_config(_template_config *config){ return replaces; } -gboolean on_window_delete (GtkWidget *, GdkEvent *,template_main_window *widgets){ +gboolean on_window_delete (GtkWidget *self, GdkEvent *,template_main_window *){ template_saving_window *window = yon_exit_window_new(); if (window){ + GCallback delete_callback = g_object_get_data(G_OBJECT(self),"exit_data_callback"); + if (delete_callback){ + ((void(*)(template_saving_window*))delete_callback)(window); + GtkTreeIter iter; + if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter)){ + gtk_widget_destroy(window->Window); + free(window); + return 0; + } + } gtk_widget_show(window->Window); return 1; } @@ -243,7 +253,12 @@ gboolean on_window_delete (GtkWidget *, GdkEvent *,template_main_window *widgets } void yon_window_remove_exit_config_check(template_main_window *widgets){ - g_signal_handlers_disconnect_by_func(G_OBJECT(widgets->Window),G_CALLBACK(on_window_delete),widgets); + g_signal_handlers_disconnect_by_func(G_OBJECT(widgets->Window),G_CALLBACK(on_window_delete),NULL); +} + +void yon_window_set_exit_config_check(template_main_window *widgets, GCallback data_callback_function){ + g_signal_connect(G_OBJECT(widgets->Window),"delete-event",G_CALLBACK(on_window_delete),NULL); + g_object_set_data(G_OBJECT(widgets->Window),"exit_data_callback",data_callback_function); } template_main_window *setup_window(){ @@ -318,7 +333,7 @@ template_main_window *setup_window(){ g_signal_connect(G_OBJECT(widgets->Window), "destroy", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),template_app_information.wiki_link); g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),template_app_information.app_version); - g_signal_connect(G_OBJECT(widgets->Window),"delete-event",G_CALLBACK(on_window_delete),widgets); + g_signal_connect(G_OBJECT(widgets->Window),"delete-event",G_CALLBACK(on_window_delete),NULL); if (yon_char_is_empty(__yon_config_mode)){ int size; diff --git a/source/libublsettingsui-gtk3.h b/source/libublsettingsui-gtk3.h index 046e50c..9708ff7 100644 --- a/source/libublsettingsui-gtk3.h +++ b/source/libublsettingsui-gtk3.h @@ -325,6 +325,8 @@ void yon_ubl_settings_window_set_standard_callbacks(template_main_window *widget void yon_window_remove_exit_config_check(template_main_window *widgets); +void yon_window_set_exit_config_check(template_main_window *widgets, GCallback data_callback_function); + typedef struct { GtkWidget *Window; GtkWidget *HeaderTopic; @@ -617,4 +619,5 @@ yon_password_window *yon_password_open(GtkEntry *target); #define _EMPTY_IMPORTANT_LABEL yon_char_get_localised_from_lib("Empty important field!") #define _INCORRECT_HASH_LABEL yon_char_get_localised_from_lib("Invalid hash") #define _ENCRYPTION_DEFAULT_LABEL yon_char_get_localised_from_lib("Default (None)") + #define ACCESS_DENIED_LABEL(target) yon_char_unite(yon_char_get_localised_from_lib("Access to file denied"),": ", target,NULL) #endif \ No newline at end of file