Persist dialog box widget settings.
[pspp] / src / ui / gui / psppire-dialog-action-roc.c
index 75e310ad02dce4a64262a1d7e87486188c077a66..03748f294666aa4fe514697203f19ee3a8efa1dd 100644 (file)
@@ -126,7 +126,15 @@ psppire_dialog_action_roc_activate (GtkAction *a)
   PsppireDialogActionRoc *act = PSPPIRE_DIALOG_ACTION_ROC (a);
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
 
-  GtkBuilder *xml = builder_new ("roc.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("roc.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
+
   pda->dialog = get_widget_assert   (xml, "roc-dialog");
   pda->source = get_widget_assert   (xml, "dict-view");
 
@@ -142,8 +150,6 @@ psppire_dialog_action_roc_activate (GtkAction *a)
   g_signal_connect_swapped (act->state_variable, "changed",
                            G_CALLBACK (on_state_var_changed), act);
 
-  g_object_unref (xml);
-
   g_signal_connect (act->curve, "toggled",
                    G_CALLBACK (on_curve_button_toggle), act);
 
@@ -238,9 +244,7 @@ generate_syntax (PsppireDialogAction *a)
 static void
 psppire_dialog_action_roc_class_init (PsppireDialogActionRocClass *class)
 {
-  GtkActionClass *action_class = GTK_ACTION_CLASS (class);
-
-  action_class->activate = psppire_dialog_action_roc_activate;
+  psppire_dialog_action_set_activation (class, psppire_dialog_action_roc_activate);
 
   PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
 }