WIP config restoring fixes

pull/387/head
parent b05ef664b8
commit a6f1fa5e44

@ -5364,3 +5364,6 @@ msgstr ""
msgid "The required field is highlighted in green"
msgstr ""
msgid "Authentication in the bootloader menu"
msgstr ""

@ -5559,3 +5559,6 @@ msgstr "Обновление баз данных"
msgid "The required field is highlighted in green"
msgstr "Обязательное поле подсвечено зелёным"
msgid "Authentication in the bootloader menu"
msgstr "Аутентификация в меню загрузчика"

@ -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);
switch (type){
case YON_CONFIG_LOCAL:
}
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("system"),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:
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);

@ -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);

@ -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:")

@ -6548,10 +6548,12 @@ Select a different installation sources.</property>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">5</property>
<child>
<object class="GtkSwitch" id="BootloadNoPasswordSwitch">
<property name="visible">True</property>
<property name="can-focus">True</property>
</object>
<packing>
@ -6564,7 +6566,7 @@ Select a different installation sources.</property>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Login without password request</property>
<property name="label" translatable="yes">Authentication in the bootloader menu</property>
</object>
<packing>
<property name="expand">False</property>

Loading…
Cancel
Save