[gnome-initial-setup/wip/154-account-fix-criticals-enterprise-login: 1/3] account: Fix entry validation in enterprise login dialog




commit ad548a4731512e1aa3daf2de83fd8d1d1ac7a5bb
Author: Kalev Lember <klember redhat com>
Date:   Thu Sep 15 11:58:06 2022 +0200

    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.

 .../pages/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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]