diff options
author | Will Thompson <will@willthompson.co.uk> | 2022-09-22 11:42:24 +0100 |
---|---|---|
committer | Will Thompson <will@willthompson.co.uk> | 2022-09-22 11:47:54 +0100 |
commit | 31e1aafb20da15d4c9d999809ee2e895e560681a (patch) | |
tree | 1b00a67bf93e66ee47d151defdf34746f7eed460 | |
parent | 37e5aef25f120464e55b84e3ed025627ebb7f5ae (diff) | |
download | gnome-initial-setup-31e1aafb20da15d4c9d999809ee2e895e560681a.tar.gz |
account: Set enterprise password errors as tooltip
In GNOME 42 and earlier, this error message was used as the tooltip for
an error icon in the entry. Since the GTK 4 port, the password widget is
now a GtkPasswordEntry, which does not support adding an inline icon in
this way.
e495fb58 ("account: Fix criticals when validating domain in enterprise
login dialog") stopped attempting to add an icon using the GtkEntry
functions which don't work on GtkPasswordEntry, making this page
work without warnings/criticals once again, but in the process the error
message would not be shown anywhere.
Set the error message (from realmd or the server, I'm not sure!) as the
tooltip for the entire entry, so that it is at least accessible. Clear
it when clearing the error state.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-initial-setup/-/merge_requests/161>
-rw-r--r-- | gnome-initial-setup/pages/account/gis-account-page-enterprise.c | 9 |
1 files changed, 6 insertions, 3 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 8fdc318..39976da 100644 --- a/gnome-initial-setup/pages/account/gis-account-page-enterprise.c +++ b/gnome-initial-setup/pages/account/gis-account-page-enterprise.c @@ -92,12 +92,15 @@ static void clear_password_validation_error (GtkWidget *entry) { gtk_widget_remove_css_class (entry, "error"); + gtk_widget_set_tooltip_text (entry, NULL); } static void -set_password_validation_error (GtkWidget *entry) +set_password_validation_error (GtkWidget *entry, + const gchar *text) { gtk_widget_add_css_class (entry, "error"); + gtk_widget_set_tooltip_text (entry, text); } static void @@ -342,7 +345,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_password_validation_error (page->join_password); + set_password_validation_error (page->join_password, error->message); } else { g_debug ("Admin login failure: %s", error->message); @@ -480,7 +483,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_password_validation_error (page->password); + set_password_validation_error (page->password, error->message); gtk_widget_grab_focus (page->password); apply_complete (page, FALSE); |