diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index 30a254b..5e42f36 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -52,7 +52,7 @@ int yon_kernel_addon_save(main_window *widgets){ for(GList *iter = list;iter;iter = iter->next){ kernel_addon_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row"); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->InstallCheck))){ - yon_config_append_element(packages_parameter,row->modules," "); + yon_config_append_element(packages_parameter,row->modules,","); } } diff --git a/source/ubinstall-gtk-kernel.c b/source/ubinstall-gtk-kernel.c index 51cd994..5f5484c 100644 --- a/source/ubinstall-gtk-kernel.c +++ b/source/ubinstall-gtk-kernel.c @@ -395,7 +395,7 @@ void yon_kernel_addon_setup(main_window *widgets){ int modules_size; config_str modules_parsed = NULL; if (!yon_char_is_empty(modules)){ - modules_parsed = yon_char_parse(modules,&modules_size," "); + modules_parsed = yon_char_parse(modules,&modules_size,","); } int size; diff --git a/source/ubinstall-gtk-log.c b/source/ubinstall-gtk-log.c index 72ba72e..fecb9a6 100644 --- a/source/ubinstall-gtk-log.c +++ b/source/ubinstall-gtk-log.c @@ -141,7 +141,7 @@ void yon_installation_progress_update(GFileMonitor *,GFile *,GFile *,GFileMonito config_str parsed = yon_char_parse(current_copy, &size, " "); if (size >= 3) { - double fraction = atof(parsed[2]) / 100; + double fraction = atof(parsed[3]) / 100; gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress), fraction); gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), yon_char_parsed_to_string(parsed, size, " ")); yon_char_parsed_free(parsed,size); diff --git a/source/ubinstall-gtk-packages.c b/source/ubinstall-gtk-packages.c index 9d18826..40f02b3 100644 --- a/source/ubinstall-gtk-packages.c +++ b/source/ubinstall-gtk-packages.c @@ -68,6 +68,8 @@ GtkTreeIter *yon_subcategory_check(GtkTreeStore *target, GtkTreeIter *parent_ite void yon_packages_tab_init(main_window *widgets){ gtk_tree_store_clear(widgets->PackagesList); int size; + char *config_packages = config(packages_parameter); + config_str packages = yon_resource_open_file(groups_list_path,&size); for (int i=1;iPackagesList,&package_iter,subcategory_iter); char *full_string = yon_char_unite("",parsed[2],"\n",_(parsed[3]),NULL); - gtk_tree_store_set(widgets->PackagesList,&package_iter,0,0,1,parsed[2],2,full_string,3,1,-1); + gtk_tree_store_set(widgets->PackagesList,&package_iter,0,!!yon_char_check_element(config_packages,parsed[2],","),1,parsed[2],2,full_string,3,1,-1); free(full_string); gtk_tree_iter_free(subcategory_iter); } else { @@ -90,14 +92,14 @@ void yon_packages_tab_init(main_window *widgets){ gtk_tree_store_set(widgets->PackagesList,&subcatiter,1,parsed[1],2,_(parsed[3]),3,0,-1); gtk_tree_store_append(widgets->PackagesList,&package_iter,&subcatiter); char *full_string = yon_char_unite("",parsed[2],"\n",_(parsed[3]),NULL); - gtk_tree_store_set(widgets->PackagesList,&package_iter,0,0,1,parsed[2],2,full_string,3,1,-1); + gtk_tree_store_set(widgets->PackagesList,&package_iter,0,!!yon_char_check_element(config_packages,parsed[2],","),1,parsed[2],2,full_string,3,1,-1); free(full_string); } } else { GtkTreeIter package_iter; gtk_tree_store_append(widgets->PackagesList,&package_iter,category_iter); char *full_string = yon_char_unite("",parsed[2],"\n",_(parsed[3]),NULL); - gtk_tree_store_set(widgets->PackagesList,&package_iter,0,0,1,parsed[2],2,full_string,3,1,-1); + gtk_tree_store_set(widgets->PackagesList,&package_iter,0,!!yon_char_check_element(config_packages,parsed[2],","),1,parsed[2],2,full_string,3,1,-1); free(full_string); } gtk_tree_iter_free(category_iter); @@ -121,7 +123,7 @@ void yon_packages_tab_init(main_window *widgets){ gtk_tree_store_set(widgets->PackagesList,&catiter,1,parsed[0],2,_(parsed[0]),3,0,-1); gtk_tree_store_append(widgets->PackagesList,&package_iter,&catiter); char *full_string = yon_char_unite("",parsed[2],"\n",_(parsed[3]),NULL); - gtk_tree_store_set(widgets->PackagesList,&package_iter,0,0,1,parsed[2],2,full_string,3,1,-1); + gtk_tree_store_set(widgets->PackagesList,&package_iter,0,!!yon_char_check_element(config_packages,parsed[2],","),1,parsed[2],2,full_string,3,1,-1); free(full_string); } } diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index e27be95..01ff02a 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -525,6 +525,8 @@ void on_page_cancel_clicked(GtkWidget *, main_window *widgets){ case YON_PAGE_INSTALL_ERROR: case YON_PAGE_CONFIGURE_SAVE: case YON_PAGE_COMPLETION: + yon_config_restore(widgets); + gtk_main_quit(); break; default: { diff --git a/source/ubinstall-gtk-saving.c b/source/ubinstall-gtk-saving.c index bd462c0..5f1d6c7 100644 --- a/source/ubinstall-gtk-saving.c +++ b/source/ubinstall-gtk-saving.c @@ -93,7 +93,6 @@ void on_config_global_save(GtkWidget *,main_window *widgets){ gboolean on_install_success(main_window *widgets){ gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),""); - yon_config_restore(widgets); on_page_next_clicked(NULL,widgets); return 0; diff --git a/source/ubinstall-gtk-users.c b/source/ubinstall-gtk-users.c index e899e3c..00f419b 100644 --- a/source/ubinstall-gtk-users.c +++ b/source/ubinstall-gtk-users.c @@ -76,6 +76,7 @@ int yon_user_save(yon_user_struct *user){ void on_user_add(GtkWidget *,main_window *widgets){ yon_user_struct *user = yon_user_struct_new(); + g_object_set_data(G_OBJECT(user->MainBox),"widgets",widgets); gtk_box_pack_start(GTK_BOX(widgets->UserAddBox),user->MainBox,0,0,0); } @@ -96,6 +97,20 @@ void yon_password_new(GtkWidget *, yon_user_struct *user){ yon_password_hash_list_set(window,NULL,NULL,0); } +void yon_user_admin_check(GtkWidget *, yon_user_struct *user){ + main_window *widgets = g_object_get_data(G_OBJECT(user->MainBox),"widgets"); + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->UserAddBox)); + GList *iter; + for(iter=list;iter;iter=iter->next){ + if (iter->data!=user->MainBox){ + yon_user_struct *cur_user = g_object_get_data(G_OBJECT(iter->data),"yon_user_struct"); + g_signal_handlers_block_by_func(G_OBJECT(cur_user->AdminCheck),G_CALLBACK(yon_user_admin_check),cur_user); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cur_user->AdminCheck),0); + g_signal_handlers_unblock_by_func(G_OBJECT(cur_user->AdminCheck),G_CALLBACK(yon_user_admin_check),cur_user); + } + } +} + yon_user_struct *yon_user_struct_new(){ yon_user_struct *user = new(yon_user_struct); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_user); @@ -107,6 +122,7 @@ yon_user_struct *yon_user_struct_new(){ user->PasswordCombo = yon_gtk_builder_get_widget(builder,"PasswordCombo"); user->PasswordEntry = yon_gtk_builder_get_widget(builder,"PasswordEntry"); user->PasswordButton = yon_gtk_builder_get_widget(builder,"PasswordButton"); + user->AdminCheck = yon_gtk_builder_get_widget(builder,"AdminCheck"); yon_gtk_entry_block_symbols(GTK_ENTRY(user->LoginEntry),"[]'\"=:\n"); yon_gtk_entry_block_symbols(GTK_ENTRY(user->UsernameEntry),"[]'\":\n"); @@ -117,6 +133,7 @@ yon_user_struct *yon_user_struct_new(){ g_signal_connect(G_OBJECT(user->PasswordCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),user->PasswordEntry); g_signal_connect(G_OBJECT(user->PasswordCombo),"changed",G_CALLBACK(yon_gtk_widget_set_sensitive_from_combo_box),user->PasswordButton); g_signal_connect(G_OBJECT(user->PasswordButton),"clicked",G_CALLBACK(yon_password_new),user); + g_signal_connect(G_OBJECT(user->AdminCheck),"clicked",G_CALLBACK(yon_user_admin_check),user); g_signal_connect(G_OBJECT(user->RemoveButton),"clicked",G_CALLBACK(on_user_remove_clicked),user); return user; } @@ -128,7 +145,7 @@ void yon_user_init(main_window *widgets){ yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(widgets->UserRootPasswordEntry)); char *root_password = config(root_password_parameter); char *autologin = config(autologin_parameter); - if (!yon_char_is_empty(root_password)){ + if (!yon_char_is_empty(root_password)&&!yon_config_check_default(root_password_parameter)){ gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),1); gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),root_password); } else { @@ -152,12 +169,14 @@ void yon_user_init(main_window *widgets){ config_str users = yon_config_get_all_by_key(USERADD_parameter_search,&users_size); if (!users_size){ yon_user_struct *user = yon_user_struct_new(); + g_object_set_data(G_OBJECT(user->MainBox),"widgets",widgets); gtk_box_pack_start(GTK_BOX(widgets->UserAddBox),user->MainBox,0,0,0); gtk_entry_set_text(GTK_ENTRY(user->UsernameEntry),ADMINISTRATOR_LABEL); gtk_entry_set_text(GTK_ENTRY(user->LoginEntry),"superadmin"); } for (int i=0;iMainBox),"widgets",widgets); gtk_box_pack_start(GTK_BOX(widgets->UserAddBox),user->MainBox,0,0,0); int parsed_size; diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 217e898..8c4d573 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -234,6 +234,7 @@ void on_reboot_accepted(main_window *widgets){ g_mutex_unlock(&main_config.install_mutex); } main_config.exit_accepted=1; + yon_config_restore(widgets); while(gtk_events_pending()) gtk_main_iteration(); if (system("reboot")){}; @@ -242,12 +243,13 @@ void on_reboot_accepted(main_window *widgets){ } } -void on_exit_accepted(main_window *){ +void on_exit_accepted(main_window *widgets){ g_mutex_lock(&main_config.install_mutex); if (main_config.install_thread){ pthread_cancel((pthread_t)main_config.install_thread); g_mutex_unlock(&main_config.install_mutex); } + yon_config_restore(widgets); main_config.exit_accepted=1; while(gtk_events_pending()) gtk_main_iteration(); } @@ -265,6 +267,7 @@ gboolean on_yon_exit(GtkWidget *,GdkEvent*, main_window *widgets){ return 1; } } else { + yon_config_restore(widgets); on_exit_accepted(widgets); gtk_main_quit(); } diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 7f72aaf..5f2bcc8 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -291,7 +291,7 @@ layout && /description:/ {\ #define config_get_command(target) yon_char_unite("ubconfig -ea --conarg --source ", target, " get [autoinstall] AUTOINSTALL[*] -- get [locale] LANG", NULL) -#define config_get_default_command "ubconfig -ea --conarg --source default get [autoinstall] AUTOINSTALL[*] -- get [locale] LANG" +#define config_get_default_command "ubconfig -ea --noconarg --source default get [autoinstall] AUTOINSTALL[*] -- get [locale] LANG" #define config_get_global_only_parameters "" #define config_get_local_only_parameters "" @@ -923,6 +923,7 @@ typedef struct GtkWidget *PasswordCombo; GtkWidget *PasswordEntry; GtkWidget *PasswordButton; + GtkWidget *AdminCheck; } yon_user_struct; typedef struct @@ -1558,4 +1559,5 @@ void yon_advanced_part_clean_config(); void yon_advanced_part_to_data(advanced_part_widgets *part, advanced_part_data *data); void yon_advanced_part_save_part(advanced_part_data *data); void yon_advanced_part_remove_for_part(const char *part_name, main_window *widgets); -int yon_software_check_packages_size(GtkWidget *, main_window *widgets); \ No newline at end of file +int yon_software_check_packages_size(GtkWidget *, main_window *widgets); +void yon_user_admin_check(GtkWidget *self, yon_user_struct *user); \ No newline at end of file diff --git a/ubinstall-gtk-user.glade b/ubinstall-gtk-user.glade index a8ddf45..5e3ebba 100644 --- a/ubinstall-gtk-user.glade +++ b/ubinstall-gtk-user.glade @@ -117,6 +117,20 @@ 1 + + + Administrator + True + True + False + True + + + False + True + 2 + + False