From 93707ea46a7be7bc0d3e4ad780b14734bc4c2781 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 11 Mar 2024 17:44:08 +0600 Subject: [PATCH] Fixed loading from specific file --- source/ubl-settings-usergroups.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index af0c97a..d8d132a 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -11,7 +11,7 @@ int yon_load_proceed(YON_CONFIG_TYPE type){ yon_config_load_config(type,config_get_command("global"),NULL); } if (type==YON_CONFIG_LOCAL){ - yon_config_load_config(type,config_get_command("global"),NULL); + yon_config_load_config(type,config_get_command("system"),NULL); yon_config_load_config(YON_CONFIG_GLOBAL,config_get_global_only_parameters,NULL); yon_config_set_status(DEFAULTPASSWD_parameter,-2); yon_config_set_status(DEFAULTROOTPASSWD_parameter,-2); @@ -57,13 +57,18 @@ int yon_load_proceed(YON_CONFIG_TYPE type){ GtkFileFilter *filter = gtk_file_filter_new(); gtk_file_filter_add_pattern(filter,"*.ini"); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),filter); + gtk_widget_show(dialog); int response = gtk_dialog_run(GTK_DIALOG(dialog)); if (response == GTK_RESPONSE_ACCEPT){ char *file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); if (!yon_char_is_empty(file)){ path=file; } - } else return 0; + gtk_widget_destroy(dialog); + } else { + gtk_widget_destroy(dialog); + return 0; + } yon_config_load_config(type,config_get_command(path),NULL); } @@ -198,11 +203,11 @@ void on_config_global_load(GtkWidget *self, main_window *widgets){ } void on_config_custom_load(GtkWidget *self,main_window *widgets){ - yon_load_proceed(YON_CONFIG_GLOBAL); + yon_load_proceed(YON_CONFIG_CUSTOM); textdomain(template_ui_LocaleName); yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); textdomain(LocaleName); - main_config.load_mode=0; + main_config.load_mode=3; yon_interface_update(widgets); } @@ -334,7 +339,7 @@ void yon_hide_passwords(template_saving_window *window){ free(yon_char_divide(new_value,1)); newv=new_value; } else if (!yon_char_is_empty(new_value)&&new_value[0]=='$') { - if (main_config.load_mode){ + if (main_config.load_mode==1){ newv=new_value; } else { newv="*******"; @@ -343,7 +348,7 @@ void yon_hide_passwords(template_saving_window *window){ newv="*******"; } if (!yon_char_is_empty(old_value)){ - if (main_config.load_mode){ + if (main_config.load_mode==1){ old = yon_char_new("*******"); } else { @@ -360,7 +365,7 @@ void yon_hide_passwords(template_saving_window *window){ free(yon_char_divide(new_value,1)); newv=new_value; } else if (!yon_char_is_empty(new_value)&&new_value[0]=='$') { - if (main_config.load_mode){ + if (main_config.load_mode==1){ newv=new_value; } else { newv="*******"; @@ -369,7 +374,7 @@ void yon_hide_passwords(template_saving_window *window){ newv="*******"; } if (!yon_char_is_empty(old_value)){ - if (main_config.load_mode){ + if (main_config.load_mode==1){ old = yon_char_new("*******"); } else { old = yon_char_unite("",old_value,"",NULL);