Fix compiler warnings
[pspp] / src / ui / gui / psppire-dialog-action-histogram.c
index 5a57c2aece6fc46798794968305c8ada474136a8..3cf1fe77bc9ae4933ea884295c5368ed926ad724 100644 (file)
@@ -14,7 +14,6 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
-
 #include <config.h>
 
 #include "psppire-dialog-action-histogram.h"
@@ -65,15 +64,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_hash_table (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,
@@ -113,9 +117,7 @@ generate_syntax (PsppireDialogAction *a)
 static void
 psppire_dialog_action_histogram_class_init (PsppireDialogActionHistogramClass *class)
 {
-  GtkActionClass *action_class = GTK_ACTION_CLASS (class);
-
-  action_class->activate = psppire_dialog_action_histogram_activate;
+  psppire_dialog_action_set_activation (class, psppire_dialog_action_histogram_activate);
 
   PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
 }