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
This commit is contained in:
Matthias Clasen 2011-05-15 20:10:57 -04:00
parent f783f3cfdc
commit 0725cffaee
7 changed files with 74 additions and 10 deletions

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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",
@ -333,6 +349,16 @@ start_editing (UmEditableButton *button)
g_signal_emit (button, signals[START_EDITING], 0);
}
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)

View file

@ -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;

View file

@ -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",
@ -299,6 +314,15 @@ cancel_editing (UmEditableCombo *combo)
gtk_notebook_set_current_page (combo->priv->notebook, 1);
}
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)

View file

@ -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;