X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-var-info.c;h=21f9f0439ce52e8292ff2ea49eedc2198f572a2b;hb=0cd7c010e3e5c316ef0eb0317fb7f408d164679d;hp=d6b974f6877975b9a2952cd93d76e3b38d67b552;hpb=491cd3744c11da45ac6e41c734e4a33c19b060c9;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-var-info.c b/src/ui/gui/psppire-dialog-action-var-info.c index d6b974f687..21f9f0439c 100644 --- a/src/ui/gui/psppire-dialog-action-var-info.c +++ b/src/ui/gui/psppire-dialog-action-var-info.c @@ -56,7 +56,7 @@ treeview_item_selected (gpointer data) } static gchar * -generate_syntax__ (PsppireDialogAction *act, const char *prefix) +generate_syntax__ (const PsppireDialogAction *act, const char *prefix) { struct variable **vars; size_t n_vars; @@ -101,7 +101,7 @@ generate_syntax__ (PsppireDialogAction *act, const char *prefix) } static gchar * -generate_syntax (PsppireDialogAction *act) +generate_syntax (const PsppireDialogAction *act) { return generate_syntax__ (act, ""); } @@ -164,12 +164,19 @@ jump_to (PsppireDialog *d, gint response, gpointer data) } static void -psppire_dialog_action_var_info_activate (GtkAction *a) +psppire_dialog_action_var_info_activate (PsppireDialogAction *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_hash_table (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); } @@ -200,9 +204,7 @@ psppire_dialog_action_var_info_activate (GtkAction *a) static void psppire_dialog_action_var_info_class_init (PsppireDialogActionVarInfoClass *class) { - GtkActionClass *action_class = GTK_ACTION_CLASS (class); - - action_class->activate = psppire_dialog_action_var_info_activate; + psppire_dialog_action_set_activation (class, psppire_dialog_action_var_info_activate); PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; }