[gnome-control-center/wip/oholy/disable-verify-password-entry: 175/176] user-accounts: Validate password before moving focus
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/oholy/disable-verify-password-entry: 175/176] user-accounts: Validate password before moving focus
- Date: Tue, 10 Jul 2018 12:54:42 +0000 (UTC)
commit 088639b60cf558cb156f357aebbfbc3d897d1d0c
Author: Ondrej Holy <oholy redhat com>
Date: Wed Apr 11 10:01:20 2018 +0200
user-accounts: Validate password before moving focus
If <tab> is pressed and password is not yet validated (ie. the verify
entry is not sensitive), focus skips the verify entry, even if the
password is strong enough. Let's validate the password when <tab> is
pressed (ie. before focus change) to prevent this <tab> breakage...
https://gitlab.gnome.org/GNOME/gnome-control-center/issues/38
panels/user-accounts/um-account-dialog.c | 15 +++++++++++++++
panels/user-accounts/um-password-dialog.c | 15 +++++++++++++++
2 files changed, 30 insertions(+)
---
diff --git a/panels/user-accounts/um-account-dialog.c b/panels/user-accounts/um-account-dialog.c
index bdb950093..34d982664 100644
--- a/panels/user-accounts/um-account-dialog.c
+++ b/panels/user-accounts/um-account-dialog.c
@@ -514,6 +514,20 @@ on_password_focus_out (GtkEntry *entry,
return FALSE;
}
+static gboolean
+on_password_key_press_cb (GtkEntry *entry,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ UmAccountDialog *self = UM_ACCOUNT_DIALOG (user_data);
+ GdkEventKey *key = (GdkEventKey *)event;
+
+ if (key->keyval == GDK_KEY_Tab)
+ local_password_timeout (self);
+
+ return FALSE;
+}
+
static void
on_password_changed (GtkEntry *entry,
GParamSpec *pspec,
@@ -577,6 +591,7 @@ local_init (UmAccountDialog *self)
gtk_widget_set_sensitive (self->local_password, FALSE);
g_signal_connect (self->local_password, "notify::text", G_CALLBACK (on_password_changed), self);
g_signal_connect_after (self->local_password, "focus-out-event", G_CALLBACK (on_password_focus_out),
self);
+ g_signal_connect (self->local_password, "key-press-event", G_CALLBACK (on_password_key_press_cb),
self);
g_signal_connect_swapped (self->local_password, "activate", G_CALLBACK (dialog_validate), self);
g_signal_connect (self->local_password, "icon-press", G_CALLBACK (on_generate), self);
diff --git a/panels/user-accounts/um-password-dialog.c b/panels/user-accounts/um-password-dialog.c
index b3c8e8b54..97490a883 100644
--- a/panels/user-accounts/um-password-dialog.c
+++ b/panels/user-accounts/um-password-dialog.c
@@ -350,6 +350,19 @@ password_entry_focus_out (GtkWidget *entry,
return FALSE;
}
+static gboolean
+password_key_press (GtkEntry *entry,
+ GdkEvent *event,
+ UmPasswordDialog *um)
+{
+ GdkEventKey *key = (GdkEventKey *)event;
+
+ if (key->keyval == GDK_KEY_Tab)
+ password_entry_timeout (um);
+
+ return FALSE;
+}
+
static void
auth_cb (PasswdHandler *handler,
GError *error,
@@ -481,6 +494,8 @@ um_password_dialog_new (void)
G_CALLBACK (password_entry_changed), um);
g_signal_connect_after (widget, "focus-out-event",
G_CALLBACK (password_entry_focus_out), um);
+ g_signal_connect (widget, "key-press-event",
+ G_CALLBACK (password_key_press), um);
g_signal_connect_swapped (widget, "activate", G_CALLBACK (password_entry_timeout), um);
gtk_entry_set_visibility (GTK_ENTRY (widget), FALSE);
um->password_entry = widget;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]