Move data sheet cases popup menu to GtkBuilder file
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 9 May 2010 18:57:55 +0000 (20:57 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 9 May 2010 18:57:55 +0000 (20:57 +0200)
src/ui/gui/data-editor.ui
src/ui/gui/psppire-data-window.c

index 93bd84cd7fe4e866c7b15db9c5c95647c1ce8d40..a3b7f5daf1ee61659fcf85311d184c9ea6c75df4 100644 (file)
          <separator/>
          <menuitem action="edit_clear-variables"/>
       </popup>
+      <popup name="datasheet-cases-popup">
+         <menuitem action="edit_insert-case"/>
+         <separator/>
+         <menuitem action="edit_clear-cases"/>
+      </popup>
 </ui>
   </object>
   <!-- interface-requires gtk+ 2.6 -->
   <object class="GtkMenu" constructor="uimanager1" id="varsheet-variable-popup">
     <property name="visible">True</property>
   </object>
+  <object class="GtkMenu" constructor="uimanager1" id="datasheet-cases-popup">
+    <property name="visible">True</property>
+  </object>
   <object class="GtkHandleBox" id="handlebox1">
     <property name="visible">True</property>
     <child>
index 757d20e98fae44f89af04fd7800b32246206f107..c655ece6a8bc3989ad991a36046882f1ca1ab530 100644 (file)
@@ -843,43 +843,6 @@ file_quit (GtkCheckMenuItem *menuitem, gpointer data)
 }
 
 
-static GtkWidget *
-create_data_sheet_cases_popup_menu (PsppireDataWindow *de)
-{
-  GtkWidget *menu = gtk_menu_new ();
-
-  GtkWidget *insert_case =
-    gtk_menu_item_new_with_label (_("Insert Case"));
-
-  GtkWidget *delete_case =
-    gtk_menu_item_new_with_label (_("Clear"));
-
-
-  gtk_action_connect_proxy (de->delete_cases,
-                           delete_case);
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), insert_case);
-
-  g_signal_connect_swapped (insert_case, "activate",
-                           G_CALLBACK (gtk_action_activate),
-                           de->insert_case);
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu),
-                        gtk_separator_menu_item_new ());
-
-
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), delete_case);
-
-
-  gtk_widget_show_all (menu);
-
-  return menu;
-}
-
-
-
 static void
 on_recent_data_select (GtkMenuShell *menushell,
                       PsppireWindow *window)
@@ -1582,7 +1545,13 @@ psppire_data_window_init (PsppireDataWindow *de)
   }
 
   {
-    GtkMenu *data_sheet_variable_popup_menu = get_widget_assert (de->builder,
+    GtkWidget *data_sheet_cases_popup_menu = get_widget_assert (de->builder,
+                                                             "datasheet-cases-popup");
+
+    GtkWidget *var_sheet_variable_popup_menu = get_widget_assert (de->builder,
+                                                               "varsheet-variable-popup");
+
+    GtkWidget *data_sheet_variable_popup_menu = get_widget_assert (de->builder,
                                                                 "datasheet-variable-popup");
 
     g_signal_connect_swapped (get_action_assert (de->builder, "sort-up"), "activate",
@@ -1593,12 +1562,6 @@ psppire_data_window_init (PsppireDataWindow *de)
                            G_CALLBACK (psppire_data_editor_sort_descending),
                            de->data_editor);
 
-    GtkMenu *var_sheet_variable_popup_menu = get_widget_assert (de->builder,
-                                                               "varsheet-variable-popup");
-
-    GtkMenu *data_sheet_cases_popup_menu =
-      GTK_MENU (create_data_sheet_cases_popup_menu (de));
-
     g_object_set (de->data_editor,
                  "datasheet-column-menu", data_sheet_variable_popup_menu,
                  "datasheet-row-menu", data_sheet_cases_popup_menu,