X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-barchart.c;h=813e92be0f811a274119e687b465691160b7ad35;hb=5539849055ad928f536d192561cbbaab3b926180;hp=87b8fa1318036904d3afd0853a00dfffb8445aad;hpb=612b51515e356bc4dd625a3fb18d0a4f827a1e2c;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-barchart.c b/src/ui/gui/psppire-dialog-action-barchart.c index 87b8fa1318..813e92be0f 100644 --- a/src/ui/gui/psppire-dialog-action-barchart.c +++ b/src/ui/gui/psppire-dialog-action-barchart.c @@ -115,45 +115,50 @@ populate_combo_model (GtkComboBox *cb) static void -psppire_dialog_action_barchart_activate (GtkAction *a) +psppire_dialog_action_barchart_activate (PsppireDialogAction *a) { PsppireDialogActionBarchart *act = PSPPIRE_DIALOG_ACTION_BARCHART (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - GtkBuilder *xml = builder_new ("barchart.ui"); - pda->dialog = get_widget_assert (xml, "barchart-dialog"); - pda->source = get_widget_assert (xml, "dict-view"); - - act->variable_xaxis = get_widget_assert (xml, "entry1"); - act->variable_cluster = get_widget_assert (xml, "entry3"); - act->var = get_widget_assert (xml, "entry2"); - act->button_freq_func[0] = get_widget_assert (xml, "radiobutton-count"); - act->button_freq_func[1] = get_widget_assert (xml, "radiobutton-percent"); - act->button_freq_func[2] = get_widget_assert (xml, "radiobutton-cum-count"); - act->button_freq_func[3] = get_widget_assert (xml, "radiobutton-cum-percent"); + GHashTable *thing = psppire_dialog_action_get_hash_table (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"); + + act->variable_xaxis = get_widget_assert (xml, "entry1"); + act->variable_cluster = get_widget_assert (xml, "entry3"); + act->var = get_widget_assert (xml, "entry2"); + act->button_freq_func[0] = get_widget_assert (xml, "radiobutton-count"); + act->button_freq_func[1] = get_widget_assert (xml, "radiobutton-percent"); + act->button_freq_func[2] = get_widget_assert (xml, "radiobutton-cum-count"); + act->button_freq_func[3] = get_widget_assert (xml, "radiobutton-cum-percent"); - act->button_summary_func = get_widget_assert (xml, "radiobutton3"); - act->summary_variables = get_widget_assert (xml, "hbox1"); - act->combobox = get_widget_assert (xml, "combobox1"); + act->button_summary_func = get_widget_assert (xml, "radiobutton3"); + act->summary_variables = get_widget_assert (xml, "hbox1"); + act->combobox = get_widget_assert (xml, "combobox1"); - populate_combo_model (GTK_COMBO_BOX(act->combobox)); + 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); + 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_refresh (pda, refresh); - psppire_dialog_action_set_valid_predicate (pda, - dialog_state_valid); + psppire_dialog_action_set_valid_predicate (pda, + 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); } static char * -generate_syntax (PsppireDialogAction *a) +generate_syntax (const PsppireDialogAction *a) { PsppireDialogActionBarchart *rd = PSPPIRE_DIALOG_ACTION_BARCHART (a); gchar *text;