Update selector widgets on dialog activation.
[pspp] / src / ui / gui / psppire-dialog-action-compute.c
index 048c05de384843bd23e003e0a69ea5d291a7f4c1..164737ce21b6fa1853d8cd3a78d2c7aeb158bc41 100644 (file)
@@ -461,7 +461,14 @@ psppire_dialog_action_compute_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionCompute *act = PSPPIRE_DIALOG_ACTION_COMPUTE (a);
 
-  GtkBuilder *xml = builder_new ("compute.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("compute.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   pda->dialog = get_widget_assert   (xml, "compute-variable-dialog");
   pda->source = get_widget_assert   (xml, "compute-treeview1");
 
@@ -520,8 +527,6 @@ psppire_dialog_action_compute_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_compute_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_compute_parent_class)->activate (pda);
 }
@@ -529,9 +534,8 @@ psppire_dialog_action_compute_activate (GtkAction *a)
 static void
 psppire_dialog_action_compute_class_init (PsppireDialogActionComputeClass *class)
 {
-  GtkActionClass *action_class = GTK_ACTION_CLASS (class);
+  psppire_dialog_action_set_activation (class, psppire_dialog_action_compute_activate);
 
-  action_class->activate = psppire_dialog_action_compute_activate;
   PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
 }