diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 7847db4..603444b 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -103,8 +103,6 @@ if (main_config.sync_users){ int size; config_str parsed = yon_char_parse(main_config.sync_users[i],&size,":"); if (!yon_char_is_empty(parsed[1])){ - if (parsed[1][0]==' '&&parsed[1][1]=='.'&&parsed[1][2]==' ') - free(parsed[1]=yon_char_divide(parsed[1],3)); if (system (samba_sync_password_command(parsed[0],parsed[1]))){}; } else { @@ -272,6 +270,7 @@ yon_confirmation_window *yon_delete_confirmation_new(){ void yon_delete_confirmation_open(main_window *widgets){ yon_confirmation_window *window = yon_delete_confirmation_new(); + gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window)); GtkTreeIter iter,itar; dictionary *dict = NULL; yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); @@ -442,11 +441,28 @@ void on_passwords_encrypt(){ } } -void on_password_change(GtkWidget *self, dictionary *entry_dict){ +void on_password_change(GtkWidget *self, dictionary *entry_dict){// GtkComboBox *combo = yon_dictionary_get_data(entry_dict->first,GtkComboBox*); GtkEntry *output_target = yon_dictionary_get_data(entry_dict->first->next,GtkEntry*); ubl_settings_usergroups_password_window *window = yon_ubl_settings_usergroups_password_new(); dictionary *dict = NULL; + char *password = (char*)gtk_entry_get_text(output_target); + if (!yon_char_is_empty(password)){ + password = yon_char_new(password); + if (main_config.load_mode==0){ + if (password[0]=='$'){ + gtk_entry_set_text(GTK_ENTRY(window->PasswordHashEntry),password); + } else { + if (password[0]=='%'&&password[1]=='%'){ + free(yon_char_divide(password,1)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck),1); + } + gtk_entry_set_text(GTK_ENTRY(window->PasswordEntry),password); + } + } else { + gtk_entry_set_text(GTK_ENTRY(window->PasswordHashEntry),password); + } + } yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window); yon_dictionary_add_or_create_if_exists_with_data(dict,"target",output_target); g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_password_accept),dict); @@ -934,10 +950,8 @@ void on_password_accept(GtkWidget *self, dictionary *dict){ if (!strcmp(password,password_check)){ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->NoEncriptionCheck))){ char *pasw=yon_char_append("%%",password); - free(password); password=pasw; } - password = yon_char_append(" . ",password); gtk_entry_set_text(GTK_ENTRY(entry),password); } else { yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"password_mismatch",PASSWORD_MISMATCH_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); @@ -1214,9 +1228,6 @@ void on_user_save(GtkWidget *self, dictionary *dict){ yon_ubl_status_highlight_incorrect(window->userPasswordEntry); return; } - if (password[0]==' '&&password[1]=='.'&&password[2]==' '){ - free(yon_char_divide(password,2)); - } } else { password="x"; } @@ -1403,7 +1414,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){ void on_toggle_button_set_active_from_combo_box(GtkComboBox *self,ubl_settings_usergroups_user_window *window){ char *passw = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)); - if (gtk_combo_box_get_active(self)<=1||(passw[0]!=' '&&passw[1]!='.'&&passw[2]!=' ')){ + if (gtk_combo_box_get_active(self)<=1||(passw[0]=='$')){ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck),0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck),0); gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBAPasswordCheck),0); @@ -1418,7 +1429,7 @@ void on_toggle_button_set_active_from_combo_box(GtkComboBox *self,ubl_settings_u void on_password_user_changed(GtkComboBox *self,ubl_settings_usergroups_user_window *window){ char *passw = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)); - if ((passw[0]!=' '&&passw[1]!='.'&&passw[2]!=' ')){ + if ((passw[0]=='$')){ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck),0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck),0); gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBAPasswordCheck),0); @@ -1433,7 +1444,7 @@ void on_password_user_changed(GtkComboBox *self,ubl_settings_usergroups_user_win void on_toggle_button_set_active_from_toggle_button_inversed(GtkToggleButton *self, ubl_settings_usergroups_user_window *window){ char *passw = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)); - if ((passw[0]==' '&&passw[1]=='.'&&passw[2]==' ')&>k_combo_box_get_active(GTK_COMBO_BOX(window->userPasswordCombo))>1){ + if ((passw[0]!='$')&>k_combo_box_get_active(GTK_COMBO_BOX(window->userPasswordCombo))>1){ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBACheck))){ gtk_widget_set_sensitive(GTK_WIDGET(window->userSyncSAMBAPasswordCheck),0); } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userSyncSAMBAPasswordCheck))){ @@ -1528,6 +1539,17 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){ yon_window_config_custom_window_setup(GTK_WINDOW(window->CreateUserWindow),"UserWindow"); yon_dictionary_add_or_create_if_exists_with_data(entry_dict,"combo",window->userPasswordCombo); yon_dictionary_add_or_create_if_exists_with_data(entry_dict,"entry",window->userPasswordEntry); + char *password = yon_config_get_by_key(USERADD((char*)gtk_entry_get_text(GTK_ENTRY(window->userLoginEntry)))); + // const char *passw = gtk_entry_get_text(GTK_ENTRY(window->userPasswordEntry)); + // if (yon_char_is_empty((char*)passw)){ + + // int size; + // config_str user = yon_char_parse(password,&size,":"); + // if (size>5&&!yon_char_is_empty(user[5])&&strcmp(user[5],"x")){ + // gtk_entry_set_text() + // } + // yon_char_parsed_free(user,size); + // } g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userUIDEntry); g_signal_connect(G_OBJECT(window->userHomeButton),"clicked",G_CALLBACK(on_filechooser_open),window->userHomeEntry); diff --git a/ubl-settings-usergroups.css b/ubl-settings-usergroups.css index afeb12d..ef9ec8c 100644 --- a/ubl-settings-usergroups.css +++ b/ubl-settings-usergroups.css @@ -1,4 +1,3 @@ - .thin { margin:0px; padding:0px; @@ -39,6 +38,10 @@ background:transparent; border-right-width:inherit; } +.menuitemmiddlemargin{ + margin-top: 6px; +} + .menuitemtop{ margin-bottom:0px; border-color:inherit; @@ -46,17 +49,17 @@ background:transparent; border-left-width:inherit; border-right-width:inherit; } - .menuitemtop>*{ - margin:2px 2px 0 2px; + .menuitemtop >*{ + margin:4px 2px 0 2px; padding: 3px 10px 3px 5px; border:transparent; } - .menuitemmiddle>*{ + .menuitemmiddle >*{ margin:0 2px 0 2px; padding: 3px 10px 3px 5px; border:transparent; } - .menuitembottom>*{ + .menuitembottom >*{ margin:0 2px 2px 2px; padding: 3px 10px 3px 5px; } @@ -82,13 +85,13 @@ background:transparent; } .menuitemtop:hover>* { - margin:2px 2px 0 2px; + margin:4px 2px 0 2px; padding: 3px 10px 3px 5px; background:@theme_selected_bg_color; border-radius:2px; } .menuitemmiddle:hover>* { - margin:0 2px 0px 2px; + margin:0 2px 0 2px; padding: 3px 10px 3px 5px; background:@theme_selected_bg_color; border-radius:2px;