Added Mnemonics to the value chooser widget and to the recode dialog.
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 1 Nov 2012 17:44:17 +0000 (18:44 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Thu, 1 Nov 2012 18:36:33 +0000 (19:36 +0100)
src/ui/gui/psppire-val-chooser.c
src/ui/gui/recode-dialog.c
src/ui/gui/recode.ui

index 55edf906cc922c6f209df7f8247e97dfa4a23a0d..605cea3303766c36f7c70acfae20d33a36cbad54 100644 (file)
@@ -325,13 +325,13 @@ static GtkWidget * simple_entry (struct layout *l, struct range_widgets *rw)
 
 static struct layout range_opt[n_VAL_CHOOSER_BUTTONS]= 
   {
-    {N_("Value:"),                    simple_entry, simple_set },
-    {N_("System Missing"),            NULL,         sysmis_set },
-    {N_("System or User Missing"),    NULL,         missing_set},
-    {N_("Range:"),                    range_entry,  range_set  },
-    {N_("Range, LOWEST thru value"),  simple_entry, lo_up_set  },
-    {N_("Range, value thru HIGHEST"), simple_entry, hi_down_set},
-    {N_("All other values"),          NULL,         else_set   }
+    {N_("_Value:"),                    simple_entry, simple_set },
+    {N_("_System Missing"),            NULL,         sysmis_set },
+    {N_("System _or User Missing"),    NULL,         missing_set},
+    {N_("_Range:"),                    range_entry,  range_set  },
+    {N_("Range, _LOWEST thru value"),  simple_entry, lo_up_set  },
+    {N_("Range, value thru _HIGHEST"), simple_entry, hi_down_set},
+    {N_("_All other values"),          NULL,         else_set   }
   };
 
 static void
@@ -359,10 +359,9 @@ psppire_val_chooser_init (PsppireValChooser *vr)
     {
       struct layout *l = &range_opt[i];
       vr->rw[i].label = GTK_LABEL (gtk_label_new (gettext (l->label)));
+      gtk_label_set_use_underline (vr->rw[i].label, TRUE);
       vr->rw[i].rb = GTK_TOGGLE_BUTTON (gtk_radio_button_new (group));
-
-      gtk_widget_set_sensitive (GTK_WIDGET (vr->rw[i].label), FALSE);
-      g_signal_connect (vr->rw[i].rb, "toggled", G_CALLBACK (set_sensitivity_from_toggle), vr->rw[i].label);
+      gtk_label_set_mnemonic_widget (vr->rw[i].label, vr->rw[i].rb);
 
       gtk_misc_set_alignment (GTK_MISC (vr->rw[i].label), 0, 0.5);
 
index 5bdee0bb9e12984a15767b4e8cc4417df9dae304..73787b405190bb30cf99599d338ffbf07a74808f 100644 (file)
@@ -551,6 +551,14 @@ on_change_clicked (GObject *obj, gpointer data)
 }
 
 
+static void
+focus_value_entry (GtkWidget *w, struct recode_dialog *rd)
+{
+  if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)))
+    gtk_widget_grab_focus (rd->new_value_entry);
+}
+
+
 /* Callback for the new_value_entry and new_value_togglebutton widgets.
    It's used to enable/disable the acr. */
 static void
@@ -714,6 +722,9 @@ recode_dialog (PsppireDataWindow *de, gboolean diff)
     g_signal_connect_swapped (rd.toggle[BUTTON_NEW_VALUE], "toggled",
                      G_CALLBACK (set_acr), &rd);
 
+    g_signal_connect_after (rd.toggle[BUTTON_NEW_VALUE], "toggled",
+                     G_CALLBACK (focus_value_entry), &rd);
+
     g_signal_connect_swapped (rd.new_value_entry, "changed",
                      G_CALLBACK (set_acr), &rd);
 
index f9b758279635b99104d11dcc53b0add4caa22185..09a643d1f776fc57e862a3cd02a5106b3e81beb6 100644 (file)
@@ -13,7 +13,7 @@
         <property name="spacing">5</property>
         <child>
           <object class="PsppireValChooser" id="val-chooser">
-           <property name="label" translatable="yes">Old Value</property>
+           <property name="label" translatable="yes">Old Value</property>
             <property name="visible">True</property>
           </object>
           <packing>
@@ -94,7 +94,9 @@
                             <property name="visible">True</property>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                             <property name="xalign">0</property>
-                            <property name="label" translatable="yes">System Missing</property>
+                            <property name="label" translatable="yes">System _Missing</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">radiobutton2</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="visible">True</property>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                             <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Copy old values</property>
+                            <property name="label" translatable="yes">Co_py old values</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">radiobutton3</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
                                     <property name="visible">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                     <property name="xalign">1</property>
-                                    <property name="label" translatable="yes">Value: </property>
+                                    <property name="label" translatable="yes">Va_lue: </property>
+                                    <property name="use_underline">True</property>
+                                    <property name="mnemonic_widget">radiobutton1</property>
                                   </object>
                                   <packing>
                                     <property name="position">0</property>
                     <property name="visible">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Convert numeric strings to numbers (`5' -&gt; 5)</property>
+                    <property name="label" translatable="yes">Conver_t numeric strings to numbers (`5' -&gt; 5)</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">checkbutton2</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                         <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Output variables are strings</property>
+                        <property name="label" translatable="yes">Output variables are _strings</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">checkbutton1</property>
                       </object>
                       <packing>
                         <property name="position">0</property>
             <property name="spacing">5</property>
             <child>
               <object class="GtkButton" id="button2">
-                <property name="label" translatable="yes">If...</property>
+                <property name="label" translatable="yes">_If...</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="use_underline">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                         <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Name:</property>
+                        <property name="label" translatable="yes">_Name:</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">dest-name-entry</property>
                       </object>
                       <packing>
                         <property name="position">0</property>
                         <property name="visible">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                         <property name="xalign">0</property>
-                        <property name="label" translatable="yes">Label:</property>
+                        <property name="label" translatable="yes">La_bel:</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">dest-label-entry</property>
                       </object>
                       <packing>
                         <property name="position">2</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                         <child>
                           <object class="GtkButton" id="change-button">
-                            <property name="label" translatable="yes">Change</property>
+                            <property name="label" translatable="yes">Chan_ge</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">True</property>
+                           <property name="use_underline">True</property>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                           </object>
                           <packing>
                   <object class="GtkLabel" id="label17">
                     <property name="visible">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="label" translatable="yes">Variables:</property>
+                    <property name="label" translatable="yes">_Variables:</property>
                     <property name="use_markup">True</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">treeview2</property>
                   </object>
                 </child>
               </object>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <child>
                       <object class="GtkButton" id="button1">
-                        <property name="label" translatable="yes">Old and New Values</property>
+                        <property name="label" translatable="yes">Old and New Va_lues...</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="use_underline">True</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>