Change some instances of GtkAction to PsppireDialogAction
[pspp] / src / ui / gui / psppire-dialog-action-tt1s.c
index 0d00f06ea96135fc4fcea780d3d4767a30b29513..8f3932958d917d5c77dc5455ed0957e555b74093 100644 (file)
@@ -103,12 +103,19 @@ refresh (PsppireDialogAction *rd_)
 }
 
 static void
-psppire_dialog_action_tt1s_activate (GtkAction *a)
+psppire_dialog_action_tt1s_activate (PsppireDialogAction *a)
 {
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionTt1s *act = PSPPIRE_DIALOG_ACTION_TT1S (a);
 
-  GtkBuilder *xml = builder_new ("t-test.ui");
+  GHashTable *thing = psppire_dialog_action_get_hash_table (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("t-test.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   GtkWidget *options_button = get_widget_assert (xml, "button1");
 
   pda->dialog = get_widget_assert (xml, "t-test-one-sample-dialog");
@@ -128,9 +135,6 @@ psppire_dialog_action_tt1s_activate (GtkAction *a)
   g_signal_connect_swapped (options_button, "clicked",
                            G_CALLBACK (tt_options_dialog_run), act->opt);
 
-
-  g_object_unref (xml);
-
   if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_tt1s_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_tt1s_parent_class)->activate (pda);
 }