[gnome-initial-setup/wip/154-account-enterprise-password-error-tooltip] account: Set enterprise password errors as tooltip
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/wip/154-account-enterprise-password-error-tooltip] account: Set enterprise password errors as tooltip
- Date: Thu, 22 Sep 2022 10:48:04 +0000 (UTC)
commit de1e73a34fb0f05f9ea62e69dae3854dbff2a55d
Author: Will Thompson <will willthompson co uk>
Date: Thu Sep 22 11:42:24 2022 +0100
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.
gnome-initial-setup/pages/account/gis-account-page-enterprise.c | 9 ++++++---
1 file 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 8fdc3188..39976da5 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]