X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-1sks.c;h=b96a16f0aaaf938dd3c3f760e0b6921c1208c6c0;hb=6c9aa9259c46de52cc57493ccc80f40f3eef9b17;hp=f71de4d88fcf36c2f4e0a6c0dadbe0b53e4cf7ac;hpb=f9b848024070c889f4ff95a36d35081d05622f2a;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-1sks.c b/src/ui/gui/psppire-dialog-action-1sks.c index f71de4d88f..b96a16f0aa 100644 --- a/src/ui/gui/psppire-dialog-action-1sks.c +++ b/src/ui/gui/psppire-dialog-action-1sks.c @@ -52,7 +52,7 @@ append_fragment (GString *string, const gchar *dist, PsppireVarView *vv) static char * -generate_syntax (PsppireDialogAction *act) +generate_syntax (const PsppireDialogAction *act) { PsppireDialogAction1sks *rd = PSPPIRE_DIALOG_ACTION_1SKS (act); gchar *text; @@ -117,12 +117,19 @@ refresh (PsppireDialogAction *rd_) } static void -psppire_dialog_action_1sks_activate (GtkAction *a) +psppire_dialog_action_1sks_activate (PsppireDialogAction *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_hash_table (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); } @@ -145,9 +150,7 @@ psppire_dialog_action_1sks_activate (GtkAction *a) static void psppire_dialog_action_1sks_class_init (PsppireDialogAction1sksClass *class) { - GtkActionClass *action_class = GTK_ACTION_CLASS (class); - - action_class->activate = psppire_dialog_action_1sks_activate; + psppire_dialog_action_set_activation (class, psppire_dialog_action_1sks_activate); PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; }