Persist dialog box widget settings.
[pspp] / src / ui / gui / psppire-dialog-action-1sks.c
index 055d3e9f0cfc8179ffbf08e8c3ed5c2b6b5c97fc..0d25f3e7ceeb4e67baca44e3411ab1029384ce38 100644 (file)
@@ -122,7 +122,14 @@ psppire_dialog_action_1sks_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogAction1sks *act = PSPPIRE_DIALOG_ACTION_1SKS (a);
 
-  GtkBuilder *xml = builder_new ("ks-one-sample.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("ks-one-sample.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   pda->dialog = get_widget_assert   (xml, "ks-one-sample-dialog");
   pda->source = get_widget_assert   (xml, "dict-view");
 
@@ -136,8 +143,6 @@ psppire_dialog_action_1sks_activate (GtkAction *a)
   psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
   psppire_dialog_action_set_refresh (pda, refresh);
 
-  g_object_unref (xml);
-
   if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_1sks_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_1sks_parent_class)->activate (pda);
 }