X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-crosstabs.c;h=aa5c86cc85880f87dbcb1f90f146cfda995a91e5;hb=89cbb0a7f4f31bc826621ffff9138fc4743f2b11;hp=2bc07c6e4c75a4c9554a90e35e3374deb511dd75;hpb=f548196d5cc509d19ba0f7c67da513e9dd4f996d;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-crosstabs.c b/src/ui/gui/psppire-dialog-action-crosstabs.c index 2bc07c6e4c..aa5c86cc85 100644 --- a/src/ui/gui/psppire-dialog-action-crosstabs.c +++ b/src/ui/gui/psppire-dialog-action-crosstabs.c @@ -27,7 +27,7 @@ #include "psppire-dialog.h" #include "builder-wrapper.h" -#include "checkbox-treeview.h" +#include "psppire-checkbox-treeview.h" #include "psppire-dict.h" #include "libpspp/str.h" @@ -208,64 +208,65 @@ 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"); - - pda->dialog = get_widget_assert (xml, "crosstabs-dialog"); - pda->source = get_widget_assert (xml, "dict-treeview"); - - act->dest_rows = get_widget_assert (xml, "rows"); - act->dest_cols = get_widget_assert (xml, "cols"); - act->format_button = get_widget_assert (xml, "format-button"); - act->stat_button = get_widget_assert (xml, "stats-button"); - act->cell_button = get_widget_assert (xml, "cell-button"); - act->stat_view = get_widget_assert (xml, "stats-view"); - act->cell_view = get_widget_assert (xml, "cell-view"); - act->cell_dialog = get_widget_assert (xml, "cell-dialog"); - act->stat_dialog = get_widget_assert (xml, "stat-dialog"); - act->format_dialog = get_widget_assert (xml, "format-dialog"); - - act->avalue_button = get_widget_assert (xml, "ascending"); - act->table_button = get_widget_assert (xml, "print-tables"); - act->pivot_button = get_widget_assert (xml, "pivot"); + 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"); - g_object_unref (xml); + act->dest_rows = get_widget_assert (xml, "rows"); + act->dest_cols = get_widget_assert (xml, "cols"); + act->format_button = get_widget_assert (xml, "format-button"); + act->stat_button = get_widget_assert (xml, "stats-button"); + act->cell_button = get_widget_assert (xml, "cell-button"); + act->stat_view = get_widget_assert (xml, "stats-view"); + act->cell_view = get_widget_assert (xml, "cell-view"); + act->cell_dialog = get_widget_assert (xml, "cell-dialog"); + act->stat_dialog = get_widget_assert (xml, "stat-dialog"); + act->format_dialog = get_widget_assert (xml, "format-dialog"); - act->format_options_avalue = TRUE; - act->format_options_table = TRUE; - act->format_options_pivot = TRUE; + act->avalue_button = get_widget_assert (xml, "ascending"); + act->table_button = get_widget_assert (xml, "print-tables"); + act->pivot_button = get_widget_assert (xml, "pivot"); - put_checkbox_items_in_treeview (GTK_TREE_VIEW (act->cell_view), - B_CS_CELL_DEFAULT, - N_CROSSTABS_CELLS, - cells - ); + act->format_options_avalue = TRUE; + act->format_options_table = TRUE; + act->format_options_pivot = TRUE; - act->cell = gtk_tree_view_get_model (GTK_TREE_VIEW (act->cell_view)); + psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (act->cell_view), + B_CS_CELL_DEFAULT, + N_CROSSTABS_CELLS, + cells); - put_checkbox_items_in_treeview (GTK_TREE_VIEW (act->stat_view), - B_CS_STATS_DEFAULT, - N_CROSSTABS_STATS, - stats - ); + act->cell = gtk_tree_view_get_model (GTK_TREE_VIEW (act->cell_view)); - act->stat = gtk_tree_view_get_model (GTK_TREE_VIEW (act->stat_view)); + psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (act->stat_view), + B_CS_STATS_DEFAULT, + N_CROSSTABS_STATS, + stats); - psppire_dialog_action_set_refresh (pda, refresh); + act->stat = gtk_tree_view_get_model (GTK_TREE_VIEW (act->stat_view)); - psppire_dialog_action_set_valid_predicate (pda, - dialog_state_valid); + psppire_dialog_action_set_refresh (pda, refresh); - g_signal_connect_swapped (act->cell_button, "clicked", - G_CALLBACK (on_cell_clicked), act); + psppire_dialog_action_set_valid_predicate (pda, + dialog_state_valid); - g_signal_connect_swapped (act->stat_button, "clicked", - G_CALLBACK (on_statistics_clicked), act); + g_signal_connect_swapped (act->cell_button, "clicked", + G_CALLBACK (on_cell_clicked), act); - g_signal_connect_swapped (act->format_button, "clicked", - G_CALLBACK (on_format_clicked), act); + g_signal_connect_swapped (act->stat_button, "clicked", + G_CALLBACK (on_statistics_clicked), act); + g_signal_connect_swapped (act->format_button, "clicked", + G_CALLBACK (on_format_clicked), act); + } + if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_crosstabs_parent_class)->activate) PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_crosstabs_parent_class)->activate (pda); } @@ -380,10 +381,7 @@ generate_syntax (PsppireDialogAction *a) static void psppire_dialog_action_crosstabs_class_init (PsppireDialogActionCrosstabsClass *class) { - GtkActionClass *action_class = GTK_ACTION_CLASS (class); - - action_class->activate = psppire_dialog_action_crosstabs_activate; - + psppire_dialog_action_set_activation (class, psppire_dialog_action_crosstabs_activate); PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; }