From d77641625c9ab114b6b730e9d1e0a50cdad0cbb4 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 4 Mar 2024 10:24:44 +0600 Subject: [PATCH] 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)