diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index 0a14d11..f530cb6 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1812,7 +1812,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){ month=yon_char_append("0",month); } char *day = yon_char_from_int(tm.tm_mday); - if (strlen(day)==1){ + if (strlen(day)<2){ day=yon_char_append("0",day); } password_changed_date = yon_char_unite(yon_char_from_int(1900+tm.tm_year),"-",month,"-",day,NULL); @@ -1865,7 +1865,7 @@ void on_user_save(GtkWidget *self, dictionary *dict){ password_expiration_date = (char*)gtk_entry_get_text(GTK_ENTRY(window->userPasswordExpirationEntry)); if (yon_char_is_empty(password_expiration_date)){ - password_expiration_date=""; + password_expiration_date="-1"; } long warning_days_active = gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->userWarningSpin)); @@ -2073,9 +2073,9 @@ void on_date_selected(GtkWidget *self, ubl_settings_usergroups_user_window *wind char *dy = yon_char_from_int(day); char *mn = yon_char_from_int(month+1); char *yr = yon_char_from_int(year); - if (tm.tm_mon+1<10) mn = yon_char_append("0",mn); - if (tm.tm_mday<10) dy = yon_char_append("0",dy); - char *date_string = yon_char_unite(yr,"-",mn,"-",dy); + if (month+1<10) mn = yon_char_append("0",mn); + if (day<10) dy = yon_char_append("0",dy); + char *date_string = yon_char_unite(yr,"-",mn,"-",dy,NULL); gtk_entry_set_text(GTK_ENTRY(window->userPasswordExpirationEntry), date_string); window->expiration_unix=date_string; free(dy); @@ -2160,6 +2160,12 @@ void on_parameter_changed(GtkWidget *self,ubl_settings_usergroups_user_window *w free(final_string); } +void on_remove_expired(GtkWidget *self, GtkEntryIconPosition icon_pos, GdkEvent *event, GtkEntry *target){ + if (icon_pos == GTK_ENTRY_ICON_SECONDARY){ + gtk_entry_set_text(target,""); + } +} + ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){ ubl_settings_usergroups_user_window *window = malloc(sizeof(ubl_settings_usergroups_user_window)); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_user); @@ -2275,6 +2281,7 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){ g_signal_connect(G_OBJECT(window->userDontCheckCheck),"toggled",G_CALLBACK(on_parameter_changed),window); g_signal_connect(G_OBJECT(window->userGroupsCheck),"toggled",G_CALLBACK(on_parameter_changed),window); g_signal_connect(G_OBJECT(window->userGroupsEntry),"changed",G_CALLBACK(on_parameter_changed),window); + g_signal_connect(G_OBJECT(window->userPasswordExpirationEntry),"icon-press",G_CALLBACK(on_remove_expired),window->userPasswordExpirationEntry); return window; } @@ -2417,7 +2424,7 @@ void on_main_edit(GtkWidget *self, main_window *widgets){ } free(parameters); parameters=yon_char_parse(yon_config_get_by_key(USERSHADOW(name)),&parsed_size,":"); - if (!strcmp(parameters[0],"0")) + if (parameters&&!strcmp(parameters[0],"0")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->userForceChangeCheck),1); else gtk_entry_set_text(GTK_ENTRY(window->userPasswordChangedEntry),parsed_size>0?parameters[0]:""); diff --git a/ubl-settings-usergroups-user.glade b/ubl-settings-usergroups-user.glade index cbdac8a..7320fe6 100644 --- a/ubl-settings-usergroups-user.glade +++ b/ubl-settings-usergroups-user.glade @@ -881,8 +881,8 @@ True - False - True + False + com.ublinux.ubl-settings-usergroups.trash-symbolic False