.ui files: Bump version of required Gtk to 3.4.2
[pspp] / src / ui / gui / psppire-dialog-action-sort.c
index 1c5a9e01847101148fe299bd5a22f48a5b841f5c..8377e9592fd27fd716abac36d496e31a2b8305ad 100644 (file)
@@ -90,16 +90,23 @@ dialog_state_valid (gpointer act)
 
 
 static void
-psppire_dialog_action_sort_activate (GtkAction *a)
+psppire_dialog_action_sort_activate (PsppireDialogAction *a)
 {
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionSort *act = PSPPIRE_DIALOG_ACTION_SORT (a);
 
-  GtkBuilder *xml = builder_new ("sort.ui");
-  pda->dialog = get_widget_assert   (xml, "sort-cases-dialog");
-  pda->source = get_widget_assert   (xml, "sort-cases-treeview1");
+  GHashTable *thing = psppire_dialog_action_get_hash_table (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("sort.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
+  pda->dialog = get_widget_assert (xml, "sort-cases-dialog");
+  pda->source = get_widget_assert (xml, "sort-cases-treeview1");
   
-  act->variables =  get_widget_assert   (xml, "sort-cases-treeview2");
+  act->variables =  get_widget_assert (xml, "sort-cases-treeview2");
   act->ascending = get_widget_assert (xml, "sort-cases-radiobutton0");
 
   psppire_dialog_action_set_refresh (pda, reset);
@@ -109,8 +116,6 @@ psppire_dialog_action_sort_activate (GtkAction *a)
 
   if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_sort_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_sort_parent_class)->activate (pda);
-
-  g_object_unref (xml);
 }
 
 static void