diff --git a/locale/ubinstall-gtk.pot b/locale/ubinstall-gtk.pot index 34a5dfa..07fa82d 100644 --- a/locale/ubinstall-gtk.pot +++ b/locale/ubinstall-gtk.pot @@ -1087,7 +1087,7 @@ msgstr "" #: source/ubl-strings.h:308 msgid "Edit application" -msgstr "Редактировать приложение" +msgstr "" #: source/ubl-strings.h:308 msgid "You are about to delete bootloader user" diff --git a/source/ubinstall-gtk-users.c b/source/ubinstall-gtk-users.c index a2e6d09..35c912d 100644 --- a/source/ubinstall-gtk-users.c +++ b/source/ubinstall-gtk-users.c @@ -40,7 +40,7 @@ int yon_users_save(main_window *widgets){ } } } - yon_config_remove_by_args(DEFAULTUSER_parameter,NULL); + yon_config_remove_by_key(DEFAULTUSER_parameter); } if (!main_config.configure_mode){ @@ -176,11 +176,7 @@ yon_user_struct *yon_user_struct_new(){ } void yon_user_init(main_window *widgets){ - char *default_passwd = config(DEFAULTPASSWD_parameter); - if (yon_char_is_empty(default_passwd)){ - default_passwd = config(DEFAULTPASSWD_system_parameter); - } if (!main_config.configure_mode){ int size = 0; config_str users = yon_config_get_all_by_key(USERADD_parameter_search,&size); @@ -192,7 +188,7 @@ void yon_user_init(main_window *widgets){ } } yon_config_remove_by_list(users,size); - yon_config_update_by_args(main_config.config_load_path, autologin_parameter,root_password_parameter,NULL); + yon_config_update_by_args(main_config.config_load_path, autologin_parameter,DEFAULTPASSWD_parameter,root_password_parameter,DEFAULTPASSWD_system_parameter,DEFAULTROOTPASSWD_system_parameter,NULL); config_str parameters = yon_config_load(config_get_command(main_config.config_load_path),&size); for (int i=0;iUserRootPasswordCombo)); gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->UserRootPasswordCombo),NULL,DEFAULT_LABEL); gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->UserRootPasswordCombo),NULL,SET_PASSWORD_LABEL); - char *root_password = config(root_password_parameter); - // if (yon_char_is_empty(root_password)){ - // root_password = config(DEFAULTROOTPASSWD_system_parameter); - // } char *autologin = config(autologin_parameter); - if (!yon_char_is_empty(root_password)&&strcmp(root_password,config(DEFAULTROOTPASSWD_system_parameter))){ - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),1); - gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),root_password); - } else { - gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),0); - gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->UserRootPasswordEntry),root_password); - - } + char *default_passwd = yon_config_get_by_key(DEFAULTPASSWD_parameter); + char *root_password = yon_config_get_by_key(root_password_parameter); if (!yon_char_is_empty(autologin)&&(!strcmp(autologin,"yes")||!strcmp(autologin,"enable"))){ gtk_switch_set_active(GTK_SWITCH(widgets->UserAutologinSwitch),1); } else { @@ -255,12 +241,12 @@ void yon_user_init(main_window *widgets){ gtk_entry_set_text(GTK_ENTRY(user->LoginEntry),"superadmin"); } user->changed=1; - if (!yon_char_is_empty(default_passwd)&&strcmp(default_passwd,config(DEFAULTPASSWD_system_parameter))){ - gtk_entry_set_text(GTK_ENTRY(user->PasswordEntry),default_passwd); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user->AdminCheck),1); - } else { + if (yon_char_is_empty(default_passwd)){ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user->AdminCheck),0); - gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->UserRootPasswordEntry),default_passwd); + gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->UserRootPasswordEntry),yon_config_default_get_by_key(DEFAULTPASSWD_parameter)); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(user->AdminCheck),1); + gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),config(DEFAULTPASSWD_system_parameter)); } } } @@ -300,4 +286,13 @@ void yon_user_init(main_window *widgets){ } gtk_widget_show(user->MainBox); } + + if (yon_char_is_empty(root_password)){ + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),0); + gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->UserRootPasswordEntry),yon_config_default_get_by_key(root_password_parameter)); + } else { + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->UserRootPasswordCombo),1); + gtk_entry_set_text(GTK_ENTRY(widgets->UserRootPasswordEntry),config(DEFAULTROOTPASSWD_system_parameter)); + + } } \ No newline at end of file