From a6f1fa5e44823d9a023076b830c70efc80471cc2 Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Thu, 16 Apr 2026 18:32:45 +0600 Subject: [PATCH] WIP config restoring fixes --- locale/ubinstall-gtk.pot | 3 +++ locale/ubinstall-gtk_ru.po | 5 ++++- source/ubinstall-gtk-saving.c | 40 ++++++++++++++--------------------- source/ubinstall-gtk.c | 3 +++ source/ubl-strings.h | 1 + ubinstall-gtk.glade | 4 +++- 6 files changed, 30 insertions(+), 26 deletions(-) diff --git a/locale/ubinstall-gtk.pot b/locale/ubinstall-gtk.pot index 8968599..8d97093 100644 --- a/locale/ubinstall-gtk.pot +++ b/locale/ubinstall-gtk.pot @@ -5363,4 +5363,7 @@ msgid "Database update" msgstr "" msgid "The required field is highlighted in green" +msgstr "" + +msgid "Authentication in the bootloader menu" msgstr "" \ No newline at end of file diff --git a/locale/ubinstall-gtk_ru.po b/locale/ubinstall-gtk_ru.po index e862f0c..fc8cecf 100644 --- a/locale/ubinstall-gtk_ru.po +++ b/locale/ubinstall-gtk_ru.po @@ -5558,4 +5558,7 @@ msgid "Database update" msgstr "Обновление баз данных" msgid "The required field is highlighted in green" -msgstr "Обязательное поле подсвечено зелёным" \ No newline at end of file +msgstr "Обязательное поле подсвечено зелёным" + +msgid "Authentication in the bootloader menu" +msgstr "Аутентификация в меню загрузчика" \ No newline at end of file diff --git a/source/ubinstall-gtk-saving.c b/source/ubinstall-gtk-saving.c index f5f0efd..338500e 100644 --- a/source/ubinstall-gtk-saving.c +++ b/source/ubinstall-gtk-saving.c @@ -8,22 +8,25 @@ void yon_load_proceed(YON_CONFIG_TYPE type){ if (type!=YON_CONFIG_CUSTOM){ yon_config_clean(); } - if (!yon_char_is_empty(config_get_default_command)) + if (!yon_char_is_empty(config_get_default_command)){ yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL); + } + if (main_config.config_load_path){ + if (main_config.startup_config){ + yon_config_restore(NULL); + yon_config_custom_clean(main_config.startup_config); + } + main_config.startup_config = NULL; + yon_config_custom_load_config(&main_config.startup_config,config_get_command(main_config.config_load_path),NULL); + } switch (type){ case YON_CONFIG_LOCAL: - if (main_config.startup_config){ - yon_config_restore(NULL); - } - yon_config_custom_clean(main_config.startup_config); - main_config.startup_config = NULL; - yon_config_custom_load_config(&main_config.startup_config,config_get_command("system"),NULL); main_config.config_load_path = yon_char_new("system"); main_config.config_save_path = main_config.config_load_path; yon_config_load_config(type,config_get_command("system"),NULL); break; case YON_CONFIG_CUSTOM: - if (yon_char_is_empty(main_config.config_load_path)){ + if (yon_char_is_empty(main_config.force_ini)){ char *path = NULL; path=yon_custom_config_init(GTK_FILE_CHOOSER_ACTION_OPEN); if (!yon_char_is_empty(path)){ @@ -34,7 +37,7 @@ void yon_load_proceed(YON_CONFIG_TYPE type){ } } else { yon_config_clean(); - yon_config_load_config(type,config_get_command(main_config.config_load_path),NULL); + yon_config_load_config(type,config_get_command(main_config.force_ini),NULL); } break; default: @@ -47,11 +50,6 @@ void on_config_local_load(GtkWidget *,main_window *widgets){ on_config_custom_load_last(NULL,widgets); return; } - if (!yon_char_is_empty(main_config.config_load_path)) free(main_config.config_load_path); - main_config.config_load_path = yon_char_new("system"); - // yon_config_custom_clean(main_config.startup_config); - // main_config.startup_config = NULL; - // yon_config_custom_load_config(&main_config.startup_config,config_get_command("system"),NULL); yon_load_proceed(YON_CONFIG_LOCAL); main_config.load_mode=YON_CONFIG_LOCAL; yon_main_window_update_locale(widgets); @@ -60,18 +58,10 @@ void on_config_local_load(GtkWidget *,main_window *widgets){ void on_config_custom_load(GtkWidget *,main_window *){ char *temp_custom_path = NULL; - if (!yon_char_is_empty(main_config.config_load_path)){ - temp_custom_path = main_config.config_load_path; - main_config.config_load_path = NULL; - main_config.config_save_path = NULL; - } yon_load_proceed(YON_CONFIG_CUSTOM); if (!yon_char_is_empty(main_config.config_load_path)){ main_config.load_mode=YON_CONFIG_CUSTOM; free(temp_custom_path); - } else { - main_config.config_load_path = temp_custom_path; - main_config.config_save_path = main_config.config_load_path; } } @@ -351,14 +341,16 @@ int yon_config_save(main_window *widgets){ } void yon_config_restore(main_window *){ - yon_launch(yon_debug_output("%s\n","ubconfig --source system remove [autoinstall]")); + if (yon_char_is_empty(main_config.config_load_path)) return; + char *remove_command = yon_char_unite("ubconfig --source ",main_config.config_load_path," remove [autoinstall]",NULL); + yon_launch(yon_debug_output("%s\n",remove_command)); yon_config_custom_apply(&main_config.startup_config); yon_config_set_status_full(1); int size = 0; config_str parameters = yon_config_get_save_parameters(&size); if (size){ char *command_params = yon_char_parsed_to_string(parameters,size, " "); - char *command = yon_char_unite(ubconfig_set_command("system"),command_params,NULL); + char *command = yon_char_unite(ubconfig_set_command(main_config.config_load_path),command_params,NULL); yon_debug_output("%s\n",command); yon_launch(command); yon_char_parsed_free(parameters,size); diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 8886df3..9751093 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -1051,6 +1051,9 @@ void yon_main_window_create(main_window *widgets){ exit (1); } yon_config_mode_start(widgets); + } else { + yon_config_custom_load_config(&main_config.startup_config,config_get_command("system"),NULL); + } { char *command = yon_config_parameter_prepare_command(part_size_parameter_command,"default",NULL,NULL); diff --git a/source/ubl-strings.h b/source/ubl-strings.h index aa585bf..402aa72 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -308,6 +308,7 @@ NULL) #define DB_UPDATE_LABEL _("Database update") #define IMPORTANT_OUTLINE_LABEL _("The required field is highlighted in green") +// #define _LABEL _("Authentication in the bootloader menu") // #define _LABEL _("Chosen size:") // #define _LABEL _("Overall size:") // #define _LABEL _("Select your language:") diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index d1ea92e..5022ba5 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -6548,10 +6548,12 @@ Select a different installation sources. + True False 5 + True True @@ -6564,7 +6566,7 @@ Select a different installation sources. True False - Login without password request + Authentication in the bootloader menu False