Persist dialog box widget settings.
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 28 Nov 2015 06:55:01 +0000 (07:55 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 28 Nov 2015 16:39:17 +0000 (17:39 +0100)
Arrange for the status of widgets within dialog boxes to persist
between calls when called for the same dataset.   Some users
have requested this to make repeated operations easier.

37 files changed:
NEWS
src/ui/gui/psppire-checkbox-treeview.c
src/ui/gui/psppire-dialog-action-1sks.c
src/ui/gui/psppire-dialog-action-barchart.c
src/ui/gui/psppire-dialog-action-binomial.c
src/ui/gui/psppire-dialog-action-chisquare.c
src/ui/gui/psppire-dialog-action-compute.c
src/ui/gui/psppire-dialog-action-correlation.c
src/ui/gui/psppire-dialog-action-count.c
src/ui/gui/psppire-dialog-action-crosstabs.c
src/ui/gui/psppire-dialog-action-descriptives.c
src/ui/gui/psppire-dialog-action-examine.c
src/ui/gui/psppire-dialog-action-factor.c
src/ui/gui/psppire-dialog-action-flip.c
src/ui/gui/psppire-dialog-action-frequencies.c
src/ui/gui/psppire-dialog-action-histogram.c
src/ui/gui/psppire-dialog-action-indep-samps.c
src/ui/gui/psppire-dialog-action-k-related.c
src/ui/gui/psppire-dialog-action-kmeans.c
src/ui/gui/psppire-dialog-action-logistic.c
src/ui/gui/psppire-dialog-action-means.c
src/ui/gui/psppire-dialog-action-oneway.c
src/ui/gui/psppire-dialog-action-paired.c
src/ui/gui/psppire-dialog-action-rank.c
src/ui/gui/psppire-dialog-action-regression.c
src/ui/gui/psppire-dialog-action-reliability.c
src/ui/gui/psppire-dialog-action-roc.c
src/ui/gui/psppire-dialog-action-runs.c
src/ui/gui/psppire-dialog-action-scatterplot.c
src/ui/gui/psppire-dialog-action-sort.c
src/ui/gui/psppire-dialog-action-tt1s.c
src/ui/gui/psppire-dialog-action-two-sample.c
src/ui/gui/psppire-dialog-action-univariate.c
src/ui/gui/psppire-dialog-action-var-info.c
src/ui/gui/psppire-dialog-action.c
src/ui/gui/psppire-dialog-action.h
src/ui/gui/psppire-dialog.c

diff --git a/NEWS b/NEWS
index d7d0a4102b7efb42aeda6d0585a2ba0019ab48f0..f7deed7fa77106d0e3acdbd3d6942e6d8247960d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,13 +13,17 @@ Changes from 0.8.5 to 0.9.0:
 
  * A Russian localisation has been contributed.
 
- * The graphic user interface now has a Graphs menu to access the GRAPH
-   command.
-
  * The GRAPH command now has a /BAR subcommand to draw barcharts.
 
- * The graphical user interface uses Gtk+ version 3 instead of version 2.
-   Accordingly, it has a somewhat different look and feel.
+ * The graphical user interface (psppire) has been changed as follows:
+
+   - It now uses Gtk+ version 3 instead of version 2.  Accordingly, it has a 
+     somewhat different look and feel.
+
+   - There is now has a Graphs menu to access the GRAPH command.
+
+   - The status of dialog box widgets are now preserved between calls
+     to the same dialog box for the same dataset.
 
  * The pspp-convert utility can now decrypt encrypted syntax files.
    The encrypted syntax file format is unacceptably insecure, so to
index 04f49d3747200414db9ce5db0d63762a3d4af8c4..005ab54269c8828501984d5bab1a96246eb082ec 100644 (file)
@@ -123,7 +123,7 @@ psppire_checkbox_treeview_init (PsppireCheckboxTreeview *cbtv)
                                                   G_TYPE_STRING));
 
   gtk_tree_view_set_model (GTK_TREE_VIEW (cbtv), cbtv->list);
-  g_object_unref (cbtv->list);
+  //  g_object_unref (cbtv->list);
 
   treeview_checkbox_populate (GTK_TREE_VIEW (cbtv));
 }
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);
 }
index 87b8fa1318036904d3afd0853a00dfffb8445aad..d381c1abf1a37d6ab49ff63517301de0340e3d29 100644 (file)
@@ -120,7 +120,14 @@ psppire_dialog_action_barchart_activate (GtkAction *a)
   PsppireDialogActionBarchart *act = PSPPIRE_DIALOG_ACTION_BARCHART (a);
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
 
-  GtkBuilder *xml = builder_new ("barchart.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("barchart.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   pda->dialog = get_widget_assert (xml, "barchart-dialog");
   pda->source = get_widget_assert (xml, "dict-view");
 
@@ -138,15 +145,13 @@ psppire_dialog_action_barchart_activate (GtkAction *a)
 
   populate_combo_model (GTK_COMBO_BOX(act->combobox));
   
-  g_object_unref (xml);
-
   g_signal_connect_swapped (act->button_summary_func, "toggled",
                            G_CALLBACK (on_summary_toggle), act);
 
   psppire_dialog_action_set_refresh (pda, refresh);
 
   psppire_dialog_action_set_valid_predicate (pda,
-                                       dialog_state_valid);
+                                            dialog_state_valid);
 
   if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_barchart_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_barchart_parent_class)->activate (pda);
index 6581b96c0d1e6241b76315b03e255820373f6152..0f63e0652f8c3ba0db4b25c7f302ea34e31b39a8 100644 (file)
@@ -102,7 +102,13 @@ psppire_dialog_action_binomial_activate (GtkAction *a)
   PsppireDialogActionBinomial *act = PSPPIRE_DIALOG_ACTION_BINOMIAL (a);
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
 
-  GtkBuilder *xml = builder_new ("binomial.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("binomial.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
 
   pda->dialog = get_widget_assert   (xml, "binomial-dialog");
   pda->source = get_widget_assert   (xml, "dict-view");
@@ -114,9 +120,6 @@ psppire_dialog_action_binomial_activate (GtkAction *a)
   act->cutpoint_entry =     get_widget_assert   (xml, "cutpoint-entry");
   act->cutpoint_button =    get_widget_assert   (xml, "radiobutton4");
 
-  g_object_unref (xml);
-
-
   g_signal_connect (act->cutpoint_button, "toggled", G_CALLBACK (set_sensitivity_from_toggle),
                    act->cutpoint_entry);
 
index bca99ab5750fd37fc9bb08e26059a1767041a64b..ca08698ae0e4c2524936913f2defd152dbb8ae7f 100644 (file)
@@ -134,7 +134,13 @@ psppire_dialog_action_chisquare_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionChisquare *act = PSPPIRE_DIALOG_ACTION_CHISQUARE (a);
 
-  GtkBuilder *xml = builder_new ("chi-square.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("chi-square.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
 
   GtkWidget *range_table = get_widget_assert   (xml, "range-table");
   GtkWidget *values_acr = get_widget_assert   (xml, "psppire-acr1");
@@ -159,8 +165,6 @@ psppire_dialog_action_chisquare_activate (GtkAction *a)
   psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
   psppire_dialog_action_set_refresh (pda, refresh);
 
-  g_object_unref (xml);
-
   g_signal_connect (act->range_button, "toggled", 
                    G_CALLBACK (set_sensitivity_from_toggle), 
                    range_table);
index 5fc63d5dedf48314d4eb017714139ba27fe4cb0b..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);
 }
index 29f6e20179c03cb148ffce4df909cb13d076f1b6..4dd10f3b4208fd8807eb07aecdc1b447782bbe7d 100644 (file)
@@ -97,9 +97,16 @@ psppire_dialog_action_correlation_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionCorrelation *act = PSPPIRE_DIALOG_ACTION_CORRELATION (a);
 
-  GtkBuilder *xml = builder_new ("correlation.ui");
-  pda->dialog = get_widget_assert   (xml, "correlation-dialog");
-  pda->source = get_widget_assert   (xml, "dict-view");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("correlation.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
+  pda->dialog = get_widget_assert (xml, "correlation-dialog");
+  pda->source = get_widget_assert (xml, "dict-view");
 
   act->variables = get_widget_assert (xml, "psppire-var-view1");
   act->significant = get_widget_assert (xml, "button-flag-significants");
@@ -108,8 +115,6 @@ psppire_dialog_action_correlation_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_correlation_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_correlation_parent_class)->activate (pda);
 }
index edb44a065c816edfea660089c28febdba7d98cb2..69174950b1ce5c10bbd1ba98a75e314074bb8790 100644 (file)
@@ -150,7 +150,14 @@ psppire_dialog_action_count_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionCount *act = PSPPIRE_DIALOG_ACTION_COUNT (a);
 
-  GtkBuilder *xml = builder_new ("count.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("count.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   GtkWidget *selector = get_widget_assert (xml, "count-selector1");
   GtkWidget *button = get_widget_assert (xml, "button1");
 
@@ -168,12 +175,9 @@ psppire_dialog_action_count_activate (GtkAction *a)
 
   g_signal_connect_swapped (button, "clicked", G_CALLBACK (values_dialog), act);
 
-
   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_count_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_count_parent_class)->activate (pda);
 }
index fa9f282ac60fe6e43d7e062707db03874585dba1..f6883a88041924f2835bc78bb7c60ee277557311 100644 (file)
@@ -208,7 +208,13 @@ psppire_dialog_action_crosstabs_activate (GtkAction *a)
   PsppireDialogActionCrosstabs *act = PSPPIRE_DIALOG_ACTION_CROSSTABS (a);
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
 
-  GtkBuilder *xml = builder_new ("crosstabs.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("crosstabs.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
 
   pda->dialog = get_widget_assert   (xml, "crosstabs-dialog");
   pda->source = get_widget_assert   (xml, "dict-treeview");
@@ -228,9 +234,6 @@ psppire_dialog_action_crosstabs_activate (GtkAction *a)
   act->table_button = get_widget_assert (xml, "print-tables");
   act->pivot_button = get_widget_assert (xml, "pivot");
 
-
-  g_object_unref (xml);
-
   act->format_options_avalue = TRUE;
   act->format_options_table = TRUE;
   act->format_options_pivot = TRUE;
index 04781ea8f3ca193fa2ff3976c532dd0a034741f8..9140e19c3c21100f6e86863b5e3a445909cbe5bf 100644 (file)
@@ -192,22 +192,29 @@ dialog_refresh (PsppireDialogAction *scd_)
   gtk_toggle_button_set_active (scd->save_z_scores, false);
 }
 
+
 static void
 psppire_dialog_action_descriptives_activate (GtkAction *a)
 {
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionDescriptives *act = PSPPIRE_DIALOG_ACTION_DESCRIPTIVES (a);
 
-  GtkBuilder *xml = builder_new ("descriptives.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("descriptives.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
 
-  GtkWidget *stats_treeview = get_widget_assert    (xml, "statistics");
+  GtkWidget *stats_treeview = get_widget_assert (xml, "statistics");
 
   pda->dialog = get_widget_assert   (xml, "descriptives-dialog");
   pda->source = get_widget_assert   (xml, "all-variables");
   act->variables =   get_widget_assert   (xml, "stat-variables");
 
   g_object_set (pda->source,
-       "predicate", var_is_numeric, NULL);
+               "predicate", var_is_numeric, NULL);
 
   psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (stats_treeview),
                                      B_DS_DEFAULT,
@@ -227,8 +234,6 @@ psppire_dialog_action_descriptives_activate (GtkAction *a)
   psppire_dialog_action_set_refresh (pda, dialog_refresh);
 
   PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_descriptives_parent_class)->activate (pda);
-
-  g_object_unref (xml);
 }
 
 static void
index bba35cf12427c6a067b0b36c23e6e3d4f48bcc0b..a2248671d5757950b5b4a207a376d2ceddabc463 100644 (file)
@@ -203,7 +203,13 @@ psppire_dialog_action_examine_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionExamine *act = PSPPIRE_DIALOG_ACTION_EXAMINE (a);
 
-  GtkBuilder *xml = builder_new ("examine.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("examine.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
 
   GtkWidget *stats_button = get_widget_assert (xml, "stats-button");
   GtkWidget *opts_button = get_widget_assert (xml, "opts-button");
@@ -255,9 +261,7 @@ psppire_dialog_action_examine_activate (GtkAction *a)
  
   PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_examine_parent_class)->activate (pda);
 
-
   g_list_free (list);
-  g_object_unref (xml);
 }
 
 static void
index e8874449cc70afb209672d99c64986531a00ad4d..8ec9e22849e4e6d001da13fca253a31a4d417e55 100644 (file)
@@ -301,7 +301,13 @@ psppire_dialog_action_factor_activate (GtkAction *a)
   GtkWidget *extraction_button ;
   GtkWidget *rotation_button ;
 
-  GtkBuilder *xml = builder_new ("factor.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("factor.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
 
   pda->dialog = get_widget_assert   (xml, "factor-dialog");
   pda->source = get_widget_assert   (xml, "dict-view");
@@ -364,8 +370,6 @@ psppire_dialog_action_factor_activate (GtkAction *a)
   psppire_dialog_action_set_refresh (pda, dialog_refresh);
 
   PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_factor_parent_class)->activate (pda);
-  
-  g_object_unref (xml);
 }
 
 static void
index 1b63856df57f102747d371912551c5fb4c1788af..2c265f3826afd6a0b62f097f9e514bb19d9b10a4 100644 (file)
@@ -95,7 +95,14 @@ psppire_dialog_action_flip_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionFlip *act = PSPPIRE_DIALOG_ACTION_FLIP (a);
 
-  GtkBuilder *xml = builder_new ("psppire.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("psppire.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   pda->dialog = get_widget_assert   (xml, "transpose-dialog");
   pda->source = get_widget_assert   (xml, "source-treeview");
 
@@ -105,8 +112,6 @@ psppire_dialog_action_flip_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_flip_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_flip_parent_class)->activate (pda);
 }
index d0ae660a256c7551bc2a84953baae7600e2f8f32..490a735f53b7cd7cbda8739b802f04c518887123 100644 (file)
@@ -259,7 +259,13 @@ psppire_dialog_action_frequencies_activate (GtkAction * a)
   PsppireDialogActionFrequencies *act = PSPPIRE_DIALOG_ACTION_FREQUENCIES (a);
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
 
-  GtkBuilder *xml = builder_new ("frequencies.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("frequencies.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
 
   GtkWidget *stats_treeview = get_widget_assert (xml, "stats-treeview");
   GtkWidget *tables_button = get_widget_assert (xml, "tables-button");
@@ -327,10 +333,6 @@ psppire_dialog_action_frequencies_activate (GtkAction * a)
 
   act->bar =  (get_widget_assert (xml, "bar"));
 
-
-  g_object_unref (xml);
-
-
   act->tables_opts_order = FRQ_AVALUE;
   act->tables_opts_table = FRQ_TABLE;
   act->tables_opts_limit = 50;
index 5a57c2aece6fc46798794968305c8ada474136a8..08ffc1ad22c5b9811c4c24d9eb4a2077fc6cc0a2 100644 (file)
@@ -65,15 +65,20 @@ psppire_dialog_action_histogram_activate (GtkAction *a)
   PsppireDialogActionHistogram *act = PSPPIRE_DIALOG_ACTION_HISTOGRAM (a);
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
 
-  GtkBuilder *xml = builder_new ("histogram.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("histogram.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   pda->dialog = get_widget_assert (xml, "histogram-dialog");
   pda->source = get_widget_assert (xml, "dict-view");
 
   act->variable = get_widget_assert (xml, "entry1");
   act->curve = get_widget_assert (xml, "curve");
 
-  g_object_unref (xml);
-
   psppire_dialog_action_set_refresh (pda, refresh);
 
   psppire_dialog_action_set_valid_predicate (pda,
index 8709b1da075ea9577b762abf4766a166c8eb42e8..08529e43e8896d3ca0d89195f2a10ee425907d5d 100644 (file)
@@ -292,7 +292,13 @@ psppire_dialog_action_indep_samps_activate (GtkAction *a)
   PsppireDialogActionIndepSamps *act = PSPPIRE_DIALOG_ACTION_INDEP_SAMPS (a);
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
 
-  GtkBuilder *xml = builder_new ("indep-samples.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("indep-samples.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
 
   pda->dialog = get_widget_assert (xml,"independent-samples-dialog"); 
   pda->source = get_widget_assert (xml, "indep-samples-treeview1");
@@ -324,9 +330,6 @@ psppire_dialog_action_indep_samps_activate (GtkAction *a)
   g_signal_connect (act->dg_values_toggle_button, "toggled",
                    G_CALLBACK (set_group_criterion_type), act);
 
-
-  g_object_unref (xml);
-
   psppire_dialog_action_set_refresh (pda, refresh);
 
   psppire_dialog_action_set_valid_predicate (pda,
index 387dbd30487dba35e85e99274bd6545572c6a83a..16f0f721c3703a3544fd4566a7758caab45bf0cc 100644 (file)
@@ -110,7 +110,14 @@ psppire_dialog_action_k_related_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionKRelated *act = PSPPIRE_DIALOG_ACTION_K_RELATED (a);
 
-  GtkBuilder *xml = builder_new ("k-related.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("k-related.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   pda->dialog = get_widget_assert   (xml, "k-related-dialog");
   pda->source = get_widget_assert   (xml, "dict-view");
 
@@ -126,8 +133,6 @@ psppire_dialog_action_k_related_activate (GtkAction *a)
                "predicate", var_is_numeric,
                NULL);
 
-  g_object_unref (xml);
-
   if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_k_related_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_k_related_parent_class)->activate (pda);
 }
index 18f7138cd6e4fc9acc9a74fd1a294d59a71f73b5..c1c913b37d05955462449c1b5efe08f236160de2 100644 (file)
@@ -86,7 +86,14 @@ psppire_dialog_action_kmeans_activate (GtkAction *a)
 {
   PsppireDialogActionKmeans *act = PSPPIRE_DIALOG_ACTION_KMEANS (a);
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
-  GtkBuilder *xml = builder_new ("k-means.ui");
+
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("k-means.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
 
   pda->dialog = get_widget_assert   (xml, "k-means-dialog");
   pda->source = get_widget_assert   (xml, "dict-view");
@@ -95,11 +102,8 @@ psppire_dialog_action_kmeans_activate (GtkAction *a)
   act->variables = get_widget_assert (xml, "psppire-var-view1");
 
   psppire_dialog_action_set_refresh (pda, refresh);
-
   psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
 
-  g_object_unref (xml);
-
   if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_kmeans_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_kmeans_parent_class)->activate (pda);
 }
index 8da049f538b991b421ab6b163ff3067d72362f83..074b8e145621af4a1b2cf4b0d72ea35bd836c967 100644 (file)
@@ -102,7 +102,13 @@ psppire_dialog_action_logistic_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   GtkWidget *opts_button;
 
-  GtkBuilder *xml = builder_new ("logistic.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("logistic.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
 
   pda->dialog = get_widget_assert   (xml, "logistic-dialog");
   pda->source = get_widget_assert   (xml, "dict-view");
@@ -134,8 +140,6 @@ psppire_dialog_action_logistic_activate (GtkAction *a)
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(act->conf_checkbox), TRUE);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(act->conf_checkbox), FALSE);
 
-  g_object_unref (xml);
-
   psppire_dialog_action_set_refresh (pda, refresh);
 
   psppire_dialog_action_set_valid_predicate (pda,
index 9b20560a05c100e036b24660ea2653bd04bc4b2e..6610f595563a561c077506d6a0c2beb3b503055e 100644 (file)
@@ -97,18 +97,24 @@ psppire_dialog_action_means_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionMeans *act = PSPPIRE_DIALOG_ACTION_MEANS (a);
 
-  GtkBuilder *xml = builder_new ("means.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("means.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
 
-  GtkWidget *vb =   get_widget_assert   (xml, "alignment3");
-  GtkWidget *selector = get_widget_assert   (xml, "layer-selector");
+  GtkWidget *vb =   get_widget_assert (xml, "alignment3");
+  GtkWidget *selector = get_widget_assert (xml, "layer-selector");
   
   act->layer = psppire_means_layer_new ();
   gtk_container_add (GTK_CONTAINER (vb), act->layer);
   gtk_widget_show (act->layer);
 
-  pda->dialog = get_widget_assert   (xml, "means-dialog");
-  pda->source = get_widget_assert   (xml, "all-variables");
-  act->variables = get_widget_assert   (xml, "stat-variables");
+  pda->dialog = get_widget_assert (xml, "means-dialog");
+  pda->source = get_widget_assert (xml, "all-variables");
+  act->variables = get_widget_assert (xml, "stat-variables");
 
   g_object_set (pda->source,
                "predicate", var_is_numeric,
@@ -118,13 +124,10 @@ psppire_dialog_action_means_activate (GtkAction *a)
                "dest-widget", act->layer,
                NULL);
 
-
   psppire_dialog_action_set_valid_predicate (pda, (void *) dialog_state_valid);
   psppire_dialog_action_set_refresh (pda, dialog_refresh);
 
   PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_means_parent_class)->activate (pda);
-
-  g_object_unref (xml);
 }
 
 static void
index 6e66862c4b60754d4eab567a134dfb4fd846f58f..604c271f57e2e7af36cf3aff22c71d7adc28ab53 100644 (file)
@@ -226,7 +226,14 @@ psppire_dialog_action_oneway_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionOneway *act = PSPPIRE_DIALOG_ACTION_ONEWAY (a);
 
-  GtkBuilder *xml = builder_new ("oneway.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("oneway.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   GtkWidget *contrasts_button =
     get_widget_assert (xml, "contrasts-button");
   GtkEntry *entry = GTK_ENTRY (get_widget_assert (xml, "entry1"));
@@ -266,8 +273,6 @@ psppire_dialog_action_oneway_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_oneway_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_oneway_parent_class)->activate (pda);
 }
index d08fc109aa69ad021a6b7d909e8dc842d79d2173..a5ce1584a4daad9d7c9f2391cd92e9ac13d2edb0 100644 (file)
@@ -155,7 +155,14 @@ psppire_dialog_action_paired_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionPaired *act = PSPPIRE_DIALOG_ACTION_PAIRED (a);
 
-  GtkBuilder *xml = builder_new ("paired-samples.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("paired-samples.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   GtkWidget *selector = get_widget_assert (xml, "psppire-selector3");
   GtkWidget *bb = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
   GtkWidget *button = gtk_button_new_with_mnemonic (_("O_ptions..."));
@@ -192,8 +199,6 @@ psppire_dialog_action_paired_activate (GtkAction *a)
                                    select_as_pair_member,
                                    act);
   
-  g_object_unref (xml);
-
   if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_paired_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_paired_parent_class)->activate (pda);
 }
index eb7d7d20d1e88ad9b9d7bb3a371febe9325d3bae..c120fe260d7ca5579d5c19d125dd7822650ba3be 100644 (file)
@@ -212,7 +212,13 @@ psppire_dialog_action_rank_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionRank *act = PSPPIRE_DIALOG_ACTION_RANK (a);
 
-  GtkBuilder *xml = builder_new ("rank.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("rank.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
 
   GtkWidget *types_button = get_widget_assert (xml, "button1");
   GtkWidget *ties_button = get_widget_assert (xml, "button2");
@@ -293,8 +299,6 @@ psppire_dialog_action_rank_activate (GtkAction *a)
   psppire_dialog_action_set_refresh (pda, dialog_refresh);
 
   PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_rank_parent_class)->activate (pda);
-  
-  g_object_unref (xml);
 }
 
 static void
index 5a64162993231405f85a672d79df514638a93bc5..fd168c435057c401f0bf36410b285d3fdbfe5440 100644 (file)
@@ -147,7 +147,14 @@ psppire_dialog_action_regression_activate (GtkAction *a)
   PsppireDialogActionRegression *act = PSPPIRE_DIALOG_ACTION_REGRESSION (a);
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
 
-  GtkBuilder *xml = builder_new ("regression.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("regression.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   GtkWidget *stat_button = get_widget_assert (xml, "stat-button");
   GtkWidget *save_button = get_widget_assert (xml, "save-button");
 
@@ -162,8 +169,6 @@ psppire_dialog_action_regression_activate (GtkAction *a)
   act->pred_button = get_widget_assert (xml, "pred-button");
   act->resid_button = get_widget_assert (xml, "resid-button");
 
-  g_object_unref (xml);
-
   psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (act->stat_view),
                                  B_RG_STATS_DEFAULT,
                                  N_REGRESSION_STATS,
index e53ce23cf102c6ecb9dc7422cf375a5d1c138383..c3d035cfbdbedac621929a6825b11752fa3eeb56 100644 (file)
@@ -125,7 +125,15 @@ psppire_dialog_action_reliability_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionReliability *act = PSPPIRE_DIALOG_ACTION_RELIABILITY (a);
   GtkTreeModel *liststore ;
-  GtkBuilder *xml = builder_new ("reliability.ui");
+
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("reliability.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   pda->dialog = get_widget_assert   (xml, "reliability-dialog");
   pda->source = get_widget_assert   (xml, "dict-view");
 
@@ -159,8 +167,6 @@ psppire_dialog_action_reliability_activate (GtkAction *a)
 
   if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_reliability_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_reliability_parent_class)->activate (pda);
-
-  g_object_unref (xml);
 }
 
 static void
index 578ef747771b59fb2ee097552ad7c16de7b9936a..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);
 
index 8649fbbe6dd3c070aeefa3d2702daac8094a17a3..62d6b27754124db7c3118712ee6ea6b0b1bc325c 100644 (file)
@@ -133,7 +133,14 @@ psppire_dialog_action_runs_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionRuns *act = PSPPIRE_DIALOG_ACTION_RUNS (a);
 
-  GtkBuilder *xml = builder_new ("runs.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("runs.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   pda->dialog = get_widget_assert   (xml, "runs-dialog");
   pda->source = get_widget_assert   (xml, "dict-view");
 
@@ -144,12 +151,9 @@ psppire_dialog_action_runs_activate (GtkAction *a)
   act->cb[CB_CUSTOM] = get_widget_assert (xml, "checkbutton3");
   act->variables = get_widget_assert   (xml, "psppire-var-view1");
 
-
   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_runs_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_runs_parent_class)->activate (pda);
 }
index 64017df7c9935d6e9b9933176d04724c360d5827..3b89d443a37013327cbeeda0afe54893d2dcb900 100644 (file)
@@ -96,7 +96,13 @@ psppire_dialog_action_scatterplot_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionScatterplot *act = PSPPIRE_DIALOG_ACTION_SCATTERPLOT (a);
 
-  GtkBuilder *xml = builder_new ("scatterplot.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("scatterplot.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
 
   pda->dialog = get_widget_assert   (xml, "scatterplot-dialog");
   pda->source = get_widget_assert   (xml, "scatterplot-treeview1");
@@ -107,8 +113,6 @@ psppire_dialog_action_scatterplot_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_scatterplot_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_scatterplot_parent_class)->activate (pda);
 }
index 1c5a9e01847101148fe299bd5a22f48a5b841f5c..024a659de15992d725abdd16eccf07934d7a081e 100644 (file)
@@ -95,11 +95,18 @@ psppire_dialog_action_sort_activate (GtkAction *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_pointer (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);
@@ -109,8 +116,6 @@ psppire_dialog_action_sort_activate (GtkAction *a)
 
   if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_sort_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_sort_parent_class)->activate (pda);
-
-  g_object_unref (xml);
 }
 
 static void
index 0d00f06ea96135fc4fcea780d3d4767a30b29513..4bf486340df3348ad5ea1870c784b6f0f283766c 100644 (file)
@@ -108,7 +108,14 @@ psppire_dialog_action_tt1s_activate (GtkAction *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_pointer (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);
 }
index 74612d267a8aaeef642a6a89934a6f1494fc2c29..8cc0c00121101fff73e1aa103ec0301f29e9cc12 100644 (file)
@@ -174,7 +174,14 @@ psppire_dialog_action_two_sample_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionTwoSample *act = PSPPIRE_DIALOG_ACTION_TWO_SAMPLE (a);
 
-  GtkBuilder *xml = builder_new ("paired-samples.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("paired-samples.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   GtkWidget *selector = get_widget_assert (xml, "psppire-selector3");
 
   pda->dialog = get_widget_assert   (xml, "t-test-paired-samples-dialog");
@@ -222,8 +229,6 @@ psppire_dialog_action_two_sample_activate (GtkAction *a)
                                    select_as_pair_member,
                                    act);
   
-  g_object_unref (xml);
-
   if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_two_sample_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_two_sample_parent_class)->activate (pda);
 }
index 30b9526f728342d940c0f2b7250a484d500fa20c..664dd36e43b89218f8837e651169d58e690e1184 100644 (file)
@@ -88,7 +88,14 @@ psppire_dialog_action_univariate_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionUnivariate *act = PSPPIRE_DIALOG_ACTION_UNIVARIATE (a);
 
-  GtkBuilder *xml = builder_new ("univariate.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("univariate.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   pda->dialog = get_widget_assert   (xml, "univariate-dialog");
   pda->source = get_widget_assert   (xml, "dict-view");
 
@@ -98,8 +105,6 @@ psppire_dialog_action_univariate_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_univariate_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_univariate_parent_class)->activate (pda);
 }
index 4e2d8ea039cd8bd8623959aed52de07c44377b3c..b8336d224b9d95b1389175b00447611f2e6813d2 100644 (file)
@@ -169,7 +169,14 @@ psppire_dialog_action_var_info_activate (GtkAction *a)
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionVarInfo *act = PSPPIRE_DIALOG_ACTION_VAR_INFO (pda);
 
-  GtkBuilder *xml = builder_new ("variable-info.ui");
+  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
+  GtkBuilder *xml = g_hash_table_lookup (thing, a);
+  if (!xml)
+    {
+      xml = builder_new ("variable-info.ui");
+      g_hash_table_insert (thing, a, xml);
+    }
+
   act->output = psppire_output_view_new (
     GTK_LAYOUT (get_widget_assert (xml, "layout1")), NULL, NULL, NULL);
 
@@ -184,15 +191,12 @@ psppire_dialog_action_var_info_activate (GtkAction *a)
                     "changed", G_CALLBACK (populate_output),
                    act);
 
-
   g_signal_connect (pda->dialog, "response", G_CALLBACK (jump_to),
                    pda);
 
   psppire_dialog_action_set_valid_predicate (pda,
                                             treeview_item_selected);
 
-  g_object_unref (xml);
-
   if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_var_info_parent_class)->activate)
     PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_var_info_parent_class)->activate (pda);
 }
index 7c399175dd5b89ce2f39cdc65b12a3ad78d81840..a97421f7ea0bbfeddb40f307ae7ea118df76381e 100644 (file)
@@ -83,6 +83,46 @@ psppire_dialog_action_get_property (GObject    *object,
 }
 
 
+static void
+set_toplevel (PsppireDialogAction *act)
+{
+  if (act->toplevel)
+    return;
+
+  GSList *sl = gtk_ui_manager_get_toplevels (act->uim, GTK_UI_MANAGER_MENUBAR | GTK_UI_MANAGER_TOOLBAR);
+  g_return_if_fail (sl);
+  
+  act->toplevel = gtk_widget_get_toplevel (GTK_WIDGET (sl->data));
+  g_slist_free (sl);
+}
+
+static void
+on_destroy_dataset (GObject *w)
+{
+  GHashTable *t = g_object_get_data (w, "thing-table");
+  GSList *dl = g_object_get_data (w, "widget-list");
+  
+  g_slist_free_full (dl, (GDestroyNotify) gtk_widget_destroy);
+  g_hash_table_unref (t);
+}
+
+GHashTable *
+psppire_dialog_action_get_pointer (PsppireDialogAction *act)
+{
+  set_toplevel (act);
+  
+  GHashTable *thing = g_object_get_data (G_OBJECT (act->toplevel), "thing-table");
+  if (thing == NULL)
+    {
+      thing = g_hash_table_new_full (g_direct_hash, g_direct_equal, 0, g_object_unref);
+      g_object_set_data (G_OBJECT (act->toplevel), "thing-table", thing);
+      g_object_set_data (G_OBJECT (act->toplevel), "widget-list", NULL);
+      g_signal_connect (act->toplevel, "destroy", G_CALLBACK (on_destroy_dataset), NULL);
+    }
+
+  return thing;
+}
+
 static void
 psppire_dialog_action_activate (PsppireDialogAction *act)
 {
@@ -90,24 +130,28 @@ psppire_dialog_action_activate (PsppireDialogAction *act)
 
   PsppireDialogActionClass *class = PSPPIRE_DIALOG_ACTION_GET_CLASS (act);
 
-  GSList *sl = gtk_ui_manager_get_toplevels (act->uim, GTK_UI_MANAGER_MENUBAR | GTK_UI_MANAGER_TOOLBAR);
-  g_return_if_fail (sl);
+  gboolean first_time = ! act->toplevel;
 
-  act->toplevel = gtk_widget_get_toplevel (GTK_WIDGET (sl->data));
-  g_slist_free (sl);
+  set_toplevel (act);
 
   act->dict = PSPPIRE_DATA_WINDOW(act->toplevel)->dict;
   
   g_object_set (act->source, "model", act->dict, NULL);
-  
-  gtk_window_set_transient_for (GTK_WINDOW (act->dialog), GTK_WINDOW (act->toplevel));
 
+  GSList *wl = g_object_get_data (G_OBJECT (act->toplevel), "widget-list");
+  wl = g_slist_prepend (wl, act->dialog);
+  g_object_set_data (G_OBJECT (act->toplevel), "widget-list", wl);
+
+  gtk_window_set_transient_for (GTK_WINDOW (act->dialog), GTK_WINDOW (act->toplevel));
 
   if (GTK_ACTION_CLASS (psppire_dialog_action_parent_class)->activate)
     GTK_ACTION_CLASS (psppire_dialog_action_parent_class)->activate ( GTK_ACTION (act));
 
   gtk_widget_grab_focus (act->source);
 
+  if (first_time)
+    psppire_dialog_reload (PSPPIRE_DIALOG (act->dialog));
+
   response = psppire_dialog_run (PSPPIRE_DIALOG (act->dialog));
 
   if ( class->generate_syntax )
@@ -125,8 +169,6 @@ psppire_dialog_action_activate (PsppireDialogAction *act)
          break;
        }
     }
-
-  gtk_widget_destroy (act->dialog);
 }
 
 static void
index 071bfaeea5041cf611a9ed49f617fa2edac86efd..215d89a52ac6d5fee8cff77865f9c16828935bfb 100644 (file)
@@ -100,6 +100,7 @@ typedef void (*activation) (GtkAction *);
 
 void psppire_dialog_action_set_activation (gpointer class, activation a);
 
+GHashTable *psppire_dialog_action_get_pointer (PsppireDialogAction *act);
 
 
 
index 5726cc76a941df4f5751328a08fa41ea29794d59..aeecfee86e56ea37fd45d723ae2e2e3065944b40 100644 (file)
@@ -422,7 +422,7 @@ psppire_dialog_run (PsppireDialog *dialog)
 
   if (title == NULL)
     g_warning ("PsppireDialog %s has no title", gtk_widget_get_name (GTK_WIDGET (dialog)));
-  
+
   if ( dialog->contents_are_valid != NULL )
     gtk_container_foreach (GTK_CONTAINER (gtk_bin_get_child(GTK_BIN(dialog))),
                           connect_notify_signal,
@@ -431,11 +431,7 @@ psppire_dialog_run (PsppireDialog *dialog)
   dialog->loop = g_main_loop_new (NULL, FALSE);
 
   gtk_widget_show (GTK_WIDGET (dialog));
-
-  if ( dialog->contents_are_valid != NULL)
-    g_signal_emit (dialog, signals [VALIDITY_CHANGED], 0, FALSE);
-
-  g_signal_emit (dialog, signals [DIALOG_REFRESH], 0);
+  psppire_dialog_notify_change (dialog);
 
   g_main_loop_run (dialog->loop);