[Top][All Lists]

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

[datasets 18/18] gui: Change View|Data and View|Variables to radio butto

From: Ben Pfaff
Subject: [datasets 18/18] gui: Change View|Data and View|Variables to radio button menu items.
Date: Sat, 30 Apr 2011 22:36:46 -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

    * 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        |    5 +++--
 src/ui/gui/psppire-data-window.c |    7 +++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/ui/gui/data-editor.ui b/src/ui/gui/data-editor.ui
index e64334a..012605e 100644
--- a/src/ui/gui/data-editor.ui
+++ b/src/ui/gui/data-editor.ui
@@ -219,15 +219,16 @@
-          <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 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>
diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c
index ef06d83..c3886e1 100644
--- a/src/ui/gui/psppire-data-window.c
+++ b/src/ui/gui/psppire-data-window.c
@@ -815,15 +815,14 @@ on_switch_sheet (GtkNotebook *notebook,
   switch (page_num)
-      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);
-      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);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]