From 690d4321448e8112a77e45a1b70e07dd82281de7 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 11 Aug 2025 18:01:13 +0600 Subject: [PATCH 01/10] Fixed compare config loading --- source/libublsettingsui-gtk3-save.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/libublsettingsui-gtk3-save.c b/source/libublsettingsui-gtk3-save.c index 070dbeb..ab6ad05 100644 --- a/source/libublsettingsui-gtk3-save.c +++ b/source/libublsettingsui-gtk3-save.c @@ -378,6 +378,12 @@ struct loaded_config *yon_config_convert_parameter(config_str parsed, int size){ for (int i=0;ifirst=loaded; loaded->next=NULL; loaded->prev=NULL; - loaded->section=NULL; + loaded->section=section; loaded->data=value; } else { loaded->next = (struct loaded_config*)malloc(sizeof(struct loaded_config)); @@ -397,7 +403,7 @@ struct loaded_config *yon_config_convert_parameter(config_str parsed, int size){ next->key=key; next->first=loaded->first; next->next=NULL; - next->section=NULL; + next->section=section; next->data=value; loaded=next; } From b5c0d713a664a45cbf202e319f0e61d15b2e7bd4 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 12 Aug 2025 14:10:06 +0600 Subject: [PATCH 02/10] Saving fixes --- source/libublsettingsui-gtk3-save.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source/libublsettingsui-gtk3-save.c b/source/libublsettingsui-gtk3-save.c index ab6ad05..140e354 100644 --- a/source/libublsettingsui-gtk3-save.c +++ b/source/libublsettingsui-gtk3-save.c @@ -105,6 +105,7 @@ config_str yon_loaded_config_convert_to_save_command(struct loaded_config *targe } free(current->data); cur_section->data = parameters_for_current_command; + printf("%s\n",parameters_for_current_command); } else { char *parameters_for_current_command = NULL; if (yon_config_get_status(current->key)==-1){ @@ -115,6 +116,7 @@ config_str yon_loaded_config_convert_to_save_command(struct loaded_config *targe dictionary *sections_dict = NULL; if (sections) sections_dict = yon_dictionary_get_last((dictionary*)sections); sections = malloc(sizeof(struct yon_temp_command_sections)); + printf("%s\n",parameters_for_current_command); sections->data=parameters_for_current_command; sections->first=sections; sections->key=yon_char_new(current->section); @@ -143,6 +145,7 @@ config_str yon_loaded_config_convert_to_save_command(struct loaded_config *targe dull_command = ubconfig_remove_command_full(path,current->key,(char*)current->data); } yon_char_parsed_add_or_create_if_exists(commands,size,dull_command); + printf("%s\n",dull_command); free(dull_command); } } @@ -366,9 +369,17 @@ void yon_save_window_compared_config_init_unfound(template_saving_window *window int yon_config_parameter_prepare_elements(config_str target, int *size){ int success = 0; for (int i=0;i<(*size);i++){ - char *start_bracket_replaced_string = yon_char_replace(target[i],"[","[\""); + int parameters_size; + config_str parameters = yon_config_command_get_parameters(target[i],¶meters_size); + char *parameters_string = yon_char_parsed_to_string(parameters,parameters_size," "); + char *start_bracket_replaced_string = yon_char_replace(parameters_string,"[","[\""); char *end_bracket_replaced_string = yon_char_replace(start_bracket_replaced_string,"]","\"]"); - target[i] = end_bracket_replaced_string; + char *temp = yon_config_parameter_prepare_command(target[i],NULL,NULL,end_bracket_replaced_string); + if (!yon_char_is_empty(target[i])) free(target[i]); + target[i] = temp; + yon_char_parsed_free(parameters,parameters_size); + free(parameters_string); + free(start_bracket_replaced_string); } return success; } From f65a1cdf5818c2bb164dd68c1b6c14d9136e622f Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 12 Aug 2025 18:02:28 +0600 Subject: [PATCH 03/10] Return of old loading --- source/libublsettingsui-gtk3-save.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/source/libublsettingsui-gtk3-save.c b/source/libublsettingsui-gtk3-save.c index 140e354..070dbeb 100644 --- a/source/libublsettingsui-gtk3-save.c +++ b/source/libublsettingsui-gtk3-save.c @@ -105,7 +105,6 @@ config_str yon_loaded_config_convert_to_save_command(struct loaded_config *targe } free(current->data); cur_section->data = parameters_for_current_command; - printf("%s\n",parameters_for_current_command); } else { char *parameters_for_current_command = NULL; if (yon_config_get_status(current->key)==-1){ @@ -116,7 +115,6 @@ config_str yon_loaded_config_convert_to_save_command(struct loaded_config *targe dictionary *sections_dict = NULL; if (sections) sections_dict = yon_dictionary_get_last((dictionary*)sections); sections = malloc(sizeof(struct yon_temp_command_sections)); - printf("%s\n",parameters_for_current_command); sections->data=parameters_for_current_command; sections->first=sections; sections->key=yon_char_new(current->section); @@ -145,7 +143,6 @@ config_str yon_loaded_config_convert_to_save_command(struct loaded_config *targe dull_command = ubconfig_remove_command_full(path,current->key,(char*)current->data); } yon_char_parsed_add_or_create_if_exists(commands,size,dull_command); - printf("%s\n",dull_command); free(dull_command); } } @@ -369,17 +366,9 @@ void yon_save_window_compared_config_init_unfound(template_saving_window *window int yon_config_parameter_prepare_elements(config_str target, int *size){ int success = 0; for (int i=0;i<(*size);i++){ - int parameters_size; - config_str parameters = yon_config_command_get_parameters(target[i],¶meters_size); - char *parameters_string = yon_char_parsed_to_string(parameters,parameters_size," "); - char *start_bracket_replaced_string = yon_char_replace(parameters_string,"[","[\""); + char *start_bracket_replaced_string = yon_char_replace(target[i],"[","[\""); char *end_bracket_replaced_string = yon_char_replace(start_bracket_replaced_string,"]","\"]"); - char *temp = yon_config_parameter_prepare_command(target[i],NULL,NULL,end_bracket_replaced_string); - if (!yon_char_is_empty(target[i])) free(target[i]); - target[i] = temp; - yon_char_parsed_free(parameters,parameters_size); - free(parameters_string); - free(start_bracket_replaced_string); + target[i] = end_bracket_replaced_string; } return success; } @@ -389,12 +378,6 @@ struct loaded_config *yon_config_convert_parameter(config_str parsed, int size){ for (int i=0;ifirst=loaded; loaded->next=NULL; loaded->prev=NULL; - loaded->section=section; + loaded->section=NULL; loaded->data=value; } else { loaded->next = (struct loaded_config*)malloc(sizeof(struct loaded_config)); @@ -414,7 +397,7 @@ struct loaded_config *yon_config_convert_parameter(config_str parsed, int size){ next->key=key; next->first=loaded->first; next->next=NULL; - next->section=section; + next->section=NULL; next->data=value; loaded=next; } From 898dc49eb6db7c5e3f34ac0f5628fcc12d3f31d3 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 12 Aug 2025 18:04:41 +0600 Subject: [PATCH 04/10] Temporary remove of shutdown config checking --- source/libublsettingsui-gtk3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libublsettingsui-gtk3.c b/source/libublsettingsui-gtk3.c index 117c69c..3134af5 100644 --- a/source/libublsettingsui-gtk3.c +++ b/source/libublsettingsui-gtk3.c @@ -318,7 +318,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),widgets); if (yon_char_is_empty(__yon_config_mode)){ int size; From 6caeca3bdd436628e93d66ffdb9df3d505f528c5 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 13 Aug 2025 17:41:56 +0600 Subject: [PATCH 05/10] Localisation --- libublsettingsui-gtk3.pot | 4 ++++ libublsettingsui-gtk3_ru.po | 6 +++++- source/libublsettingsui-gtk3-save.c | 5 +++++ source/libublsettingsui-gtk3.h | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) 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-save.c b/source/libublsettingsui-gtk3-save.c index 070dbeb..316a9f3 100644 --- a/source/libublsettingsui-gtk3-save.c +++ b/source/libublsettingsui-gtk3-save.c @@ -585,6 +585,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.h b/source/libublsettingsui-gtk3.h index 046e50c..b2cf715 100644 --- a/source/libublsettingsui-gtk3.h +++ b/source/libublsettingsui-gtk3.h @@ -617,4 +617,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 From 9c4f39e1c8da23559d9f35728a386c5d19199ac2 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 14 Aug 2025 15:51:12 +0600 Subject: [PATCH 06/10] Minor saving rework --- source/libublsettingsui-gtk3-save.c | 65 ++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 19 deletions(-) diff --git a/source/libublsettingsui-gtk3-save.c b/source/libublsettingsui-gtk3-save.c index 316a9f3..370ff5e 100644 --- a/source/libublsettingsui-gtk3-save.c +++ b/source/libublsettingsui-gtk3-save.c @@ -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) From 85a5c7c43565519bd76d9b84880a8557ee3bcb97 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 14 Aug 2025 16:16:32 +0600 Subject: [PATCH 07/10] Changed position of command in output --- source/libublsettingsui-gtk3-save.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libublsettingsui-gtk3-save.c b/source/libublsettingsui-gtk3-save.c index 370ff5e..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)); From 4ff84ab7e60074682dc87cd0560037ffacf65b61 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 14 Aug 2025 18:24:38 +0600 Subject: [PATCH 08/10] Icon fixes --- ...ttingsui-gtk3.arrow-down-ngon-symbolic.svg | 58 +++++++++++++++++-- ...tingsui-gtk3.arrow-down-round-symbolic.svg | 54 +++++++++++++---- 2 files changed, 94 insertions(+), 18 deletions(-) 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 + + + + + + + From 69434f91818375c8bbd38e75af992ab599eeed14 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 21 Aug 2025 13:38:46 +0600 Subject: [PATCH 09/10] Added function to set custom data command for exit config check window --- source/libublsettingsui-gtk3.c | 19 +++++++++++++++++-- source/libublsettingsui-gtk3.h | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/source/libublsettingsui-gtk3.c b/source/libublsettingsui-gtk3.c index 3134af5..d15dc5f 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; } @@ -246,6 +256,11 @@ 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); } +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),widgets->Window); + g_object_set_data(G_OBJECT(widgets->Window),"exit_data_callback",data_callback_function); +} + template_main_window *setup_window(){ /* Widgets getting | Получение виджетов */ template_main_window *widgets = malloc(sizeof(template_main_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 b2cf715..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; From 3215ca46ed950263f35a64d6fac81fcfd59b3451 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 21 Aug 2025 18:00:56 +0600 Subject: [PATCH 10/10] Filechooser edits; exit config check fixes --- source/libublsettingsui-gtk3-filechooser.c | 1 + source/libublsettingsui-gtk3.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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.c b/source/libublsettingsui-gtk3.c index d15dc5f..47bd817 100644 --- a/source/libublsettingsui-gtk3.c +++ b/source/libublsettingsui-gtk3.c @@ -253,11 +253,11 @@ gboolean on_window_delete (GtkWidget *self, GdkEvent *,template_main_window *){ } 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),widgets->Window); + 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); }