gui: Change View|Data and View|Variables to radio button menu items.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 1 May 2011 05:30:28 +0000 (22:30 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 4 May 2011 03:18:41 +0000 (20:18 -0700)
I didn't know what View|Variables did until I tried it, at which
point I was surprised that it changed into View|Data.  I think that
a pair of radio button menu items better communicates the intent.
Also, this situation seems to fit well what the GNOME Human Interface
Guidelines say about radio button menu items:

    Radio button menu items show which of two or more
    mutually-exclusive settings are currently selected, and allow
    the user to choose a different setting by selecting its menu
    item.

    * If you need to offer a choice of two mutually-exclusive
      settings to the user, use a group of two radio button items
      instead of a single check box menu item if the settings are
      not clearly opposites. For example, represent View as Icons
      and View as List as two radio button items.

src/ui/gui/data-editor.ui
src/ui/gui/psppire-data-window.c

index e64334a6681db76141b4d37620ec1347c53d162e..012605e534fedbc68345f284479fca1d6a7eb65d 100644 (file)
           </object>
         </child>
         <child>
-          <object class="GtkAction" id="view_data">
+          <object class="GtkRadioAction" id="view_data">
             <property name="name">view_data</property>
             <property name="label" translatable="yes">_Data</property>
           </object>
         </child>
         <child>
-          <object class="GtkAction" id="view_variables">
+          <object class="GtkRadioAction" id="view_variables">
             <property name="name">view_variables</property>
             <property name="label" translatable="yes">_Variables</property>
+           <property name="group">view_data</property>
           </object>
         </child>
         <child>
index ef06d83a7ca46b46c88071555dac96546b916b62..c3886e1dfcf7855336becfe4a7236b477aed4192 100644 (file)
@@ -815,15 +815,14 @@ on_switch_sheet (GtkNotebook *notebook,
   switch (page_num)
     {
     case PSPPIRE_DATA_EDITOR_VARIABLE_VIEW:
-      gtk_widget_hide (view_variables);
-      gtk_widget_show (view_data);
+      gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (view_variables),
+                                      TRUE);
       gtk_action_set_sensitive (de->insert_variable, TRUE);
       gtk_action_set_sensitive (de->insert_case, FALSE);
       gtk_action_set_sensitive (de->invoke_goto_dialog, FALSE);
       break;
     case PSPPIRE_DATA_EDITOR_DATA_VIEW:
-      gtk_widget_show (view_variables);
-      gtk_widget_hide (view_data);
+      gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (view_data), TRUE);
       gtk_action_set_sensitive (de->invoke_goto_dialog, TRUE);
       gtk_action_set_sensitive (de->insert_case, TRUE);
       break;