Password combo boxes fixes and reorder

pull/247/head
parent adf3b045a4
commit 0ed982a469

@ -35,9 +35,9 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add
} }
char *default_password = NULL; char *default_password = NULL;
int user_password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->DefaultPasswordCombo)); int user_password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->DefaultPasswordCombo));
if (user_password_active==2) if (user_password_active==1)
default_password=(char*)gtk_entry_get_text(GTK_ENTRY(window->DefaultPasswordEntry)); default_password=(char*)gtk_entry_get_text(GTK_ENTRY(window->DefaultPasswordEntry));
else if (user_password_active==1) else if (user_password_active==2)
default_password=" "; default_password=" ";
else if (user_password_active==3){ else if (user_password_active==3){
default_password="!*"; default_password="!*";
@ -51,9 +51,9 @@ void on_additional_settings_changed(GtkWidget *self, ubl_settings_usergroups_add
} }
char *root_password = NULL; char *root_password = NULL;
int root_password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RootPasswordCombo)); int root_password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->RootPasswordCombo));
if (root_password_active==2) if (root_password_active==1)
root_password=(char*)gtk_entry_get_text(GTK_ENTRY(window->RootPasswordCombo)); root_password=(char*)gtk_entry_get_text(GTK_ENTRY(window->RootPasswordCombo));
else if (root_password_active==1) else if (root_password_active==2)
root_password=" "; root_password=" ";
if (!yon_char_is_empty(root_password)){ if (!yon_char_is_empty(root_password)){
if (window->default_root_password) if (window->default_root_password)
@ -674,21 +674,21 @@ ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_
char *default_password = yon_config_get_by_key(DEFAULTPASSWD_parameter); char *default_password = yon_config_get_by_key(DEFAULTPASSWD_parameter);
if (!yon_char_is_empty(default_password)){ if (!yon_char_is_empty(default_password)){
if (!strcmp(default_password," ")){ if (!strcmp(default_password," ")){
gtk_combo_box_set_active(GTK_COMBO_BOX(window->DefaultPasswordCombo),1); gtk_combo_box_set_active(GTK_COMBO_BOX(window->DefaultPasswordCombo),2);
} else if (!strcmp(default_password,"!*")){ } else if (!strcmp(default_password,"!*")){
gtk_combo_box_set_active(GTK_COMBO_BOX(window->DefaultPasswordCombo),3); gtk_combo_box_set_active(GTK_COMBO_BOX(window->DefaultPasswordCombo),3);
} else { } else {
gtk_combo_box_set_active(GTK_COMBO_BOX(window->DefaultPasswordCombo),2); gtk_combo_box_set_active(GTK_COMBO_BOX(window->DefaultPasswordCombo),1);
gtk_entry_set_text(GTK_ENTRY(window->DefaultPasswordEntry),default_password); gtk_entry_set_text(GTK_ENTRY(window->DefaultPasswordEntry),default_password);
} }
} }
char *root_password = yon_config_get_by_key(DEFAULTROOTPASSWD_parameter); char *root_password = yon_config_get_by_key(DEFAULTROOTPASSWD_parameter);
if (!yon_char_is_empty(root_password)){ if (!yon_char_is_empty(root_password)){
if (!strcmp(root_password," ")){ if (!strcmp(root_password," ")){
gtk_combo_box_set_active(GTK_COMBO_BOX(window->RootPasswordCombo),1);
} else {
gtk_combo_box_set_active(GTK_COMBO_BOX(window->RootPasswordCombo),2); gtk_combo_box_set_active(GTK_COMBO_BOX(window->RootPasswordCombo),2);
} else {
gtk_combo_box_set_active(GTK_COMBO_BOX(window->RootPasswordCombo),1);
gtk_entry_set_text(GTK_ENTRY(window->DefaultPasswordEntry),root_password); gtk_entry_set_text(GTK_ENTRY(window->DefaultPasswordEntry),root_password);
} }
} }

@ -394,9 +394,9 @@ void on_user_save(GtkWidget *self, dictionary *dict){
int password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userPasswordCombo)); int password_active = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userPasswordCombo));
if (password_active == 0){ if (password_active == 0){
password = ""; password = "";
} else if (password_active ==1){ } else if (password_active ==5){
password = " "; password = " ";
} else if (password_active ==2){ } else if (password_active ==1){
password = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)); password = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry));
if (yon_char_is_empty(password)){ if (yon_char_is_empty(password)){
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
@ -404,15 +404,15 @@ void on_user_save(GtkWidget *self, dictionary *dict){
gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0); gtk_notebook_set_current_page(GTK_NOTEBOOK(window->MainNotebook),0);
return; return;
} }
} else if (password_active==3){ } else if (password_active==2){
password = "!*"; password = "!*";
} else if (password_active ==4){ } else if (password_active ==3){
password = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)); password = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry));
if (password[0]!='!') { if (password[0]!='!') {
char *temp = yon_char_append("!",password); char *temp = yon_char_append("!",password);
password=temp; password=temp;
} }
} else if (password_active == 5){ } else if (password_active == 4){
password = yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry))); password = yon_char_new((char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)));
if (yon_char_is_empty(password)){ if (yon_char_is_empty(password)){
yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);

@ -841,13 +841,13 @@ void on_password_combo_changed(GtkComboBox *self, GtkWidget *target){
int active = gtk_combo_box_get_active(self); int active = gtk_combo_box_get_active(self);
switch(active){ switch(active){
case 0: case 0:
case 1: case 2:
case 3: case 3:
case 4: case 5:
gtk_widget_set_sensitive(target,0); gtk_widget_set_sensitive(target,0);
break; break;
case 2: case 1:
case 5: case 4:
gtk_widget_set_sensitive(target,1); gtk_widget_set_sensitive(target,1);
break; break;
} }
@ -1399,7 +1399,7 @@ void on_toggle_button_set_active_from_combo_box(GtkComboBox *self,ubl_settings_u
void on_toggle_button_set_active_from_toggle_button_inversed(GtkToggleButton *, ubl_settings_usergroups_user_window *window){ void on_toggle_button_set_active_from_toggle_button_inversed(GtkToggleButton *, ubl_settings_usergroups_user_window *window){
char *passw = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)); char *passw = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry));
if ((passw[0]!='$')&&gtk_combo_box_get_active(GTK_COMBO_BOX(window->userPasswordCombo))>1){ if ((passw[0]!='$')&&gtk_combo_box_get_active(GTK_COMBO_BOX(window->userPasswordCombo))==1){
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck))){ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck))){
gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBAPasswordCheck),0); gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBAPasswordCheck),0);
} else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck))){ } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck))){
@ -1590,18 +1590,18 @@ void on_main_edit(GtkWidget *, main_window *widgets){
g_signal_handlers_block_by_func(G_OBJECT(window->userSyncSAMBACheck),G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userSyncSAMBAPasswordCheck); g_signal_handlers_block_by_func(G_OBJECT(window->userSyncSAMBACheck),G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userSyncSAMBAPasswordCheck);
} }
if (!strcmp(parameters[5],"!*")){ if (!strcmp(parameters[5],"!*")){
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),3); gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),2);
} else if (!strcmp(parameters[5]," ")) { } else if (!strcmp(parameters[5]," ")) {
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),1); gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),5);
} else if (parameters[5][0]=='!'){ } else if (parameters[5][0]=='!'){
char *password_or = yon_char_new(parameters[5]); char *password_or = yon_char_new(parameters[5]);
free(yon_char_divide(password_or,0)); free(yon_char_divide(password_or,0));
gtk_entry_set_text(GTK_ENTRY(window->userPasswordEntry),password_or); gtk_entry_set_text(GTK_ENTRY(window->userPasswordEntry),password_or);
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),4); gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),3);
free(password_or); free(password_or);
} else { } else {
gtk_entry_set_text(GTK_ENTRY(window->userPasswordEntry),parameters[5]); gtk_entry_set_text(GTK_ENTRY(window->userPasswordEntry),parameters[5]);
gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),2); gtk_combo_box_set_active(GTK_COMBO_BOX(window->userPasswordCombo),1);
} }
} }
} }

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 --> <!-- Generated with glade 3.38.2 -->
<interface domain="ubl-settings-usergroups"> <interface domain="ubl-settings-usergroups">
<requires lib="gtk+" version="3.24"/> <requires lib="gtk+" version="3.24"/>
<!-- interface-css-provider-path ubl-settings-usergroups.css --> <!-- interface-css-provider-path ubl-settings-usergroups.css -->
@ -76,8 +76,8 @@
<row> <row>
<col id="0">False</col> <col id="0">False</col>
<col id="1" translatable="yes">Group GID range</col> <col id="1" translatable="yes">Group GID range</col>
<col id="2" translatable="yes"></col> <col id="2" translatable="yes"/>
<col id="3" translatable="yes"></col> <col id="3" translatable="yes"/>
<col id="4">True</col> <col id="4">True</col>
<col id="5">True</col> <col id="5">True</col>
<col id="6">False</col> <col id="6">False</col>
@ -90,8 +90,8 @@
<row> <row>
<col id="0">False</col> <col id="0">False</col>
<col id="1" translatable="yes">Group GID in system</col> <col id="1" translatable="yes">Group GID in system</col>
<col id="2" translatable="yes"></col> <col id="2" translatable="yes"/>
<col id="3" translatable="yes"></col> <col id="3" translatable="yes"/>
<col id="4">True</col> <col id="4">True</col>
<col id="5">True</col> <col id="5">True</col>
<col id="6">False</col> <col id="6">False</col>
@ -176,8 +176,8 @@
<row> <row>
<col id="0">False</col> <col id="0">False</col>
<col id="1" translatable="yes">Users UID range</col> <col id="1" translatable="yes">Users UID range</col>
<col id="2" translatable="yes"></col> <col id="2" translatable="yes"/>
<col id="3" translatable="yes"></col> <col id="3" translatable="yes"/>
<col id="4">True</col> <col id="4">True</col>
<col id="5">True</col> <col id="5">True</col>
<col id="6">False</col> <col id="6">False</col>
@ -190,8 +190,8 @@
<row> <row>
<col id="0">False</col> <col id="0">False</col>
<col id="1" translatable="yes">User UID in system</col> <col id="1" translatable="yes">User UID in system</col>
<col id="2" translatable="yes"></col> <col id="2" translatable="yes"/>
<col id="3" translatable="yes"></col> <col id="3" translatable="yes"/>
<col id="4">True</col> <col id="4">True</col>
<col id="5">True</col> <col id="5">True</col>
<col id="6">False</col> <col id="6">False</col>
@ -383,8 +383,9 @@
<property name="active">0</property> <property name="active">0</property>
<items> <items>
<item translatable="yes">Default</item> <item translatable="yes">Default</item>
<item translatable="yes">No password required</item>
<item translatable="yes">Set a password</item> <item translatable="yes">Set a password</item>
<item translatable="yes">No password required</item>
<item translatable="yes">Deny login</item>
</items> </items>
</object> </object>
<packing> <packing>
@ -459,9 +460,8 @@
<property name="active">0</property> <property name="active">0</property>
<items> <items>
<item translatable="yes">Default</item> <item translatable="yes">Default</item>
<item translatable="yes">No password required</item>
<item translatable="yes">Set a password</item> <item translatable="yes">Set a password</item>
<item translatable="yes">Deny login</item> <item translatable="yes">No password required</item>
</items> </items>
</object> </object>
<packing> <packing>

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 --> <!-- Generated with glade 3.38.2 -->
<interface domain="ubl-settings-usergroups"> <interface domain="ubl-settings-usergroups">
<requires lib="gtk+" version="3.24"/> <requires lib="gtk+" version="3.24"/>
<!-- interface-css-provider-path ubl-settings-usergroups.css --> <!-- interface-css-provider-path ubl-settings-usergroups.css -->
@ -235,11 +235,11 @@
<property name="active">0</property> <property name="active">0</property>
<items> <items>
<item translatable="yes">Default</item> <item translatable="yes">Default</item>
<item translatable="yes">No password required</item>
<item translatable="yes">Set a password</item> <item translatable="yes">Set a password</item>
<item translatable="yes">Deny login</item> <item translatable="yes">Deny login</item>
<item translatable="yes">Block login with password</item> <item translatable="yes">Block login with password</item>
<item translatable="yes">Unblock login with password</item> <item translatable="yes">Unblock login with password</item>
<item translatable="yes">No password required</item>
</items> </items>
</object> </object>
<packing> <packing>

Loading…
Cancel
Save