From f59f260ea2247a222827385ffafe73f87c9d6625 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 2 Aug 2024 14:17:09 +0600 Subject: [PATCH] Save fix --- source/ubinstall-gtk.c | 35 ++++++++++++++++++++++++++++++++++- source/ubinstall-gtk.h | 1 + ubinstall-gtk.glade | 2 -- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 23a699e..3730671 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -1138,6 +1138,36 @@ void on_log_closed(GtkWidget *, log_window *window){ window->Window=NULL; } +void *on_save_system_configuration(void *data); +void *on_save_system_configuration(void * data){ + main_window *widgets = (main_window*)data; + if (widgets){}; + int size; + config_str all_parameters = yon_config_get_selection_by_key(&size, + user_gecos_parameter, + user_password_parameter, + root_password_parameter, + autologin_parameter, + xkbmodel_parameter, + xkblayout_parameter, + xkbvariant_parameter, + xkboptions_parameter, + hostname_parameter, + zone_parameter, + lang_parameter, + locale_parameter, + NULL); + if (all_parameters){ + char *parameter_string = yon_char_parsed_to_string(all_parameters,size," "); + char *command = save_additional_config_command(parameter_string); + if (system(yon_debug_output("%s\n",command))){}; + yon_char_parsed_free(all_parameters,size); + free(command); + if (parameter_string) free(parameter_string); + } + return NULL; +} + log_window *yon_log_window_new(); log_window *yon_log_window_new(){ log_window *window = malloc(sizeof(log_window)); @@ -1498,7 +1528,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){ yon_config_register(user_gecos_parameter,user_gecos_parameter_command,username); } - if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->UsernameSensitiveCheck))){ + if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)))||!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck))){ yon_config_remove_by_key(user_name_parameter); } else { char *login = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)); @@ -1605,6 +1635,9 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){ if (gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress))>0.9){ pthread_t tid; pthread_create(&tid,NULL,on_setup_system_configuration,widgets); + } else { + pthread_t tid; + pthread_create(&tid,NULL,on_save_system_configuration,widgets); } main_config.save_done=1; yon_debug_output("Save changed to: %s\n",yon_char_from_int(main_config.save_done)); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index cade5bc..d2e9852 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -116,6 +116,7 @@ NULL #define save_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig --target system set [autoinstall] AUTOINSTALL[log]=yes ",parameters, "; nice ubinstall2 --debug autoinstall'", NULL) #define set_user_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig --target system set [autoinstall] ",parameters,";nice ubinstall2 autoconfig'",NULL) +#define save_additional_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig --target system set [autoinstall] ",parameters,"'",NULL) #define open_gparted_command "gparted" diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index f520ce8..258e697 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -2490,7 +2490,6 @@ and help you install UBLinux on your computer True False True - False @@ -3718,7 +3717,6 @@ installed. True False True - False