From 70f3343835d6f125eaf47637d64e593409119b59 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Thu, 15 Sep 2022 11:58:06 +0200 Subject: [PATCH] account: Fix entry validation in enterprise login dialog Fix the password and domain validation to work again and not spew criticals after the gtk 4 port. Closes #154 --- .../account/gis-account-page-enterprise.c | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/gnome-initial-setup/pages/account/gis-account-page-enterprise.c b/gnome-initial-setup/pages/account/gis-account-page-enterprise.c index 7b119950..87a12bc8 100644 --- a/gnome-initial-setup/pages/account/gis-account-page-enterprise.c +++ b/gnome-initial-setup/pages/account/gis-account-page-enterprise.c @@ -88,6 +88,18 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; +static void +clear_password_validation_error (GtkWidget *entry) +{ + gtk_widget_remove_css_class (entry, "error"); +} + +static void +set_password_validation_error (GtkWidget *entry) +{ + gtk_widget_add_css_class (entry, "error"); +} + static void validation_changed (GisAccountPageEnterprise *page) { @@ -313,7 +325,7 @@ join_show_prompt (GisAccountPageEnterprise *page, gtk_editable_set_text (GTK_EDITABLE (page->join_computer), hostname); clear_entry_validation_error (GTK_ENTRY (page->join_name)); - clear_entry_validation_error (GTK_ENTRY (page->join_password)); + clear_password_validation_error (page->join_password); if (!page->join_prompted) { name = um_realm_kerberos_membership_get_suggested_administrator (membership); @@ -330,7 +342,7 @@ join_show_prompt (GisAccountPageEnterprise *page, } else if (g_error_matches (error, UM_REALM_ERROR, UM_REALM_ERROR_BAD_PASSWORD)) { g_debug ("Bad admin password: %s", error->message); - set_entry_validation_error (GTK_ENTRY (page->join_password), error->message); + set_password_validation_error (page->join_password); } else { g_debug ("Admin login failure: %s", error->message); @@ -468,7 +480,7 @@ on_realm_login (GObject *source, } else if (g_error_matches (error, UM_REALM_ERROR, UM_REALM_ERROR_BAD_PASSWORD)) { g_debug ("Problem with the user's password: %s", error->message); - set_entry_validation_error (GTK_ENTRY (page->password), error->message); + set_password_validation_error (page->password); gtk_widget_grab_focus (page->password); apply_complete (page, FALSE); @@ -718,7 +730,7 @@ on_domain_changed (GtkComboBox *widget, page->domain_chosen = TRUE; validation_changed (page); - clear_entry_validation_error (GTK_ENTRY (adw_bin_get_child (ADW_BIN (widget)))); + clear_entry_validation_error (GTK_ENTRY (gtk_combo_box_get_child (widget))); } static void -- GitLab