[gnome-software/wip/rancell/reviews] Fix minor usability issues with login dialog



commit 2e2538b8d5188ecca52974ad845efe6bffed25cf
Author: William Hua <william hua canonical com>
Date:   Fri Mar 18 12:21:26 2016 -0400

    Fix minor usability issues with login dialog

 src/plugins/gs-ubuntu-login-dialog.c  |   11 +++++++++++
 src/plugins/gs-ubuntu-login-dialog.ui |    3 +++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-ubuntu-login-dialog.c b/src/plugins/gs-ubuntu-login-dialog.c
index 6b66882..964e469 100644
--- a/src/plugins/gs-ubuntu-login-dialog.c
+++ b/src/plugins/gs-ubuntu-login-dialog.c
@@ -217,6 +217,7 @@ receive_login_response_cb (GsUbuntuLoginDialog *self,
 
                if (g_str_equal (code, "TWOFACTOR_REQUIRED")) {
                        gtk_stack_set_visible_child_name (GTK_STACK (self->page_stack), "page-1");
+                       gtk_widget_grab_focus (self->passcode_entry);
                        update_widgets (self);
                        break;
                }
@@ -235,20 +236,28 @@ receive_login_response_cb (GsUbuntuLoginDialog *self,
 
                if (g_str_equal (code, "INVALID_CREDENTIALS")) {
                        gtk_label_set_text (GTK_LABEL (self->status_label), _("Incorrect email or password"));
+                       gtk_widget_grab_focus (self->password_entry);
                } else if (g_str_equal (code, "ACCOUNT_SUSPENDED")) {
                        gtk_label_set_text (GTK_LABEL (self->status_label), _("Account suspended"));
+                       gtk_widget_grab_focus (self->email_entry);
                } else if (g_str_equal (code, "ACCOUNT_DEACTIVATED")) {
                        gtk_label_set_text (GTK_LABEL (self->status_label), _("Account deactivated"));
+                       gtk_widget_grab_focus (self->email_entry);
                } else if (g_str_equal (code, "EMAIL_INVALIDATED")) {
                        gtk_label_set_text (GTK_LABEL (self->status_label), _("Email invalidated"));
+                       gtk_widget_grab_focus (self->email_entry);
                } else if (g_str_equal (code, "TWOFACTOR_FAILURE")) {
                        gtk_label_set_text (GTK_LABEL (self->status_label), _("Two-factor authentication 
failed"));
+                       gtk_widget_grab_focus (self->passcode_entry);
                } else if (g_str_equal (code, "PASSWORD_POLICY_ERROR")) {
                        gtk_label_set_text (GTK_LABEL (self->status_label), _("Password reset required"));
+                       gtk_widget_grab_focus (self->reset_radio);
                } else if (g_str_equal (code, "TOO_MANY_REQUESTS")) {
                        gtk_label_set_text (GTK_LABEL (self->status_label), _("Too many requests"));
+                       gtk_widget_grab_focus (self->password_entry);
                } else {
                        gtk_label_set_text (GTK_LABEL (self->status_label), _("An error occurred"));
+                       gtk_widget_grab_focus (self->password_entry);
                }
 
                break;
@@ -356,6 +365,8 @@ gs_ubuntu_login_dialog_init (GsUbuntuLoginDialog *self)
 {
        gtk_widget_init_template (GTK_WIDGET (self));
 
+       gtk_window_set_default (GTK_WINDOW (self), self->next_button);
+
        g_signal_connect_swapped (self->next_button, "clicked", G_CALLBACK (next_button_clicked_cb), self);
        g_signal_connect_swapped (self->login_radio, "toggled", G_CALLBACK (radio_button_toggled_cb), self);
        g_signal_connect_swapped (self->register_radio, "toggled", G_CALLBACK (radio_button_toggled_cb), 
self);
diff --git a/src/plugins/gs-ubuntu-login-dialog.ui b/src/plugins/gs-ubuntu-login-dialog.ui
index 5409c90..e729f2e 100644
--- a/src/plugins/gs-ubuntu-login-dialog.ui
+++ b/src/plugins/gs-ubuntu-login-dialog.ui
@@ -26,6 +26,7 @@
             <property name="label" translatable="yes">_Continue</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="can_default">True</property>
             <property name="receives_default">True</property>
             <property name="use_underline">True</property>
             <style>
@@ -161,6 +162,7 @@
                         <property name="visibility">False</property>
                         <property name="invisible_char">•</property>
                         <property name="input_purpose">password</property>
+                        <property name="activates_default">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
@@ -263,6 +265,7 @@
                         <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
                         <property name="input_purpose">pin</property>
+                        <property name="activates_default">True</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>


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