[gnome-control-center] Fix a11y/keynav issues in the user account panel



commit 0725cffaee2b08e8369e1c5f099e67d0f7668dd1
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 15 20:10:57 2011 -0400

    Fix a11y/keynav issues in the user account panel
    
    Add missing mnemonics to a number of places. Also make
    the editable button/combo widgets react better to mnemonic
    activation.
    
    Part of bug 650132

 panels/user-accounts/data/account-fingerprint.ui  |    6 ++--
 panels/user-accounts/data/language-chooser.ui     |    6 +++-
 panels/user-accounts/data/user-accounts-dialog.ui |   20 ++++++++++++----
 panels/user-accounts/um-editable-button.c         |   26 +++++++++++++++++++++
 panels/user-accounts/um-editable-button.h         |    1 +
 panels/user-accounts/um-editable-combo.c          |   24 +++++++++++++++++++
 panels/user-accounts/um-editable-combo.h          |    1 +
 7 files changed, 74 insertions(+), 10 deletions(-)
---
diff --git a/panels/user-accounts/data/account-fingerprint.ui b/panels/user-accounts/data/account-fingerprint.ui
index 87e4a85..0c8a706 100644
--- a/panels/user-accounts/data/account-fingerprint.ui
+++ b/panels/user-accounts/data/account-fingerprint.ui
@@ -86,7 +86,7 @@
             <property name="orientation">vertical</property>
             <child>
               <object class="GtkRadioButton" id="radiobutton1">
-                <property name="label" translatable="yes">Right index finger</property>
+                <property name="label" translatable="yes">_Right index finger</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
@@ -102,7 +102,7 @@
             </child>
             <child>
               <object class="GtkRadioButton" id="radiobutton2">
-                <property name="label" translatable="yes">Left index finger</property>
+                <property name="label" translatable="yes">_Left index finger</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
@@ -123,7 +123,7 @@
                 <child>
                   <object class="GtkRadioButton" id="radiobutton3">
                     <property name="visible">True</property>
-                    <property name="label" translatable="yes">Other finger: </property>
+                    <property name="label" translatable="yes">_Other finger: </property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                     <property name="use_underline">True</property>
diff --git a/panels/user-accounts/data/language-chooser.ui b/panels/user-accounts/data/language-chooser.ui
index f533302..56ed8be 100644
--- a/panels/user-accounts/data/language-chooser.ui
+++ b/panels/user-accounts/data/language-chooser.ui
@@ -50,7 +50,8 @@
             <property name="layout_style">end</property>
             <child>
               <object class="GtkButton" id="cancel-button">
-                <property name="label" translatable="yes">Cancel</property>
+                <property name="label" translatable="yes">_Cancel</property>
+                <property name="use_underline">True</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -63,7 +64,8 @@
             </child>
             <child>
               <object class="GtkButton" id="ok-button">
-                <property name="label" translatable="yes">Select</property>
+                <property name="label" translatable="yes">_Select</property>
+                <property name="use_underline">True</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="can_default">True</property>
diff --git a/panels/user-accounts/data/user-accounts-dialog.ui b/panels/user-accounts/data/user-accounts-dialog.ui
index ba3f72a..079e83d 100644
--- a/panels/user-accounts/data/user-accounts-dialog.ui
+++ b/panels/user-accounts/data/user-accounts-dialog.ui
@@ -187,7 +187,9 @@
                           <object class="GtkLabel" id="account-type-label">
                             <property name="visible">True</property>
                             <property name="xalign">1</property>
-                            <property name="label" translatable="yes">Account type</property>
+                            <property name="label" translatable="yes">Account _type</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">account-type-combo</property>
                             <style>
                               <class name="dim-label"/>
                             </style>
@@ -243,7 +245,9 @@
                           <object class="GtkLabel" id="password-label">
                             <property name="visible">True</property>
                             <property name="xalign">1</property>
-                            <property name="label" translatable="yes">Password</property>
+                            <property name="label" translatable="yes">_Password</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">account-password-button</property>
                             <style>
                               <class name="dim-label"/>
                             </style>
@@ -271,7 +275,9 @@
                           <object class="GtkLabel" id="autologin-label">
                             <property name="visible">True</property>
                             <property name="xalign">1</property>
-                            <property name="label" translatable="yes">Automatic Login</property>
+                            <property name="label" translatable="yes">A_utomatic Login</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">autologin-switch</property>
                             <style>
                               <class name="dim-label"/>
                             </style>
@@ -312,7 +318,9 @@
                           <object class="GtkLabel" id="account-fingerprint-label">
                             <property name="visible">True</property>
                             <property name="xalign">1</property>
-                            <property name="label" translatable="yes">Fingerprint Login</property>
+                            <property name="label" translatable="yes">_Fingerprint Login</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">account-fingerprint-button</property>
                             <style>
                               <class name="dim-label"/>
                             </style>
@@ -385,7 +393,9 @@
                           <object class="GtkLabel" id="language-label">
                             <property name="visible">True</property>
                             <property name="xalign">1</property>
-                            <property name="label" translatable="yes">Language</property>
+                            <property name="label" translatable="yes">_Language</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">account-language-combo</property>
                             <style>
                               <class name="dim-label"/>
                             </style>
diff --git a/panels/user-accounts/um-editable-button.c b/panels/user-accounts/um-editable-button.c
index 3212459..5668bea 100644
--- a/panels/user-accounts/um-editable-button.c
+++ b/panels/user-accounts/um-editable-button.c
@@ -51,6 +51,7 @@ enum {
 
 enum {
         START_EDITING,
+        ACTIVATE,
         LAST_SIGNAL
 };
 
@@ -268,12 +269,16 @@ um_editable_button_finalize (GObject *object)
         G_OBJECT_CLASS (um_editable_button_parent_class)->finalize (object);
 }
 
+static void um_editable_button_activate (UmEditableButton *button);
+
 static void
 um_editable_button_class_init (UmEditableButtonClass *class)
 {
         GObjectClass *object_class;
+        GtkWidgetClass *widget_class;
 
         object_class = G_OBJECT_CLASS (class);
+        widget_class = GTK_WIDGET_CLASS (class);
 
         object_class->set_property = um_editable_button_set_property;
         object_class->get_property = um_editable_button_get_property;
@@ -287,6 +292,17 @@ um_editable_button_class_init (UmEditableButtonClass *class)
                               NULL, NULL,
                               g_cclosure_marshal_VOID__VOID,
                               G_TYPE_NONE, 0);
+        signals[ACTIVATE] =
+                g_signal_new ("activate",
+                              G_TYPE_FROM_CLASS (class),
+                              G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+                              G_STRUCT_OFFSET (UmEditableButtonClass, activate),
+                              NULL, NULL,
+                              g_cclosure_marshal_VOID__VOID,
+                              G_TYPE_NONE, 0);
+        widget_class->activate_signal = signals[ACTIVATE];
+        class->activate = um_editable_button_activate;
+
 
         g_object_class_install_property (object_class, PROP_TEXT,
                 g_param_spec_string ("text",
@@ -334,6 +350,16 @@ start_editing (UmEditableButton *button)
 }
 
 static void
+um_editable_button_activate (UmEditableButton *button)
+{
+        UmEditableButtonPrivate *priv = button->priv;
+
+        if (priv->editable) {
+                gtk_widget_grab_focus (GTK_WIDGET (button->priv->button));
+        }
+}
+
+static void
 button_clicked (GtkWidget        *widget,
                 UmEditableButton *button)
 {
diff --git a/panels/user-accounts/um-editable-button.h b/panels/user-accounts/um-editable-button.h
index 36af622..455746d 100644
--- a/panels/user-accounts/um-editable-button.h
+++ b/panels/user-accounts/um-editable-button.h
@@ -50,6 +50,7 @@ struct _UmEditableButtonClass
   GtkAlignmentClass parent_class;
 
   void (* start_editing) (UmEditableButton *button);
+  void (* activate)      (UmEditableButton *button);
 };
 
 GType        um_editable_button_get_type     (void) G_GNUC_CONST;
diff --git a/panels/user-accounts/um-editable-combo.c b/panels/user-accounts/um-editable-combo.c
index e1764bd..e1f7751 100644
--- a/panels/user-accounts/um-editable-combo.c
+++ b/panels/user-accounts/um-editable-combo.c
@@ -47,6 +47,7 @@ enum {
 
 enum {
         EDITING_DONE,
+        ACTIVATE,
         LAST_SIGNAL
 };
 
@@ -233,12 +234,16 @@ um_editable_combo_get_property (GObject    *object,
         }
 }
 
+static void um_editable_combo_activate (UmEditableCombo *combo);
+
 static void
 um_editable_combo_class_init (UmEditableComboClass *class)
 {
         GObjectClass *object_class;
+        GtkWidgetClass *widget_class;
 
         object_class = G_OBJECT_CLASS (class);
+        widget_class = GTK_WIDGET_CLASS (class);
 
         object_class->set_property = um_editable_combo_set_property;
         object_class->get_property = um_editable_combo_get_property;
@@ -251,6 +256,16 @@ um_editable_combo_class_init (UmEditableComboClass *class)
                               NULL, NULL,
                               g_cclosure_marshal_VOID__VOID,
                               G_TYPE_NONE, 0);
+        signals[ACTIVATE] =
+                g_signal_new ("activate",
+                              G_TYPE_FROM_CLASS (class),
+                              G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+                              G_STRUCT_OFFSET (UmEditableComboClass, activate),
+                              NULL, NULL,
+                              g_cclosure_marshal_VOID__VOID,
+                              G_TYPE_NONE, 0);
+        widget_class->activate_signal = signals[ACTIVATE];
+        class->activate = um_editable_combo_activate;
 
         g_object_class_install_property (object_class, PROP_MODEL,
                 g_param_spec_object ("model",
@@ -300,6 +315,15 @@ cancel_editing (UmEditableCombo *combo)
 }
 
 static void
+um_editable_combo_activate (UmEditableCombo *combo)
+{
+        if (combo->priv->editable) {
+                gtk_notebook_set_current_page (combo->priv->notebook, 2);
+                gtk_widget_grab_focus (GTK_WIDGET (combo->priv->combo));
+        }
+}
+
+static void
 button_clicked (GtkWidget       *widget,
                 UmEditableCombo *combo)
 {
diff --git a/panels/user-accounts/um-editable-combo.h b/panels/user-accounts/um-editable-combo.h
index 0d4e4a6..97237f9 100644
--- a/panels/user-accounts/um-editable-combo.h
+++ b/panels/user-accounts/um-editable-combo.h
@@ -50,6 +50,7 @@ struct _UmEditableComboClass
   GtkAlignmentClass parent_class;
 
   void (* editing_done) (UmEditableCombo *combo);
+  void (* activate)     (UmEditableCombo *combo);
 };
 
 GType         um_editable_combo_get_type        (void) G_GNUC_CONST;



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