PsppireDialogAction (generate_syntax): Change signature.
[pspp] / src / ui / gui / psppire-dialog-action-sort.c
index 29c3c8063edfd1c373c6e8a082330526548c0e8a..2acbb19b2b7ab9f1fd91bd9b36db66b9137f4c20 100644 (file)
@@ -30,7 +30,7 @@ static void psppire_dialog_action_sort_class_init      (PsppireDialogActionSortC
 G_DEFINE_TYPE (PsppireDialogActionSort, psppire_dialog_action_sort, PSPPIRE_TYPE_DIALOG_ACTION);
 
 static char *
-generate_syntax (PsppireDialogAction *act)
+generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogActionSort *scd = PSPPIRE_DIALOG_ACTION_SORT (act);
   gchar *text;
@@ -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);
@@ -114,10 +121,8 @@ psppire_dialog_action_sort_activate (GtkAction *a)
 static void
 psppire_dialog_action_sort_class_init (PsppireDialogActionSortClass *class)
 {
-  GtkActionClass *action_class = GTK_ACTION_CLASS (class);
-  PsppireDialogActionClass *pdac = PSPPIRE_DIALOG_ACTION_CLASS (class);
-
-  action_class->activate = psppire_dialog_action_sort_activate;
+ PsppireDialogActionClass *pdac = PSPPIRE_DIALOG_ACTION_CLASS (class);
+  psppire_dialog_action_set_activation (class, psppire_dialog_action_sort_activate);
 
   pdac->generate_syntax = generate_syntax;
 }