From 22205c553b14848f1f68bd55471c3f5c6ab8c6a8 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Thu, 29 Feb 2024 10:56:11 +0600 Subject: [PATCH 1/4] Added debug outputs --- source/libublsettingsui-gtk3.c | 79 ++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/source/libublsettingsui-gtk3.c b/source/libublsettingsui-gtk3.c index 600c1a1..f76606a 100644 --- a/source/libublsettingsui-gtk3.c +++ b/source/libublsettingsui-gtk3.c @@ -194,47 +194,52 @@ void on_save_parameters(GtkWidget *self, template_saving_window *window){ } } } - if (debug_output==1){ - template_debug_window *debug_window = template_debugger_window_new(); - gtk_widget_show(debug_window->Window); - dictionary *dict = NULL; - char *final_command_line = ""; - if (final_remove){ - for_dictionaries(dict,final_remove){ - char *final_command = yon_char_unite(remove_command," ",dict->key," ",(char*)dict->data,NULL); - char *temp = yon_char_unite(final_command_line,!yon_char_is_empty(final_command_line)?";echo \'":"echo \'",final_command,"\';",final_command,NULL); - if (!yon_char_is_empty(final_command_line)) - free(final_command_line); - final_command_line=temp; - free(final_command); - } - } - if (final_append){ - for_dictionaries(dict,final_append){ - char *final_command = yon_char_unite(append_command," ",dict->key," ",(char*)dict->data,NULL); - char *temp = yon_char_unite(final_command_line,!yon_char_is_empty(final_command_line)?";echo \'":"echo \'",final_command,"\';",final_command,NULL); - if (!yon_char_is_empty(final_command_line)) - free(final_command_line); - final_command_line=temp; - free(final_command); - } - } - if (window->type==YON_CONFIG_BOTH) { - if (template_config->load_mode==1){ - yon_config_save_registered("system"); - } else if (template_config->load_mode==0){ - yon_config_save_registered("global"); - } - } - if (!yon_char_is_empty(final_command_line)){ - yon_terminal_integrated_start(debug_window->Vte,final_command_line,NULL,NULL); - } - } else { + // if (debug_output==1){ + // template_debug_window *debug_window = template_debugger_window_new(); + // gtk_widget_show(debug_window->Window); + // dictionary *dict = NULL; + // char *final_command_line = ""; + // if (final_remove){ + // for_dictionaries(dict,final_remove){ + // char *final_command = yon_char_unite(remove_command," ",dict->key," ",(char*)dict->data,NULL); + // char *temp = yon_char_unite(final_command_line,!yon_char_is_empty(final_command_line)?";echo \"":"echo \"",final_command,"\";",final_command,NULL); + // if (!yon_char_is_empty(final_command_line)) + // free(final_command_line); + // final_command_line=temp; + // free(final_command); + // } + // } + // if (final_append){ + // for_dictionaries(dict,final_append){ + // char *final_command = yon_char_unite(append_command," ",dict->key," ",(char*)dict->data,NULL); + // char *temp = yon_char_unite(final_command_line,!yon_char_is_empty(final_command_line)?";echo \"":"echo \"",final_command,"\";",final_command,NULL); + // if (!yon_char_is_empty(final_command_line)) + // free(final_command_line); + // final_command_line=temp; + // free(final_command); + // } + // } + // if (window->type==YON_CONFIG_BOTH) { + // if (template_config->load_mode==1){ + // yon_config_save_registered("system"); + // } else if (template_config->load_mode==0){ + // yon_config_save_registered("global"); + // } + // } + // if (!yon_char_is_empty(final_command_line)){ + // if (debug_output) + // printf("%s\n",final_command_line); + // yon_terminal_integrated_start(debug_window->Vte,final_command_line,NULL,NULL); + // } + // } else + { dictionary *dict = NULL; if (final_remove){ for_dictionaries(dict,final_remove){ char *final_command = yon_char_unite(remove_command," ",dict->key," ",(char*)dict->data,NULL); system(final_command); + if (debug_output) + printf("%s\n",final_command); free(final_command); } } @@ -242,6 +247,8 @@ void on_save_parameters(GtkWidget *self, template_saving_window *window){ for_dictionaries(dict,final_append){ char *final_command = yon_char_unite(append_command," ",dict->key," ",(char*)dict->data,NULL); system(final_command); + if (debug_output) + printf("%s\n",final_command); free(final_command); } } -- 2.35.1 From d77641625c9ab114b6b730e9d1e0a50cdad0cbb4 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 4 Mar 2024 10:24:44 +0600 Subject: [PATCH 2/4] Saving reworks beginning --- source/libublsettingsui-gtk3.c | 13 ++++++++----- source/libublsettingsui-gtk3.h | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/source/libublsettingsui-gtk3.c b/source/libublsettingsui-gtk3.c index f76606a..d1c94a3 100644 --- a/source/libublsettingsui-gtk3.c +++ b/source/libublsettingsui-gtk3.c @@ -113,6 +113,13 @@ void on_about(GtkWidget *self, char *version_application){ } //functions +void (*save_success_function)(void*)=NULL; +void *save_success_argument=NULL; + +void yon_save_window_set_postsave_function(void *function, void *data){ + save_success_function=function; + save_success_argument=data; +} void on_save_window_parameter_switched(GtkCellRendererToggle *self, gchar *path, template_saving_window *window){ GtkTreeIter iter,itar; @@ -238,7 +245,6 @@ void on_save_parameters(GtkWidget *self, template_saving_window *window){ for_dictionaries(dict,final_remove){ char *final_command = yon_char_unite(remove_command," ",dict->key," ",(char*)dict->data,NULL); system(final_command); - if (debug_output) printf("%s\n",final_command); free(final_command); } @@ -247,7 +253,6 @@ void on_save_parameters(GtkWidget *self, template_saving_window *window){ for_dictionaries(dict,final_append){ char *final_command = yon_char_unite(append_command," ",dict->key," ",(char*)dict->data,NULL); system(final_command); - if (debug_output) printf("%s\n",final_command); free(final_command); } @@ -316,7 +321,7 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){ loaded.dict = yon_dictionary_new(); dictionary *dct; for_dictionaries(dct,section_commands){ - char *command = yon_char_unite(ubconfig_load_command," ", config_to_save," get ", dct->key," ", yon_dictionary_get_data(dct,char*),NULL); + char *command = yon_char_unite(ubconfig_load_command_old," ", config_to_save," get ", dct->key," ", yon_dictionary_get_data(dct,char*),NULL); FILE *output = popen(command, "r"); char **output_strings = NULL; output_strings = malloc(sizeof(char*)); @@ -716,8 +721,6 @@ int yon_ubl_setup_arguments(int argc, char *argv[],config_str *unfound_arguments template_config->load_socket_id=atoi(optarg); break; case 'c': if (system(remove_config_dir_command)){}; - break; - case 'd': debug_output = 1; break; case 1: template_config->lock_help=1; diff --git a/source/libublsettingsui-gtk3.h b/source/libublsettingsui-gtk3.h index 3526e29..a8acc81 100644 --- a/source/libublsettingsui-gtk3.h +++ b/source/libublsettingsui-gtk3.h @@ -215,10 +215,10 @@ typedef struct { char *action_text; } dialog_confirmation_data; -static int debug_output; - int yon_confirmation_dialog_call(GtkWidget *self,dialog_confirmation_data *data); +void yon_save_window_set_postsave_function(void *function, void *data); + template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...); /**yon_open_browser(GtkWidget *self, char *link) -- 2.35.1 From 2e2ba46eb1a240ff3cf70852da6a935374b37dba Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 4 Mar 2024 10:32:05 +0600 Subject: [PATCH 3/4] Command fix --- 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 d1c94a3..e939bff 100644 --- a/source/libublsettingsui-gtk3.c +++ b/source/libublsettingsui-gtk3.c @@ -321,7 +321,7 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){ loaded.dict = yon_dictionary_new(); dictionary *dct; for_dictionaries(dct,section_commands){ - char *command = yon_char_unite(ubconfig_load_command_old," ", config_to_save," get ", dct->key," ", yon_dictionary_get_data(dct,char*),NULL); + char *command = yon_char_unite(ubconfig_load_command," ", config_to_save," get ", dct->key," ", yon_dictionary_get_data(dct,char*),NULL); FILE *output = popen(command, "r"); char **output_strings = NULL; output_strings = malloc(sizeof(char*)); -- 2.35.1 From 45838b2a105476f5ff92445faa85a5ee207cb575 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 5 Mar 2024 10:20:39 +0600 Subject: [PATCH 4/4] Fixed russian localisation --- libublsettingsui-gtk3_ru.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libublsettingsui-gtk3_ru.po b/libublsettingsui-gtk3_ru.po index 95e1f03..c469ce4 100644 --- a/libublsettingsui-gtk3_ru.po +++ b/libublsettingsui-gtk3_ru.po @@ -55,7 +55,7 @@ msgstr "Сохранить" #: source/libublsettingsui-gtk3.h:42 msgid "Load local configuration" -msgstr "Загрузить локальную конфигуруцию" +msgstr "Загрузить локальную конфигурацию" #: source/libublsettingsui-gtk3.h:43 msgid "Load global configuration" -- 2.35.1