From e5ed663e9f1998c1c2409a668288d4e5d496beda Mon Sep 17 00:00:00 2001 From: John Darrington Date: Fri, 2 Jun 2017 10:12:15 +0200 Subject: [PATCH] Use a more reliable way of setting the initial state of PsppireDialogAction objects. --- src/ui/gui/builder-wrapper.c | 18 --- src/ui/gui/builder-wrapper.h | 3 - src/ui/gui/psppire-dialog-action-1sks.c | 16 +- src/ui/gui/psppire-dialog-action-aggregate.c | 146 ++++++++--------- src/ui/gui/psppire-dialog-action-autorecode.c | 81 +++++----- src/ui/gui/psppire-dialog-action-barchart.c | 51 +++--- src/ui/gui/psppire-dialog-action-binomial.c | 18 +-- src/ui/gui/psppire-dialog-action-chisquare.c | 16 +- src/ui/gui/psppire-dialog-action-comments.c | 124 +++++++------- src/ui/gui/psppire-dialog-action-compute.c | 94 +++++------ .../gui/psppire-dialog-action-correlation.c | 15 +- src/ui/gui/psppire-dialog-action-count.c | 15 +- src/ui/gui/psppire-dialog-action-crosstabs.c | 90 +++++------ .../gui/psppire-dialog-action-descriptives.c | 28 ++-- src/ui/gui/psppire-dialog-action-examine.c | 36 ++--- src/ui/gui/psppire-dialog-action-factor.c | 95 +++++------ src/ui/gui/psppire-dialog-action-flip.c | 17 +- .../gui/psppire-dialog-action-frequencies.c | 139 ++++++++-------- src/ui/gui/psppire-dialog-action-histogram.c | 15 +- .../gui/psppire-dialog-action-indep-samps.c | 16 +- .../gui/psppire-dialog-action-k-independent.c | 46 +++--- src/ui/gui/psppire-dialog-action-k-related.c | 15 +- src/ui/gui/psppire-dialog-action-kmeans.c | 17 +- src/ui/gui/psppire-dialog-action-logistic.c | 15 +- src/ui/gui/psppire-dialog-action-means.c | 26 ++- src/ui/gui/psppire-dialog-action-oneway.c | 18 +-- src/ui/gui/psppire-dialog-action-paired.c | 62 ++++--- src/ui/gui/psppire-dialog-action-rank.c | 16 +- .../psppire-dialog-action-recode-different.c | 10 +- .../gui/psppire-dialog-action-recode-same.c | 10 +- src/ui/gui/psppire-dialog-action-recode.c | 152 +++++++++--------- src/ui/gui/psppire-dialog-action-recode.h | 3 +- src/ui/gui/psppire-dialog-action-regression.c | 18 +-- .../gui/psppire-dialog-action-reliability.c | 16 +- src/ui/gui/psppire-dialog-action-roc.c | 17 +- src/ui/gui/psppire-dialog-action-runs.c | 16 +- .../gui/psppire-dialog-action-scatterplot.c | 17 +- src/ui/gui/psppire-dialog-action-select.c | 136 ++++++++-------- src/ui/gui/psppire-dialog-action-sort.c | 18 +-- src/ui/gui/psppire-dialog-action-split.c | 39 ++--- src/ui/gui/psppire-dialog-action-tt1s.c | 17 +- src/ui/gui/psppire-dialog-action-two-sample.c | 48 +++--- src/ui/gui/psppire-dialog-action-univariate.c | 16 +- src/ui/gui/psppire-dialog-action-var-info.c | 46 +++--- src/ui/gui/psppire-dialog-action-weight.c | 48 +++--- src/ui/gui/psppire-dialog-action.c | 39 +++-- src/ui/gui/psppire-dialog-action.h | 7 +- 47 files changed, 838 insertions(+), 1083 deletions(-) diff --git a/src/ui/gui/builder-wrapper.c b/src/ui/gui/builder-wrapper.c index 94b1b365de..0750158e34 100644 --- a/src/ui/gui/builder-wrapper.c +++ b/src/ui/gui/builder-wrapper.c @@ -36,24 +36,6 @@ builder_new_real (const gchar *name) return builder; } - -GtkBuilder * -builder_new_x (const gchar *obj_name) -{ - GtkBuilder *b; - GString *str = g_string_new (PKGDATADIR); - g_string_append (str, "/"); - g_string_append (str, obj_name); - - b = builder_new_real (relocate (str->str)); - - g_string_free (str, TRUE); - - return b; -} - - - GObject * get_object_assert (GtkBuilder *builder, const gchar *name, GType type) { diff --git a/src/ui/gui/builder-wrapper.h b/src/ui/gui/builder-wrapper.h index 43c3204e18..db45168f32 100644 --- a/src/ui/gui/builder-wrapper.h +++ b/src/ui/gui/builder-wrapper.h @@ -23,11 +23,8 @@ #include "relocatable.h" #include "gl/configmake.h" - GtkBuilder *builder_new_real (const gchar *name); -GtkBuilder * builder_new_x (const gchar *obj_name); - #define builder_new(NAME) (builder_new_real (relocate (PKGDATADIR "/" NAME))) GObject *get_object_assert (GtkBuilder *builder, const gchar *name, GType type); diff --git a/src/ui/gui/psppire-dialog-action-1sks.c b/src/ui/gui/psppire-dialog-action-1sks.c index 7f31ebac47..3814c7dccf 100644 --- a/src/ui/gui/psppire-dialog-action-1sks.c +++ b/src/ui/gui/psppire-dialog-action-1sks.c @@ -116,19 +116,13 @@ refresh (PsppireDialogAction *rd_) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd->cb[i]), FALSE); } -static void -psppire_dialog_action_1sks_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_1sks_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogAction1sks *act = PSPPIRE_DIALOG_ACTION_1SKS (a); - 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); - } + GtkBuilder *xml = builder_new ( "ks-one-sample.ui"); pda->dialog = get_widget_assert (xml, "ks-one-sample-dialog"); pda->source = get_widget_assert (xml, "dict-view"); @@ -142,13 +136,13 @@ psppire_dialog_action_1sks_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); - + return xml; } static void psppire_dialog_action_1sks_class_init (PsppireDialogAction1sksClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_1sks_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_1sks_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-aggregate.c b/src/ui/gui/psppire-dialog-action-aggregate.c index ac667ef822..057b6926fd 100644 --- a/src/ui/gui/psppire-dialog-action-aggregate.c +++ b/src/ui/gui/psppire-dialog-action-aggregate.c @@ -482,124 +482,116 @@ update_arguments (PsppireDialogActionAggregate *agg) -static void -psppire_dialog_action_aggregate_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_aggregate_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionAggregate *act = PSPPIRE_DIALOG_ACTION_AGGREGATE (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("aggregate.ui"); - g_hash_table_insert (thing, a, xml); - - - pda->dialog = get_widget_assert (xml, "aggregate-dialog"); - pda->source = get_widget_assert (xml, "dict-view"); - + GtkBuilder *xml = builder_new ("aggregate.ui"); + pda->dialog = get_widget_assert (xml, "aggregate-dialog"); + pda->source = get_widget_assert (xml, "dict-view"); - GtkWidget *break_selector = get_widget_assert (xml, "break-selector"); + GtkWidget *break_selector = get_widget_assert (xml, "break-selector"); - act->pane = get_widget_assert (xml, "hbox1"); + act->pane = get_widget_assert (xml, "hbox1"); - act->break_variables = get_widget_assert (xml, "psppire-var-view1"); - act->filename_radiobutton = get_widget_assert (xml, "filename-radiobutton"); - act->filename_button = get_widget_assert (xml, "filename-button"); - act->filename_box = get_widget_assert (xml, "filename-box"); - act->filename_label = get_widget_assert (xml, "filename-label"); - act->replace_radiobutton = get_widget_assert (xml, "replace-radiobutton"); - act->add_radiobutton = get_widget_assert (xml, "add-radiobutton"); - act->function_combo = get_widget_assert (xml, "function-combo"); + act->break_variables = get_widget_assert (xml, "psppire-var-view1"); + act->filename_radiobutton = get_widget_assert (xml, "filename-radiobutton"); + act->filename_button = get_widget_assert (xml, "filename-button"); + act->filename_box = get_widget_assert (xml, "filename-box"); + act->filename_label = get_widget_assert (xml, "filename-label"); + act->replace_radiobutton = get_widget_assert (xml, "replace-radiobutton"); + act->add_radiobutton = get_widget_assert (xml, "add-radiobutton"); + act->function_combo = get_widget_assert (xml, "function-combo"); - act->summary_acr = get_widget_assert (xml, "psppire-acr1"); - act->summary_var_name_entry = get_widget_assert (xml, "summary-var-name-entry"); + act->summary_acr = get_widget_assert (xml, "psppire-acr1"); + act->summary_var_name_entry = get_widget_assert (xml, "summary-var-name-entry"); - act->summary_arg1 = get_widget_assert (xml, "summary-arg1"); - act->summary_arg2 = get_widget_assert (xml, "summary-arg2"); + act->summary_arg1 = get_widget_assert (xml, "summary-arg1"); + act->summary_arg2 = get_widget_assert (xml, "summary-arg2"); - act->summary_arg1_entry = get_widget_assert (xml, "summary-arg-entry1"); - act->summary_arg2_entry = get_widget_assert (xml, "summary-arg-entry2"); + act->summary_arg1_entry = get_widget_assert (xml, "summary-arg-entry1"); + act->summary_arg2_entry = get_widget_assert (xml, "summary-arg-entry2"); - act->summary_var_label_entry = get_widget_assert (xml, "summary-var-label-entry"); + act->summary_var_label_entry = get_widget_assert (xml, "summary-var-label-entry"); - act->summary_sv = get_widget_assert (xml, "source-var"); - act->summary_sv_entry = get_widget_assert (xml, "source-var-entry"); + act->summary_sv = get_widget_assert (xml, "source-var"); + act->summary_sv_entry = get_widget_assert (xml, "source-var-entry"); - act->sorted_button = get_widget_assert (xml, "sorted-radiobutton"); - act->needs_sort_button = get_widget_assert (xml, "needs-sort-radiobutton"); + act->sorted_button = get_widget_assert (xml, "sorted-radiobutton"); + act->needs_sort_button = get_widget_assert (xml, "needs-sort-radiobutton"); - { - GtkTreeViewColumn *column ; + { + GtkTreeViewColumn *column ; - GList *l ; + GList *l ; - GtkCellRenderer *cell_renderer ; + GtkCellRenderer *cell_renderer ; - GtkListStore *list = gtk_list_store_new (6, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_INT, - G_TYPE_STRING, - G_TYPE_DOUBLE, - G_TYPE_DOUBLE); + GtkListStore *list = gtk_list_store_new (6, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_INT, + G_TYPE_STRING, + G_TYPE_DOUBLE, + G_TYPE_DOUBLE); - psppire_acr_set_model (PSPPIRE_ACR (act->summary_acr), list); - g_object_unref (list); + psppire_acr_set_model (PSPPIRE_ACR (act->summary_acr), list); + g_object_unref (list); - psppire_acr_set_get_value_func (PSPPIRE_ACR (act->summary_acr), - get_summary_spec, act); + psppire_acr_set_get_value_func (PSPPIRE_ACR (act->summary_acr), + get_summary_spec, act); - column = gtk_tree_view_get_column (PSPPIRE_ACR (act->summary_acr)->tv, 0); + column = gtk_tree_view_get_column (PSPPIRE_ACR (act->summary_acr)->tv, 0); - l = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); + l = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column)); - cell_renderer = l->data; + cell_renderer = l->data; - gtk_tree_view_column_set_cell_data_func (column, - cell_renderer, - render_summary, - act, - NULL); + gtk_tree_view_column_set_cell_data_func (column, + cell_renderer, + render_summary, + act, + NULL); - g_signal_connect_swapped (PSPPIRE_ACR (act->summary_acr)->tv, - "cursor-changed", G_CALLBACK (on_acr_change), act); - } + g_signal_connect_swapped (PSPPIRE_ACR (act->summary_acr)->tv, + "cursor-changed", G_CALLBACK (on_acr_change), act); + } - g_signal_connect_swapped (act->summary_var_name_entry, "changed", G_CALLBACK (update_acr), act); - g_signal_connect_swapped (act->function_combo, "changed", G_CALLBACK (update_acr), act); - g_signal_connect_swapped (act->summary_sv_entry, "changed", G_CALLBACK (update_acr), act); - g_signal_connect_swapped (act->summary_arg1_entry, "changed", G_CALLBACK (update_acr), act); - g_signal_connect_swapped (act->summary_arg2_entry, "changed", G_CALLBACK (update_acr), act); + g_signal_connect_swapped (act->summary_var_name_entry, "changed", G_CALLBACK (update_acr), act); + g_signal_connect_swapped (act->function_combo, "changed", G_CALLBACK (update_acr), act); + g_signal_connect_swapped (act->summary_sv_entry, "changed", G_CALLBACK (update_acr), act); + g_signal_connect_swapped (act->summary_arg1_entry, "changed", G_CALLBACK (update_acr), act); + g_signal_connect_swapped (act->summary_arg2_entry, "changed", G_CALLBACK (update_acr), act); - g_signal_connect_swapped (act->function_combo, "changed", - G_CALLBACK (update_arguments), act); + g_signal_connect_swapped (act->function_combo, "changed", + G_CALLBACK (update_arguments), act); - populate_combo_model (GTK_COMBO_BOX (act->function_combo)); + populate_combo_model (GTK_COMBO_BOX (act->function_combo)); - psppire_selector_set_filter_func (PSPPIRE_SELECTOR (break_selector), NULL); + psppire_selector_set_filter_func (PSPPIRE_SELECTOR (break_selector), NULL); - g_signal_connect (act->filename_radiobutton, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), act->filename_box ); + g_signal_connect (act->filename_radiobutton, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), act->filename_box ); - g_signal_connect_swapped (act->filename_button, "clicked", - G_CALLBACK (choose_filename), act); + g_signal_connect_swapped (act->filename_button, "clicked", + G_CALLBACK (choose_filename), act); - psppire_dialog_action_set_refresh (pda, refresh); - psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); - } + psppire_dialog_action_set_refresh (pda, refresh); + psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); + return xml; } static void psppire_dialog_action_aggregate_class_init (PsppireDialogActionAggregateClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_aggregate_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_aggregate_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-autorecode.c b/src/ui/gui/psppire-dialog-action-autorecode.c index ad36dd0bc4..ef3d4d77db 100644 --- a/src/ui/gui/psppire-dialog-action-autorecode.c +++ b/src/ui/gui/psppire-dialog-action-autorecode.c @@ -308,84 +308,75 @@ render_new_var_name (GtkTreeViewColumn *tree_column, } -static void -psppire_dialog_action_autorecode_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_autorecode_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionAutorecode *act = PSPPIRE_DIALOG_ACTION_AUTORECODE (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("autorecode.ui"); - g_hash_table_insert (thing, a, xml); - - pda->dialog = get_widget_assert (xml, "autorecode-dialog"); - pda->source = get_widget_assert (xml, "dict-view"); - - + GtkBuilder *xml = builder_new ("autorecode.ui"); + pda->dialog = get_widget_assert (xml, "autorecode-dialog"); + pda->source = get_widget_assert (xml, "dict-view"); - act->var_view = get_widget_assert (xml, "var-view"); + act->var_view = get_widget_assert (xml, "var-view"); - act->new_name_entry = get_widget_assert (xml, "entry1"); - act->change_button = get_widget_assert (xml, "button1"); - act->ascending = get_widget_assert (xml, "radiobutton1"); - act->group = get_widget_assert (xml, "checkbutton1"); - act->blank = get_widget_assert (xml, "checkbutton2"); + act->new_name_entry = get_widget_assert (xml, "entry1"); + act->change_button = get_widget_assert (xml, "button1"); + act->ascending = get_widget_assert (xml, "radiobutton1"); + act->group = get_widget_assert (xml, "checkbutton1"); + act->blank = get_widget_assert (xml, "checkbutton2"); - { - GtkTreeSelection *sel; - - GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); + { + GtkTreeSelection *sel; - GtkTreeViewColumn *col = gtk_tree_view_column_new_with_attributes (_("New"), - renderer, - "text", NULL, - NULL); + GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); - gtk_tree_view_column_set_cell_data_func (col, renderer, - render_new_var_name, - act, NULL); + GtkTreeViewColumn *col = gtk_tree_view_column_new_with_attributes (_("New"), + renderer, + "text", NULL, + NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (act->var_view), col); + gtk_tree_view_column_set_cell_data_func (col, renderer, + render_new_var_name, + act, NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (act->var_view), col); - col = gtk_tree_view_get_column (GTK_TREE_VIEW (act->var_view), 0); - g_object_set (col, "title", _("Old"), NULL); + col = gtk_tree_view_get_column (GTK_TREE_VIEW (act->var_view), 0); - g_object_set (act->var_view, "headers-visible", TRUE, NULL); + g_object_set (col, "title", _("Old"), NULL); - act->varmap = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, nlp_destroy); + g_object_set (act->var_view, "headers-visible", TRUE, NULL); + act->varmap = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, nlp_destroy); - sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (act->var_view)); + sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (act->var_view)); - g_signal_connect (sel, "changed", - G_CALLBACK (on_selection_change), act); - g_signal_connect (act->change_button, "clicked", - G_CALLBACK (on_change_clicked), act); + g_signal_connect (sel, "changed", + G_CALLBACK (on_selection_change), act); - g_signal_connect_swapped (act->new_name_entry, "changed", - G_CALLBACK (on_entry_change), act); + g_signal_connect (act->change_button, "clicked", + G_CALLBACK (on_change_clicked), act); - } + g_signal_connect_swapped (act->new_name_entry, "changed", + G_CALLBACK (on_entry_change), act); - } + } psppire_dialog_action_set_refresh (pda, refresh); psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); + return xml; } static void psppire_dialog_action_autorecode_class_init (PsppireDialogActionAutorecodeClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_autorecode_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_autorecode_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-barchart.c b/src/ui/gui/psppire-dialog-action-barchart.c index adbd8b956b..900188fcbf 100644 --- a/src/ui/gui/psppire-dialog-action-barchart.c +++ b/src/ui/gui/psppire-dialog-action-barchart.c @@ -114,45 +114,40 @@ populate_combo_model (GtkComboBox *cb) } -static void -psppire_dialog_action_barchart_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_barchart_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionBarchart *act = PSPPIRE_DIALOG_ACTION_BARCHART (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - 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); + GtkBuilder *xml = builder_new ( "barchart.ui"); - pda->dialog = get_widget_assert (xml, "barchart-dialog"); - pda->source = get_widget_assert (xml, "dict-view"); + 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->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_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); + return xml; } static char * @@ -229,7 +224,7 @@ generate_syntax (const PsppireDialogAction *a) static void psppire_dialog_action_barchart_class_init (PsppireDialogActionBarchartClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_barchart_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_barchart_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-binomial.c b/src/ui/gui/psppire-dialog-action-binomial.c index 6ca3905c3a..0a9f171f24 100644 --- a/src/ui/gui/psppire-dialog-action-binomial.c +++ b/src/ui/gui/psppire-dialog-action-binomial.c @@ -96,19 +96,13 @@ refresh (PsppireDialogAction *da) } -static void -psppire_dialog_action_binomial_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_binomial_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionBinomial *act = PSPPIRE_DIALOG_ACTION_BINOMIAL (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("binomial.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ( "binomial.ui"); pda->dialog = get_widget_assert (xml, "binomial-dialog"); pda->source = get_widget_assert (xml, "dict-view"); @@ -126,8 +120,8 @@ psppire_dialog_action_binomial_activate (PsppireDialogAction *a) psppire_dialog_action_set_refresh (pda, refresh); psppire_dialog_action_set_valid_predicate (pda, - dialog_state_valid); - + dialog_state_valid); + return xml; } @@ -168,7 +162,7 @@ generate_syntax (const PsppireDialogAction *a) static void psppire_dialog_action_binomial_class_init (PsppireDialogActionBinomialClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_binomial_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_binomial_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-chisquare.c b/src/ui/gui/psppire-dialog-action-chisquare.c index a8dc856b77..57f8250078 100644 --- a/src/ui/gui/psppire-dialog-action-chisquare.c +++ b/src/ui/gui/psppire-dialog-action-chisquare.c @@ -128,19 +128,13 @@ refresh (PsppireDialogAction *rd_) gtk_entry_set_text (GTK_ENTRY (csd->value_upper), ""); } -static void -psppire_dialog_action_chisquare_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_chisquare_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionChisquare *act = PSPPIRE_DIALOG_ACTION_CHISQUARE (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("chi-square.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ( "chi-square.ui"); GtkWidget *range_table = get_widget_assert (xml, "range-table"); GtkWidget *values_acr = get_widget_assert (xml, "psppire-acr1"); @@ -183,13 +177,13 @@ psppire_dialog_action_chisquare_activate (PsppireDialogAction *a) psppire_acr_set_model(PSPPIRE_ACR (values_acr), act->expected_list); - + return xml; } static void psppire_dialog_action_chisquare_class_init (PsppireDialogActionChisquareClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_chisquare_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_chisquare_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-comments.c b/src/ui/gui/psppire-dialog-action-comments.c index dcbe4ddaca..ca7ad41bfa 100644 --- a/src/ui/gui/psppire-dialog-action-comments.c +++ b/src/ui/gui/psppire-dialog-action-comments.c @@ -167,100 +167,94 @@ wrap_line (GtkTextBuffer *buffer, } -static void -psppire_dialog_action_comments_activate (PsppireDialogAction *pda) +static GtkBuilder * +psppire_dialog_action_comments_activate (PsppireDialogAction *pda, GVariant *param) { PsppireDialogActionComments *act = PSPPIRE_DIALOG_ACTION_COMMENTS (pda); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, pda); - if (!xml) - { - GtkTextIter iter; + GtkBuilder *xml = builder_new ( "comments.ui"); - xml = builder_new ("comments.ui"); - g_hash_table_insert (thing, pda, xml); + pda->dialog = get_widget_assert (xml, "comments-dialog"); + act->textview = get_widget_assert (xml, "comments-textview1"); + GtkWidget *label = get_widget_assert (xml, "column-number-label"); + GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (act->textview)); + act->check = get_widget_assert (xml, "comments-checkbutton1"); - pda->dialog = get_widget_assert (xml, "comments-dialog"); - act->textview = get_widget_assert (xml, "comments-textview1"); - GtkWidget *label = get_widget_assert (xml, "column-number-label"); - GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (act->textview)); - act->check = get_widget_assert (xml, "comments-checkbutton1"); + g_signal_connect_swapped (pda->dialog, "show", G_CALLBACK (retrieve_comments), pda); - g_signal_connect_swapped (pda->dialog, "show", G_CALLBACK (retrieve_comments), pda); + { + PangoContext * context ; + PangoLayout * layout ; + PangoRectangle rect; - { - PangoContext * context ; - PangoLayout * layout ; - PangoRectangle rect; + /* Since we're going to truncate lines to 80 chars, + we need a monospaced font otherwise it'll look silly */ + PangoFontDescription *font_desc = + pango_font_description_from_string ("monospace"); + { + GtkStyleContext *style = gtk_widget_get_style_context (GTK_WIDGET (act->textview)); + GtkCssProvider *cssp = gtk_css_provider_new (); + + gchar *str = pango_font_description_to_string (font_desc); + gchar *css = + g_strdup_printf ("* {font: %s}", str); + g_free (str); - /* Since we're going to truncate lines to 80 chars, - we need a monospaced font otherwise it'll look silly */ - PangoFontDescription *font_desc = - pango_font_description_from_string ("monospace"); + GError *err = NULL; + gtk_css_provider_load_from_data (cssp, css, -1, &err); + if (err) { - GtkStyleContext *style = gtk_widget_get_style_context (GTK_WIDGET (act->textview)); - GtkCssProvider *cssp = gtk_css_provider_new (); - - gchar *str = pango_font_description_to_string (font_desc); - gchar *css = - g_strdup_printf ("* {font: %s}", str); - g_free (str); - - GError *err = NULL; - gtk_css_provider_load_from_data (cssp, css, -1, &err); - if (err) - { - g_warning ("Failed to load font css \"%s\": %s", css, err->message); - g_error_free (err); - } - g_free (css); - - gtk_style_context_add_provider (style, - GTK_STYLE_PROVIDER (cssp), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - g_object_unref (cssp); + g_warning ("Failed to load font css \"%s\": %s", css, err->message); + g_error_free (err); } + g_free (css); - /* And let's just make sure that a complete line fits into the - widget's width */ - context = gtk_widget_create_pango_context (act->textview); - layout = pango_layout_new (context); + gtk_style_context_add_provider (style, + GTK_STYLE_PROVIDER (cssp), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + g_object_unref (cssp); + } - pango_layout_set_text (layout, "M", 1); + /* And let's just make sure that a complete line fits into the + widget's width */ + context = gtk_widget_create_pango_context (act->textview); + layout = pango_layout_new (context); - pango_layout_set_font_description (layout, font_desc); + pango_layout_set_text (layout, "M", 1); - pango_layout_get_extents (layout, NULL, &rect); + pango_layout_set_font_description (layout, font_desc); - g_object_set (act->textview, "width-request", - PANGO_PIXELS (rect.width) * DOC_LINE_LENGTH + 20, NULL); + pango_layout_get_extents (layout, NULL, &rect); - g_object_unref (G_OBJECT (layout)); - g_object_unref (G_OBJECT (context)); + g_object_set (act->textview, "width-request", + PANGO_PIXELS (rect.width) * DOC_LINE_LENGTH + 20, NULL); - pango_font_description_free (font_desc); - } + g_object_unref (G_OBJECT (layout)); + g_object_unref (G_OBJECT (context)); - g_signal_connect (buffer, "mark-set", - G_CALLBACK (set_column_number), label); + pango_font_description_free (font_desc); + } + GtkTextIter iter; + g_signal_connect (buffer, "mark-set", + G_CALLBACK (set_column_number), label); - g_signal_connect_after (buffer, "insert-text", - G_CALLBACK (wrap_line), NULL); + g_signal_connect_after (buffer, "insert-text", + G_CALLBACK (wrap_line), NULL); - gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0); - gtk_text_buffer_place_cursor (buffer, &iter); - } + gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0); + gtk_text_buffer_place_cursor (buffer, &iter); psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); + + return xml; } static void psppire_dialog_action_comments_class_init (PsppireDialogActionCommentsClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_comments_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_comments_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-compute.c b/src/ui/gui/psppire-dialog-action-compute.c index 18292cec93..2a9b689065 100644 --- a/src/ui/gui/psppire-dialog-action-compute.c +++ b/src/ui/gui/psppire-dialog-action-compute.c @@ -454,85 +454,79 @@ insert_function_into_syntax_area (GtkTreeIter iter, } - -static void -psppire_dialog_action_compute_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_compute_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionCompute *act = PSPPIRE_DIALOG_ACTION_COMPUTE (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("compute.ui"); - g_hash_table_insert (thing, a, xml); + GtkBuilder *xml = builder_new ( "compute.ui"); - pda->dialog = get_widget_assert (xml, "compute-variable-dialog"); - pda->source = get_widget_assert (xml, "compute-treeview1"); + pda->dialog = get_widget_assert (xml, "compute-variable-dialog"); + pda->source = get_widget_assert (xml, "compute-treeview1"); - act->textview = get_widget_assert (xml, "compute-textview1"); - act->entry = - get_widget_assert (xml, "type-and-label-label-entry"); + act->textview = get_widget_assert (xml, "compute-textview1"); + act->entry = + get_widget_assert (xml, "type-and-label-label-entry"); - act->width_entry = - get_widget_assert (xml, "type-and-label-width"); + act->width_entry = + get_widget_assert (xml, "type-and-label-width"); - act->functions = get_widget_assert (xml, "compute-treeview2"); - act->keypad = get_widget_assert (xml, "psppire-keypad1"); - act->target = get_widget_assert (xml, "compute-entry1"); - act->var_selector = get_widget_assert (xml, "compute-selector1"); - act->func_selector = get_widget_assert (xml, "compute-selector2"); - act->type_and_label = get_widget_assert (xml, "compute-button1"); + act->functions = get_widget_assert (xml, "compute-treeview2"); + act->keypad = get_widget_assert (xml, "psppire-keypad1"); + act->target = get_widget_assert (xml, "compute-entry1"); + act->var_selector = get_widget_assert (xml, "compute-selector1"); + act->func_selector = get_widget_assert (xml, "compute-selector2"); + act->type_and_label = get_widget_assert (xml, "compute-button1"); - act->subdialog = get_widget_assert (xml, "type-and-label-dialog"); + act->subdialog = get_widget_assert (xml, "type-and-label-dialog"); - act->numeric_target = get_widget_assert (xml, "radio-button-numeric"); - act->expression = get_widget_assert (xml, "radio-button-expression-label"); - act->user_label = get_widget_assert (xml, "radio-button-user-label"); - act->str_btn = get_widget_assert (xml, "radio-button-string"); + act->numeric_target = get_widget_assert (xml, "radio-button-numeric"); + act->expression = get_widget_assert (xml, "radio-button-expression-label"); + act->user_label = get_widget_assert (xml, "radio-button-user-label"); + act->str_btn = get_widget_assert (xml, "radio-button-string"); - g_signal_connect (act->expression, "toggled", - G_CALLBACK (on_expression_toggle), pda); + g_signal_connect (act->expression, "toggled", + G_CALLBACK (on_expression_toggle), pda); - g_signal_connect (act->str_btn, "toggled", - G_CALLBACK (on_type_toggled), pda); + g_signal_connect (act->str_btn, "toggled", + G_CALLBACK (on_type_toggled), pda); - g_object_set (pda->source, - "selection-mode", GTK_SELECTION_SINGLE, - NULL); + g_object_set (pda->source, + "selection-mode", GTK_SELECTION_SINGLE, + NULL); - psppire_selector_set_select_func (PSPPIRE_SELECTOR (act->var_selector), - insert_source_row_into_text_view, NULL); + psppire_selector_set_select_func (PSPPIRE_SELECTOR (act->var_selector), + insert_source_row_into_text_view, NULL); - function_list_populate (GTK_TREE_VIEW (act->functions)); + function_list_populate (GTK_TREE_VIEW (act->functions)); - psppire_selector_set_select_func (PSPPIRE_SELECTOR (act->func_selector), - insert_function_into_syntax_area, NULL); + psppire_selector_set_select_func (PSPPIRE_SELECTOR (act->func_selector), + insert_function_into_syntax_area, NULL); - g_signal_connect (act->target, "changed", G_CALLBACK (on_target_change), act); + g_signal_connect (act->target, "changed", G_CALLBACK (on_target_change), act); - g_signal_connect (act->keypad, "insert-syntax", - G_CALLBACK (on_keypad_button), act); + g_signal_connect (act->keypad, "insert-syntax", + G_CALLBACK (on_keypad_button), act); - g_signal_connect (act->keypad, "erase", - G_CALLBACK (erase), act); + g_signal_connect (act->keypad, "erase", + G_CALLBACK (erase), act); - g_signal_connect (act->type_and_label, "clicked", - G_CALLBACK (run_type_label_dialog), pda); + g_signal_connect (act->type_and_label, "clicked", + G_CALLBACK (run_type_label_dialog), pda); - psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); - psppire_dialog_action_set_refresh (pda, refresh); - } + psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); + psppire_dialog_action_set_refresh (pda, refresh); + return xml; } static void psppire_dialog_action_compute_class_init (PsppireDialogActionComputeClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_compute_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_compute_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-correlation.c b/src/ui/gui/psppire-dialog-action-correlation.c index 676f13e6aa..30c3b05bc7 100644 --- a/src/ui/gui/psppire-dialog-action-correlation.c +++ b/src/ui/gui/psppire-dialog-action-correlation.c @@ -91,19 +91,13 @@ refresh (PsppireDialogAction *rd_) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->two_tailed), TRUE); } -static void -psppire_dialog_action_correlation_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_correlation_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionCorrelation *act = PSPPIRE_DIALOG_ACTION_CORRELATION (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("correlation.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ( "correlation.ui"); pda->dialog = get_widget_assert (xml, "correlation-dialog"); pda->source = get_widget_assert (xml, "dict-view"); @@ -115,12 +109,13 @@ psppire_dialog_action_correlation_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); + return xml; } static void psppire_dialog_action_correlation_class_init (PsppireDialogActionCorrelationClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_correlation_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_correlation_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-count.c b/src/ui/gui/psppire-dialog-action-count.c index 8f9a9281ef..0f5fc87fbe 100644 --- a/src/ui/gui/psppire-dialog-action-count.c +++ b/src/ui/gui/psppire-dialog-action-count.c @@ -144,19 +144,13 @@ refresh (PsppireDialogAction *rd_) gtk_list_store_clear (GTK_LIST_STORE (cnt->value_list)); } -static void -psppire_dialog_action_count_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_count_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionCount *act = PSPPIRE_DIALOG_ACTION_COUNT (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("count.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ( "count.ui"); GtkWidget *selector = get_widget_assert (xml, "count-selector1"); GtkWidget *button = get_widget_assert (xml, "button1"); @@ -178,12 +172,13 @@ psppire_dialog_action_count_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); + return xml; } static void psppire_dialog_action_count_class_init (PsppireDialogActionCountClass *class) { - psppire_dialog_action_set_activation (class,psppire_dialog_action_count_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_count_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-crosstabs.c b/src/ui/gui/psppire-dialog-action-crosstabs.c index 8c1891d918..79baec16dc 100644 --- a/src/ui/gui/psppire-dialog-action-crosstabs.c +++ b/src/ui/gui/psppire-dialog-action-crosstabs.c @@ -202,70 +202,65 @@ on_statistics_clicked (PsppireDialogActionCrosstabs *cd) } -static void -psppire_dialog_action_crosstabs_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_crosstabs_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionCrosstabs *act = PSPPIRE_DIALOG_ACTION_CROSSTABS (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("crosstabs.ui"); - g_hash_table_insert (thing, a, xml); + GtkBuilder *xml = builder_new ( "crosstabs.ui"); - pda->dialog = get_widget_assert (xml, "crosstabs-dialog"); - pda->source = get_widget_assert (xml, "dict-treeview"); + 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->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"); + 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"); - act->format_options_avalue = TRUE; - act->format_options_table = TRUE; - act->format_options_pivot = TRUE; + act->format_options_avalue = TRUE; + act->format_options_table = TRUE; + act->format_options_pivot = TRUE; - psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (act->cell_view), - B_CS_CELL_DEFAULT, - N_CROSSTABS_CELLS, - cells); + psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (act->cell_view), + B_CS_CELL_DEFAULT, + N_CROSSTABS_CELLS, + cells); - act->cell = gtk_tree_view_get_model (GTK_TREE_VIEW (act->cell_view)); + act->cell = gtk_tree_view_get_model (GTK_TREE_VIEW (act->cell_view)); - psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (act->stat_view), - B_CS_STATS_DEFAULT, - N_CROSSTABS_STATS, - stats); + psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (act->stat_view), + B_CS_STATS_DEFAULT, + N_CROSSTABS_STATS, + stats); - act->stat = gtk_tree_view_get_model (GTK_TREE_VIEW (act->stat_view)); + act->stat = gtk_tree_view_get_model (GTK_TREE_VIEW (act->stat_view)); - 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); - g_signal_connect_swapped (act->cell_button, "clicked", - G_CALLBACK (on_cell_clicked), act); + g_signal_connect_swapped (act->cell_button, "clicked", + G_CALLBACK (on_cell_clicked), act); - g_signal_connect_swapped (act->stat_button, "clicked", - G_CALLBACK (on_statistics_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); + g_signal_connect_swapped (act->format_button, "clicked", + G_CALLBACK (on_format_clicked), act); - } + return xml; } @@ -378,7 +373,7 @@ generate_syntax (const PsppireDialogAction *a) static void psppire_dialog_action_crosstabs_class_init (PsppireDialogActionCrosstabsClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_crosstabs_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_crosstabs_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } @@ -387,4 +382,3 @@ static void psppire_dialog_action_crosstabs_init (PsppireDialogActionCrosstabs *act) { } - diff --git a/src/ui/gui/psppire-dialog-action-descriptives.c b/src/ui/gui/psppire-dialog-action-descriptives.c index 1acaaaecc6..5d2f4b7c5c 100644 --- a/src/ui/gui/psppire-dialog-action-descriptives.c +++ b/src/ui/gui/psppire-dialog-action-descriptives.c @@ -193,26 +193,20 @@ dialog_refresh (PsppireDialogAction *scd_) } -static void -psppire_dialog_action_descriptives_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_descriptives_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionDescriptives *act = PSPPIRE_DIALOG_ACTION_DESCRIPTIVES (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("descriptives.ui"); - g_hash_table_insert (thing, a, xml); - - GtkWidget *stats_treeview = get_widget_assert (xml, "statistics"); - psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (stats_treeview), - B_DS_DEFAULT, - N_DESCRIPTIVE_STATS, stats); - act->stats = gtk_tree_view_get_model (GTK_TREE_VIEW (stats_treeview)); - } + GtkBuilder *xml = builder_new ( "descriptives.ui"); + GtkWidget *stats_treeview = get_widget_assert (xml, "statistics"); + psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (stats_treeview), + B_DS_DEFAULT, + N_DESCRIPTIVE_STATS, stats); + act->stats = gtk_tree_view_get_model (GTK_TREE_VIEW (stats_treeview)); + pda->dialog = get_widget_assert (xml, "descriptives-dialog"); pda->source = get_widget_assert (xml, "all-variables"); act->variables = get_widget_assert (xml, "stat-variables"); @@ -231,12 +225,14 @@ psppire_dialog_action_descriptives_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, dialog_refresh); + + return xml; } static void psppire_dialog_action_descriptives_class_init (PsppireDialogActionDescriptivesClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_descriptives_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_descriptives_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-examine.c b/src/ui/gui/psppire-dialog-action-examine.c index 0bce847e24..2bafe67952 100644 --- a/src/ui/gui/psppire-dialog-action-examine.c +++ b/src/ui/gui/psppire-dialog-action-examine.c @@ -197,29 +197,23 @@ dialog_refresh (PsppireDialogAction *da) dae->opts = OPT_LISTWISE; } -static void -psppire_dialog_action_examine_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_examine_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionExamine *act = PSPPIRE_DIALOG_ACTION_EXAMINE (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("examine.ui"); - g_hash_table_insert (thing, a, xml); - - GtkWidget *stats_button = get_widget_assert (xml, "stats-button"); - GtkWidget *opts_button = get_widget_assert (xml, "opts-button"); - - g_signal_connect_swapped (stats_button, "clicked", - G_CALLBACK (run_stats_dialog), act); - - g_signal_connect_swapped (opts_button, "clicked", - G_CALLBACK (run_opts_dialog), act); - } - + GtkBuilder *xml = builder_new ("examine.ui"); + + GtkWidget *stats_button = get_widget_assert (xml, "stats-button"); + GtkWidget *opts_button = get_widget_assert (xml, "opts-button"); + + g_signal_connect_swapped (stats_button, "clicked", + G_CALLBACK (run_stats_dialog), act); + + g_signal_connect_swapped (opts_button, "clicked", + G_CALLBACK (run_opts_dialog), act); + GtkWidget *dep_sel = get_widget_assert (xml, "psppire-selector1"); GtkWidget *dep_sel2 = get_widget_assert (xml, "psppire-selector2"); GtkWidget *dep_sel3 = get_widget_assert (xml, "psppire-selector3"); @@ -259,13 +253,13 @@ psppire_dialog_action_examine_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, (void *) dialog_state_valid); psppire_dialog_action_set_refresh (pda, dialog_refresh); - + return xml; } static void psppire_dialog_action_examine_class_init (PsppireDialogActionExamineClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_examine_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_examine_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-factor.c b/src/ui/gui/psppire-dialog-action-factor.c index 1debfc674a..4c5d927e28 100644 --- a/src/ui/gui/psppire-dialog-action-factor.c +++ b/src/ui/gui/psppire-dialog-action-factor.c @@ -293,89 +293,82 @@ run_rotations_subdialog (PsppireDialogActionFactor *act) } } -static void -psppire_dialog_action_factor_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_factor_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionFactor *act = PSPPIRE_DIALOG_ACTION_FACTOR (a); GtkWidget *extraction_button ; GtkWidget *rotation_button ; - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("factor.ui"); - g_hash_table_insert (thing, a, xml); - - - pda->dialog = get_widget_assert (xml, "factor-dialog"); - pda->source = get_widget_assert (xml, "dict-view"); + GtkBuilder *xml = builder_new ( "factor.ui"); - extraction_button = get_widget_assert (xml, "button-extractions"); - rotation_button = get_widget_assert (xml, "button-rotations"); + pda->dialog = get_widget_assert (xml, "factor-dialog"); + pda->source = get_widget_assert (xml, "dict-view"); - act->extraction_dialog = get_widget_assert (xml, "extractions-dialog"); - act->rotation_dialog = get_widget_assert (xml, "rotations-dialog"); + extraction_button = get_widget_assert (xml, "button-extractions"); + rotation_button = get_widget_assert (xml, "button-rotations"); - act->variables = get_widget_assert (xml, "psppire-var-view1"); + act->extraction_dialog = get_widget_assert (xml, "extractions-dialog"); + act->rotation_dialog = get_widget_assert (xml, "rotations-dialog"); - { - GtkWidget *hbox = get_widget_assert (xml, "hbox6"); - GtkWidget *eigenvalue_extraction ; + act->variables = get_widget_assert (xml, "psppire-var-view1"); - act->mineigen_toggle = get_widget_assert (xml, "mineigen-radiobutton"); + { + GtkWidget *hbox = get_widget_assert (xml, "hbox6"); + GtkWidget *eigenvalue_extraction ; - eigenvalue_extraction = psppire_scanf_new (_("_Eigenvalues over %4.2f times the mean eigenvalue"), &act->mineigen); + act->mineigen_toggle = get_widget_assert (xml, "mineigen-radiobutton"); - g_object_set (eigenvalue_extraction, - "use-underline", TRUE, - "mnemonic-widget", act->mineigen_toggle, - NULL); + eigenvalue_extraction = psppire_scanf_new (_("_Eigenvalues over %4.2f times the mean eigenvalue"), &act->mineigen); - act->nfactors_toggle = get_widget_assert (xml, "nfactors-radiobutton"); - act->n_factors = get_widget_assert (xml, "spinbutton-nfactors"); - act->extract_iterations = get_widget_assert (xml, "spinbutton-extract-iterations"); - act->covariance_toggle = get_widget_assert (xml, "covariance-radiobutton"); - act->correlation_toggle = get_widget_assert (xml, "correlations-radiobutton"); + g_object_set (eigenvalue_extraction, + "use-underline", TRUE, + "mnemonic-widget", act->mineigen_toggle, + NULL); - act->scree_button = get_widget_assert (xml, "scree-button"); - act->unrotated_button = get_widget_assert (xml, "unrotated-button"); - act->extraction_combo = get_widget_assert (xml, "combobox1"); + act->nfactors_toggle = get_widget_assert (xml, "nfactors-radiobutton"); + act->n_factors = get_widget_assert (xml, "spinbutton-nfactors"); + act->extract_iterations = get_widget_assert (xml, "spinbutton-extract-iterations"); + act->covariance_toggle = get_widget_assert (xml, "covariance-radiobutton"); + act->correlation_toggle = get_widget_assert (xml, "correlations-radiobutton"); - gtk_container_add (GTK_CONTAINER (hbox), eigenvalue_extraction); + act->scree_button = get_widget_assert (xml, "scree-button"); + act->unrotated_button = get_widget_assert (xml, "unrotated-button"); + act->extraction_combo = get_widget_assert (xml, "combobox1"); - g_signal_connect (act->nfactors_toggle, "toggled", G_CALLBACK (on_extract_toggle), act); + gtk_container_add (GTK_CONTAINER (hbox), eigenvalue_extraction); - gtk_widget_show_all (eigenvalue_extraction); - } + g_signal_connect (act->nfactors_toggle, "toggled", G_CALLBACK (on_extract_toggle), act); - { - act->rotate_iterations = get_widget_assert (xml, "spinbutton-rot-iterations"); + gtk_widget_show_all (eigenvalue_extraction); + } - act->display_rotated_solution = get_widget_assert (xml, "checkbutton-rotated-solution"); + { + act->rotate_iterations = get_widget_assert (xml, "spinbutton-rot-iterations"); - act->rotation_none = get_widget_assert (xml, "radiobutton-none"); - act->rotation_varimax = get_widget_assert (xml, "radiobutton-varimax"); - act->rotation_quartimax = get_widget_assert (xml, "radiobutton-quartimax"); - act->rotation_equimax = get_widget_assert (xml, "radiobutton-equimax"); - } + act->display_rotated_solution = get_widget_assert (xml, "checkbutton-rotated-solution"); - g_signal_connect_swapped (extraction_button, "clicked", - G_CALLBACK (run_extractions_subdialog), act); - g_signal_connect_swapped (rotation_button, "clicked", G_CALLBACK (run_rotations_subdialog), act); + act->rotation_none = get_widget_assert (xml, "radiobutton-none"); + act->rotation_varimax = get_widget_assert (xml, "radiobutton-varimax"); + act->rotation_quartimax = get_widget_assert (xml, "radiobutton-quartimax"); + act->rotation_equimax = get_widget_assert (xml, "radiobutton-equimax"); + } - } + g_signal_connect_swapped (extraction_button, "clicked", + G_CALLBACK (run_extractions_subdialog), act); + g_signal_connect_swapped (rotation_button, "clicked", G_CALLBACK (run_rotations_subdialog), act); psppire_dialog_action_set_valid_predicate (pda, (void *) dialog_state_valid); psppire_dialog_action_set_refresh (pda, dialog_refresh); + return xml; } static void psppire_dialog_action_factor_class_init (PsppireDialogActionFactorClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_factor_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_factor_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-flip.c b/src/ui/gui/psppire-dialog-action-flip.c index 1c823eddbe..99947f773f 100644 --- a/src/ui/gui/psppire-dialog-action-flip.c +++ b/src/ui/gui/psppire-dialog-action-flip.c @@ -89,20 +89,14 @@ refresh (PsppireDialogAction *rd_) gtk_entry_set_text (GTK_ENTRY (rd->entry), ""); } -static void -psppire_dialog_action_flip_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_flip_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionFlip *act = PSPPIRE_DIALOG_ACTION_FLIP (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("transpose.ui"); - g_hash_table_insert (thing, a, xml); - } - + GtkBuilder *xml = builder_new ( "transpose.ui"); + pda->dialog = get_widget_assert (xml, "transpose-dialog"); pda->source = get_widget_assert (xml, "source-treeview"); @@ -112,12 +106,13 @@ psppire_dialog_action_flip_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); + return xml; } static void psppire_dialog_action_flip_class_init (PsppireDialogActionFlipClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_flip_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_flip_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-frequencies.c b/src/ui/gui/psppire-dialog-action-frequencies.c index 272723c2d7..adca915816 100644 --- a/src/ui/gui/psppire-dialog-action-frequencies.c +++ b/src/ui/gui/psppire-dialog-action-frequencies.c @@ -251,103 +251,94 @@ refresh (PsppireDialogAction * fdx) (B_FS_DEFAULT & (1u << i)) ? true : false, -1); } - - -static void -psppire_dialog_action_frequencies_activate (PsppireDialogAction * a) +static GtkBuilder * +psppire_dialog_action_frequencies_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionFrequencies *act = PSPPIRE_DIALOG_ACTION_FREQUENCIES (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("frequencies.ui"); - g_hash_table_insert (thing, a, xml); + GtkBuilder *xml = builder_new ( "frequencies.ui"); - GtkWidget *stats_treeview = get_widget_assert (xml, "stats-treeview"); + GtkWidget *stats_treeview = get_widget_assert (xml, "stats-treeview"); - psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (stats_treeview), - B_FS_DEFAULT, N_FREQUENCY_STATS, stats); + psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (stats_treeview), + B_FS_DEFAULT, N_FREQUENCY_STATS, stats); - act->stats = gtk_tree_view_get_model (GTK_TREE_VIEW (stats_treeview)); + act->stats = gtk_tree_view_get_model (GTK_TREE_VIEW (stats_treeview)); - GtkWidget *tables_button = get_widget_assert (xml, "tables-button"); - GtkWidget *charts_button = get_widget_assert (xml, "charts-button"); + GtkWidget *tables_button = get_widget_assert (xml, "tables-button"); + GtkWidget *charts_button = get_widget_assert (xml, "charts-button"); - pda->dialog = get_widget_assert (xml, "frequencies-dialog"); - pda->source = get_widget_assert (xml, "dict-treeview"); + pda->dialog = get_widget_assert (xml, "frequencies-dialog"); + pda->source = get_widget_assert (xml, "dict-treeview"); - act->stat_vars = get_widget_assert (xml, "var-treeview"); + act->stat_vars = get_widget_assert (xml, "var-treeview"); + act->include_missing = get_widget_assert (xml, "include_missing"); + act->tables_dialog = get_widget_assert (xml, "tables-dialog"); + act->charts_dialog = get_widget_assert (xml, "charts-dialog"); + act->always = get_widget_assert (xml, "always"); + act->never = get_widget_assert (xml, "never"); + act->limit = get_widget_assert (xml, "limit"); + act->limit_spinbutton = get_widget_assert (xml, "limit-spin"); - act->include_missing = get_widget_assert (xml, "include_missing"); + g_signal_connect (act->limit, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), + act->limit_spinbutton); + act->avalue = get_widget_assert (xml, "avalue"); + act->dvalue = get_widget_assert (xml, "dvalue"); + act->afreq = get_widget_assert (xml, "afreq"); + act->dfreq = get_widget_assert (xml, "dfreq"); - act->tables_dialog = get_widget_assert (xml, "tables-dialog"); - act->charts_dialog = get_widget_assert (xml, "charts-dialog"); - act->always = get_widget_assert (xml, "always"); - act->never = get_widget_assert (xml, "never"); - act->limit = get_widget_assert (xml, "limit"); - act->limit_spinbutton = get_widget_assert (xml, "limit-spin"); + act->charts_opts_use_min = false; + act->charts_opts_min = 0; + act->charts_opts_use_max = false; + act->charts_opts_max = 100; + act->charts_opts_draw_hist = false; + act->charts_opts_draw_normal = false; + act->charts_opts_scale = FRQ_FREQ; + act->charts_opts_draw_pie = false; + act->charts_opts_draw_bar = false; + act->charts_opts_pie_include_missing = false; - g_signal_connect (act->limit, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), - act->limit_spinbutton); + act->freqs = get_widget_assert (xml, "freqs"); + act->percents = get_widget_assert (xml, "percents"); - act->avalue = get_widget_assert (xml, "avalue"); - act->dvalue = get_widget_assert (xml, "dvalue"); - act->afreq = get_widget_assert (xml, "afreq"); - act->dfreq = get_widget_assert (xml, "dfreq"); + act->min = get_widget_assert (xml, "min"); + act->min_spin = get_widget_assert (xml, "min-spin"); + g_signal_connect (act->min, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), act->min_spin); + act->max = get_widget_assert (xml, "max"); + act->max_spin = get_widget_assert (xml, "max-spin"); + g_signal_connect (act->max, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), act->max_spin); - act->charts_opts_use_min = false; - act->charts_opts_min = 0; - act->charts_opts_use_max = false; - act->charts_opts_max = 100; - act->charts_opts_draw_hist = false; - act->charts_opts_draw_normal = false; - act->charts_opts_scale = FRQ_FREQ; - act->charts_opts_draw_pie = false; - act->charts_opts_draw_bar = false; - act->charts_opts_pie_include_missing = false; + act->hist = get_widget_assert (xml, "hist"); + act->normal = get_widget_assert (xml, "normal"); + g_signal_connect (act->hist, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), act->normal); - act->freqs = get_widget_assert (xml, "freqs"); - act->percents = get_widget_assert (xml, "percents"); + act->pie = (get_widget_assert (xml, "pie")); + act->pie_include_missing = get_widget_assert (xml, "pie-include-missing"); - act->min = get_widget_assert (xml, "min"); - act->min_spin = get_widget_assert (xml, "min-spin"); - g_signal_connect (act->min, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), act->min_spin); - act->max = get_widget_assert (xml, "max"); - act->max_spin = get_widget_assert (xml, "max-spin"); - g_signal_connect (act->max, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), act->max_spin); + act->bar = (get_widget_assert (xml, "bar")); - act->hist = get_widget_assert (xml, "hist"); - act->normal = get_widget_assert (xml, "normal"); - g_signal_connect (act->hist, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), act->normal); + act->tables_opts_order = FRQ_AVALUE; + act->tables_opts_table = FRQ_TABLE; + act->tables_opts_limit = 50; - act->pie = (get_widget_assert (xml, "pie")); - act->pie_include_missing = get_widget_assert (xml, "pie-include-missing"); + g_signal_connect_swapped (tables_button, "clicked", + G_CALLBACK (on_tables_clicked), act); - act->bar = (get_widget_assert (xml, "bar")); + g_signal_connect_swapped (charts_button, "clicked", + G_CALLBACK (on_charts_clicked), act); - act->tables_opts_order = FRQ_AVALUE; - act->tables_opts_table = FRQ_TABLE; - act->tables_opts_limit = 50; + psppire_dialog_action_set_refresh (pda, refresh); - g_signal_connect_swapped (tables_button, "clicked", - G_CALLBACK (on_tables_clicked), act); + psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); - g_signal_connect_swapped (charts_button, "clicked", - G_CALLBACK (on_charts_clicked), act); - - psppire_dialog_action_set_refresh (pda, refresh); - - psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); - } + return xml; } static char * @@ -497,12 +488,12 @@ generate_syntax (const PsppireDialogAction * a) static void psppire_dialog_action_frequencies_class_init (PsppireDialogActionFrequenciesClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_frequencies_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_frequencies_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } static void -psppire_dialog_action_frequencies_init (PsppireDialogActionFrequencies * act) +psppire_dialog_action_frequencies_init (PsppireDialogActionFrequencies *act) { } diff --git a/src/ui/gui/psppire-dialog-action-histogram.c b/src/ui/gui/psppire-dialog-action-histogram.c index bd0c8ea1f9..3949886c92 100644 --- a/src/ui/gui/psppire-dialog-action-histogram.c +++ b/src/ui/gui/psppire-dialog-action-histogram.c @@ -58,19 +58,13 @@ refresh (PsppireDialogAction *rd_) gtk_entry_set_text (GTK_ENTRY (rd->variable), ""); } -static void -psppire_dialog_action_histogram_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_histogram_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionHistogram *act = PSPPIRE_DIALOG_ACTION_HISTOGRAM (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - 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); - } + GtkBuilder *xml = builder_new ( "histogram.ui"); pda->dialog = get_widget_assert (xml, "histogram-dialog"); pda->source = get_widget_assert (xml, "dict-view"); @@ -83,6 +77,7 @@ psppire_dialog_action_histogram_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); + return xml; } @@ -115,7 +110,7 @@ generate_syntax (const PsppireDialogAction *a) static void psppire_dialog_action_histogram_class_init (PsppireDialogActionHistogramClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_histogram_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_histogram_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-indep-samps.c b/src/ui/gui/psppire-dialog-action-indep-samps.c index b13c444c5b..7a2511ad6e 100644 --- a/src/ui/gui/psppire-dialog-action-indep-samps.c +++ b/src/ui/gui/psppire-dialog-action-indep-samps.c @@ -293,19 +293,13 @@ set_group_criterion_type (GtkToggleButton *button, } -static void -psppire_dialog_action_indep_samps_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_indep_samps_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionIndepSamps *act = PSPPIRE_DIALOG_ACTION_INDEP_SAMPS (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("indep-samples.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ( "indep-samples.ui"); pda->dialog = get_widget_assert (xml,"independent-samples-dialog"); pda->source = get_widget_assert (xml, "indep-samples-treeview1"); @@ -353,6 +347,8 @@ psppire_dialog_action_indep_samps_activate (PsppireDialogAction *a) G_CALLBACK (on_grp_var_change), act); on_grp_var_change (GTK_ENTRY (act->group_var_entry), act); + + return xml; } @@ -423,7 +419,7 @@ generate_syntax (const PsppireDialogAction *a) static void psppire_dialog_action_indep_samps_class_init (PsppireDialogActionIndepSampsClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_indep_samps_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_indep_samps_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-k-independent.c b/src/ui/gui/psppire-dialog-action-k-independent.c index ba2934a55d..9027fdd0a4 100644 --- a/src/ui/gui/psppire-dialog-action-k-independent.c +++ b/src/ui/gui/psppire-dialog-action-k-independent.c @@ -169,51 +169,47 @@ set_value_entry_variable (PsppireDialogActionKIndependent *kid, GtkEntry *entry) } -static void -psppire_dialog_action_k_independent_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_k_independent_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionKIndependent *kid = PSPPIRE_DIALOG_ACTION_K_INDEPENDENT (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("k-independent.ui"); - g_hash_table_insert (thing, a, xml); + GtkBuilder *xml = builder_new ( "k-independent.ui"); - pda->dialog = get_widget_assert (xml, "k-independent-dialog"); - pda->source = get_widget_assert (xml, "k-independent-treeview1"); + pda->dialog = get_widget_assert (xml, "k-independent-dialog"); + pda->source = get_widget_assert (xml, "k-independent-treeview1"); - kid->vars_treeview = get_widget_assert (xml, "k-independent-treeview2"); - kid->groupvar_entry = get_widget_assert (xml, "k-independent-entry"); + kid->vars_treeview = get_widget_assert (xml, "k-independent-treeview2"); + kid->groupvar_entry = get_widget_assert (xml, "k-independent-entry"); - kid->subdialog = get_widget_assert (xml, "define-groups-dialog"); + kid->subdialog = get_widget_assert (xml, "define-groups-dialog"); - kid->lower_limit_entry = get_widget_assert (xml, "lower-limit-entry"); - kid->upper_limit_entry = get_widget_assert (xml, "upper-limit-entry"); + kid->lower_limit_entry = get_widget_assert (xml, "lower-limit-entry"); + kid->upper_limit_entry = get_widget_assert (xml, "upper-limit-entry"); - kid->checkbutton[KID_KRUSKAL_WALLIS] = get_widget_assert (xml, - "kruskal-wallis"); + kid->checkbutton[KID_KRUSKAL_WALLIS] = get_widget_assert (xml, + "kruskal-wallis"); - kid->checkbutton[KID_MEDIAN] = get_widget_assert (xml, "median"); + kid->checkbutton[KID_MEDIAN] = get_widget_assert (xml, "median"); - g_signal_connect_swapped (get_widget_assert (xml, "define-groups-button"), - "clicked", - G_CALLBACK (run_define_groups_dialog), kid); + g_signal_connect_swapped (get_widget_assert (xml, "define-groups-button"), + "clicked", + G_CALLBACK (run_define_groups_dialog), kid); - g_signal_connect_swapped (kid->groupvar_entry, "changed", - G_CALLBACK (set_value_entry_variable), kid); - } + g_signal_connect_swapped (kid->groupvar_entry, "changed", + G_CALLBACK (set_value_entry_variable), kid); psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); + + return xml; } static void psppire_dialog_action_k_independent_class_init (PsppireDialogActionKIndependentClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_k_independent_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_k_independent_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-k-related.c b/src/ui/gui/psppire-dialog-action-k-related.c index 87c34c1665..8c088f81eb 100644 --- a/src/ui/gui/psppire-dialog-action-k-related.c +++ b/src/ui/gui/psppire-dialog-action-k-related.c @@ -104,19 +104,13 @@ refresh (PsppireDialogAction *rd_) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (krd->cochran), FALSE); } -static void -psppire_dialog_action_k_related_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_k_related_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionKRelated *act = PSPPIRE_DIALOG_ACTION_K_RELATED (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("k-related.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ( "k-related.ui"); pda->dialog = get_widget_assert (xml, "k-related-dialog"); pda->source = get_widget_assert (xml, "dict-view"); @@ -133,12 +127,13 @@ psppire_dialog_action_k_related_activate (PsppireDialogAction *a) "predicate", var_is_numeric, NULL); + return xml; } static void psppire_dialog_action_k_related_class_init (PsppireDialogActionKRelatedClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_k_related_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_k_related_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-kmeans.c b/src/ui/gui/psppire-dialog-action-kmeans.c index b25ecd475a..24f9c60479 100644 --- a/src/ui/gui/psppire-dialog-action-kmeans.c +++ b/src/ui/gui/psppire-dialog-action-kmeans.c @@ -52,8 +52,6 @@ generate_syntax (const PsppireDialogAction *act) return text; } - - static gboolean dialog_state_valid (gpointer user_data) { @@ -81,19 +79,13 @@ refresh (PsppireDialogAction *fd_) gtk_entry_set_text (GTK_ENTRY (fd->entry), ""); } -static void -psppire_dialog_action_kmeans_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_kmeans_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionKmeans *act = PSPPIRE_DIALOG_ACTION_KMEANS (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("k-means.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ( "k-means.ui"); pda->dialog = get_widget_assert (xml, "k-means-dialog"); pda->source = get_widget_assert (xml, "dict-view"); @@ -104,12 +96,13 @@ psppire_dialog_action_kmeans_activate (PsppireDialogAction *a) psppire_dialog_action_set_refresh (pda, refresh); psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); + return xml; } static void psppire_dialog_action_kmeans_class_init (PsppireDialogActionKmeansClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_kmeans_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_kmeans_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-logistic.c b/src/ui/gui/psppire-dialog-action-logistic.c index e4887352ca..de3e4793ba 100644 --- a/src/ui/gui/psppire-dialog-action-logistic.c +++ b/src/ui/gui/psppire-dialog-action-logistic.c @@ -95,20 +95,14 @@ on_opts_clicked (PsppireDialogActionLogistic *act) } -static void -psppire_dialog_action_logistic_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_logistic_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionLogistic *act = PSPPIRE_DIALOG_ACTION_LOGISTIC (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); GtkWidget *opts_button; - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("logistic.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ( "logistic.ui"); pda->dialog = get_widget_assert (xml, "logistic-dialog"); pda->source = get_widget_assert (xml, "dict-view"); @@ -145,6 +139,7 @@ psppire_dialog_action_logistic_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); + return xml; } @@ -226,7 +221,7 @@ generate_syntax (const PsppireDialogAction *a) static void psppire_dialog_action_logistic_class_init (PsppireDialogActionLogisticClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_logistic_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_logistic_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-means.c b/src/ui/gui/psppire-dialog-action-means.c index ee45e84854..5b5a72f54a 100644 --- a/src/ui/gui/psppire-dialog-action-means.c +++ b/src/ui/gui/psppire-dialog-action-means.c @@ -91,25 +91,19 @@ dialog_refresh (PsppireDialogAction *da) psppire_means_layer_clear (PSPPIRE_MEANS_LAYER (pdm->layer)); } -static void -psppire_dialog_action_means_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_means_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionMeans *act = PSPPIRE_DIALOG_ACTION_MEANS (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("means.ui"); - g_hash_table_insert (thing, a, xml); - - GtkWidget *vb = get_widget_assert (xml, "frame2"); - act->layer = psppire_means_layer_new (); - gtk_container_add (GTK_CONTAINER (vb), act->layer); - gtk_widget_show (act->layer); - } + GtkBuilder *xml = builder_new ( "means.ui"); + GtkWidget *vb = get_widget_assert (xml, "frame2"); + act->layer = psppire_means_layer_new (); + gtk_container_add (GTK_CONTAINER (vb), act->layer); + gtk_widget_show (act->layer); + GtkWidget *selector = get_widget_assert (xml, "layer-selector"); pda->dialog = get_widget_assert (xml, "means-dialog"); @@ -126,13 +120,13 @@ psppire_dialog_action_means_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, (void *) dialog_state_valid); psppire_dialog_action_set_refresh (pda, dialog_refresh); - + return xml; } static void psppire_dialog_action_means_class_init (PsppireDialogActionMeansClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_means_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_means_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-oneway.c b/src/ui/gui/psppire-dialog-action-oneway.c index 81a632d9ea..77512977a9 100644 --- a/src/ui/gui/psppire-dialog-action-oneway.c +++ b/src/ui/gui/psppire-dialog-action-oneway.c @@ -218,21 +218,13 @@ clone_contrasts_array (GArray *src_array) } - - -static void -psppire_dialog_action_oneway_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_oneway_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionOneway *act = PSPPIRE_DIALOG_ACTION_ONEWAY (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("oneway.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ( "oneway.ui"); GtkWidget *contrasts_button = get_widget_assert (xml, "contrasts-button"); @@ -272,13 +264,13 @@ psppire_dialog_action_oneway_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); - + return xml; } static void psppire_dialog_action_oneway_class_init (PsppireDialogActionOnewayClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_oneway_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_oneway_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-paired.c b/src/ui/gui/psppire-dialog-action-paired.c index e0102b1405..8f3394fa70 100644 --- a/src/ui/gui/psppire-dialog-action-paired.c +++ b/src/ui/gui/psppire-dialog-action-paired.c @@ -149,54 +149,48 @@ generate_syntax (const PsppireDialogAction *pda) return text; } -static void -psppire_dialog_action_paired_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_paired_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionPaired *act = PSPPIRE_DIALOG_ACTION_PAIRED (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("paired-samples.ui"); - g_hash_table_insert (thing, a, xml); - - GtkWidget *selector = get_widget_assert (xml, "psppire-selector3"); - GtkWidget *bb = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); - GtkWidget *button = gtk_button_new_with_mnemonic (_("O_ptions...")); - GtkWidget *box = get_widget_assert (xml, "dynamic-populate"); + GtkBuilder *xml = builder_new ( "paired-samples.ui"); + + GtkWidget *selector = get_widget_assert (xml, "psppire-selector3"); + GtkWidget *bb = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); + GtkWidget *button = gtk_button_new_with_mnemonic (_("O_ptions...")); + GtkWidget *box = get_widget_assert (xml, "dynamic-populate"); - pda->dialog = get_widget_assert (xml, "t-test-paired-samples-dialog"); - pda->source = get_widget_assert (xml, "paired-samples-t-test-treeview1"); + pda->dialog = get_widget_assert (xml, "t-test-paired-samples-dialog"); + pda->source = get_widget_assert (xml, "paired-samples-t-test-treeview1"); - gtk_window_set_title (GTK_WINDOW (pda->dialog), _("Paired Samples T Test")); + gtk_window_set_title (GTK_WINDOW (pda->dialog), _("Paired Samples T Test")); - act->pairs_treeview = get_widget_assert (xml, "paired-samples-t-test-treeview2"); - act->list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (act->pairs_treeview))); + act->pairs_treeview = get_widget_assert (xml, "paired-samples-t-test-treeview2"); + act->list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (act->pairs_treeview))); - act->opt = tt_options_dialog_create (GTK_WINDOW (pda->toplevel)); + act->opt = tt_options_dialog_create (GTK_WINDOW (pda->toplevel)); - g_signal_connect_swapped (button, "clicked", G_CALLBACK (tt_options_dialog_run), act->opt); + g_signal_connect_swapped (button, "clicked", G_CALLBACK (tt_options_dialog_run), act->opt); - gtk_box_pack_start (GTK_BOX (bb), button, TRUE, TRUE, 5); - gtk_box_pack_start (GTK_BOX (box), bb, FALSE, FALSE, 5); - gtk_widget_show_all (box); + gtk_box_pack_start (GTK_BOX (bb), button, TRUE, TRUE, 5); + gtk_box_pack_start (GTK_BOX (box), bb, FALSE, FALSE, 5); + gtk_widget_show_all (box); - psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); - psppire_dialog_action_set_refresh (pda, refresh); + psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); + psppire_dialog_action_set_refresh (pda, refresh); - g_object_set (pda->source, - "predicate", var_is_numeric, - NULL); - - psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), - select_as_pair_member, - act); - } + g_object_set (pda->source, + "predicate", var_is_numeric, + NULL); + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), + select_as_pair_member, + act); + return xml; } static void @@ -210,7 +204,7 @@ static void psppire_dialog_action_paired_class_init (PsppireDialogActionPairedClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); - psppire_dialog_action_set_activation (class, psppire_dialog_action_paired_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_paired_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; object_class->finalize = psppire_dialog_action_paired_finalize; diff --git a/src/ui/gui/psppire-dialog-action-rank.c b/src/ui/gui/psppire-dialog-action-rank.c index 16adb9f707..8b9a5bb5c9 100644 --- a/src/ui/gui/psppire-dialog-action-rank.c +++ b/src/ui/gui/psppire-dialog-action-rank.c @@ -206,20 +206,13 @@ set_sensitivity (PsppireDialogActionRank *dar) gtk_widget_set_sensitive (dar->formula_box, sens); } -static void -psppire_dialog_action_rank_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_rank_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionRank *act = PSPPIRE_DIALOG_ACTION_RANK (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("rank.ui"); - g_hash_table_insert (thing, a, xml); - } - + GtkBuilder *xml = builder_new ( "rank.ui"); GtkWidget *types_button = get_widget_assert (xml, "button1"); GtkWidget *ties_button = get_widget_assert (xml, "button2"); @@ -298,12 +291,13 @@ psppire_dialog_action_rank_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, (void *) dialog_state_valid); psppire_dialog_action_set_refresh (pda, dialog_refresh); + return xml; } static void psppire_dialog_action_rank_class_init (PsppireDialogActionRankClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_rank_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_rank_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-recode-different.c b/src/ui/gui/psppire-dialog-action-recode-different.c index 9a41596d3b..251e5999e0 100644 --- a/src/ui/gui/psppire-dialog-action-recode-different.c +++ b/src/ui/gui/psppire-dialog-action-recode-different.c @@ -312,13 +312,14 @@ populate_treeview (PsppireDialogActionRecode *act) } -static void -psppire_dialog_action_recode_different_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_recode_different_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionRecode *act = PSPPIRE_DIALOG_ACTION_RECODE (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - psppire_dialog_action_recode_pre_activate (act, populate_treeview); + GtkBuilder *xml = psppire_dialog_action_recode_pre_activate (act, + populate_treeview); gtk_window_set_title (GTK_WINDOW (pda->dialog), _("Recode into Different Variables")); @@ -335,6 +336,7 @@ psppire_dialog_action_recode_different_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); + return xml; } static void @@ -431,7 +433,7 @@ target_is_string (const PsppireDialogActionRecode *rd) static void psppire_dialog_action_recode_different_class_init (PsppireDialogActionRecodeDifferentClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_recode_different_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_recode_different_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = diff_generate_syntax; PSPPIRE_DIALOG_ACTION_RECODE_CLASS (class)->target_is_string = target_is_string; diff --git a/src/ui/gui/psppire-dialog-action-recode-same.c b/src/ui/gui/psppire-dialog-action-recode-same.c index f0e31c795e..af10448b1b 100644 --- a/src/ui/gui/psppire-dialog-action-recode-same.c +++ b/src/ui/gui/psppire-dialog-action-recode-same.c @@ -96,13 +96,13 @@ on_old_new_show (PsppireDialogActionRecode *rd) gtk_widget_hide (rd->strings_box); } -static void -psppire_dialog_action_recode_same_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_recode_same_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionRecode *act = PSPPIRE_DIALOG_ACTION_RECODE (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - psppire_dialog_action_recode_pre_activate (act, NULL); + GtkBuilder *xml = psppire_dialog_action_recode_pre_activate (act, NULL); gtk_window_set_title (GTK_WINDOW (pda->dialog), _("Recode into Same Variables")); @@ -119,6 +119,8 @@ psppire_dialog_action_recode_same_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); + + return xml; } static void @@ -142,7 +144,7 @@ target_is_string (const PsppireDialogActionRecode *rd) static void psppire_dialog_action_recode_same_class_init (PsppireDialogActionRecodeSameClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_recode_same_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_recode_same_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = same_generate_syntax; PSPPIRE_DIALOG_ACTION_RECODE_CLASS (class)->target_is_string = target_is_string; diff --git a/src/ui/gui/psppire-dialog-action-recode.c b/src/ui/gui/psppire-dialog-action-recode.c index 7abe51df64..221e90f230 100644 --- a/src/ui/gui/psppire-dialog-action-recode.c +++ b/src/ui/gui/psppire-dialog-action-recode.c @@ -440,123 +440,119 @@ psppire_dialog_action_recode_refresh (PsppireDialogAction *rd_) } -void -psppire_dialog_action_recode_pre_activate (PsppireDialogActionRecode *act, void (*populate_treeview) (PsppireDialogActionRecode *)) +GtkBuilder * +psppire_dialog_action_recode_pre_activate (PsppireDialogActionRecode *act, + void (*populate_treeview) (PsppireDialogActionRecode *)) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (act); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, act); - if (!xml) - { - xml = builder_new ("recode.ui"); - g_hash_table_insert (thing, act, xml); - - pda->dialog = get_widget_assert (xml, "recode-dialog"); - pda->source = get_widget_assert (xml, "treeview1"); + GtkBuilder *xml = builder_new ("recode.ui"); + + pda->dialog = get_widget_assert (xml, "recode-dialog"); + pda->source = get_widget_assert (xml, "treeview1"); - GtkWidget *selector = get_widget_assert (xml, "psppire-selector1"); - GtkWidget *oldandnew = get_widget_assert (xml, "button1"); + GtkWidget *selector = get_widget_assert (xml, "psppire-selector1"); + GtkWidget *oldandnew = get_widget_assert (xml, "button1"); - act->output_variable_box = get_widget_assert (xml,"frame4"); + act->output_variable_box = get_widget_assert (xml,"frame4"); - act->change_button = get_widget_assert (xml, "change-button"); - act->variable_treeview = get_widget_assert (xml, "treeview2"); - act->new_name_entry = get_widget_assert (xml, "dest-name-entry"); - act->new_label_entry = get_widget_assert (xml, "dest-label-entry"); + act->change_button = get_widget_assert (xml, "change-button"); + act->variable_treeview = get_widget_assert (xml, "treeview2"); + act->new_name_entry = get_widget_assert (xml, "dest-name-entry"); + act->new_label_entry = get_widget_assert (xml, "dest-label-entry"); - act->value_map = gtk_list_store_new (2, - old_value_get_type (), - new_value_get_type ()); + act->value_map = gtk_list_store_new (2, + old_value_get_type (), + new_value_get_type ()); - if (populate_treeview) - populate_treeview (act); + if (populate_treeview) + populate_treeview (act); - psppire_selector_set_allow (PSPPIRE_SELECTOR (selector), homogeneous_types); + psppire_selector_set_allow (PSPPIRE_SELECTOR (selector), homogeneous_types); - /* Set up the Old & New Values subdialog */ - { - act->string_button = get_widget_assert (xml, "checkbutton1"); - act->width_entry = get_widget_assert (xml, "spinbutton1"); + /* Set up the Old & New Values subdialog */ + { + act->string_button = get_widget_assert (xml, "checkbutton1"); + act->width_entry = get_widget_assert (xml, "spinbutton1"); - act->convert_button = get_widget_assert (xml, "checkbutton2"); + act->convert_button = get_widget_assert (xml, "checkbutton2"); - act->old_value_chooser = get_widget_assert (xml, "val-chooser"); + act->old_value_chooser = get_widget_assert (xml, "val-chooser"); - act->new_value_entry = get_widget_assert (xml, "entry1"); + act->new_value_entry = get_widget_assert (xml, "entry1"); - act->toggle[BUTTON_NEW_VALUE] = get_widget_assert (xml, "radiobutton1"); - act->toggle[BUTTON_NEW_SYSMIS] = get_widget_assert (xml, "radiobutton2"); - act->toggle[BUTTON_NEW_COPY] = get_widget_assert (xml, "radiobutton3"); + act->toggle[BUTTON_NEW_VALUE] = get_widget_assert (xml, "radiobutton1"); + act->toggle[BUTTON_NEW_SYSMIS] = get_widget_assert (xml, "radiobutton2"); + act->toggle[BUTTON_NEW_COPY] = get_widget_assert (xml, "radiobutton3"); - act->new_copy_label = get_widget_assert (xml, "label3"); - act->strings_box = get_widget_assert (xml, "table3"); + act->new_copy_label = get_widget_assert (xml, "label3"); + act->strings_box = get_widget_assert (xml, "table3"); - act->old_and_new_dialog = - PSPPIRE_DIALOG (get_widget_assert (xml, "old-new-values-dialog")); + act->old_and_new_dialog = + PSPPIRE_DIALOG (get_widget_assert (xml, "old-new-values-dialog")); - act->acr = get_widget_assert (xml, "psppire-acr1"); + act->acr = get_widget_assert (xml, "psppire-acr1"); - g_signal_connect_swapped (act->toggle[BUTTON_NEW_VALUE], "toggled", - G_CALLBACK (set_acr), act); + g_signal_connect_swapped (act->toggle[BUTTON_NEW_VALUE], "toggled", + G_CALLBACK (set_acr), act); - g_signal_connect_after (act->toggle[BUTTON_NEW_VALUE], "toggled", - G_CALLBACK (focus_value_entry), act); + g_signal_connect_after (act->toggle[BUTTON_NEW_VALUE], "toggled", + G_CALLBACK (focus_value_entry), act); - g_signal_connect_swapped (act->new_value_entry, "changed", - G_CALLBACK (set_acr), act); + g_signal_connect_swapped (act->new_value_entry, "changed", + G_CALLBACK (set_acr), act); - { - GtkTreeSelection *sel; - /* Remove the ACR's default column. We don't like it */ - GtkTreeViewColumn *column = gtk_tree_view_get_column (PSPPIRE_ACR(act->acr)->tv, 0); - gtk_tree_view_remove_column (PSPPIRE_ACR (act->acr)->tv, column); + { + GtkTreeSelection *sel; + /* Remove the ACR's default column. We don't like it */ + GtkTreeViewColumn *column = gtk_tree_view_get_column (PSPPIRE_ACR(act->acr)->tv, 0); + gtk_tree_view_remove_column (PSPPIRE_ACR (act->acr)->tv, column); - column = - gtk_tree_view_column_new_with_attributes (_("Old"), - gtk_cell_renderer_text_new (), - "text", 0, - NULL); + column = + gtk_tree_view_column_new_with_attributes (_("Old"), + gtk_cell_renderer_text_new (), + "text", 0, + NULL); - gtk_tree_view_append_column (PSPPIRE_ACR (act->acr)->tv, column); + gtk_tree_view_append_column (PSPPIRE_ACR (act->acr)->tv, column); - column = - gtk_tree_view_column_new_with_attributes (_("New"), - gtk_cell_renderer_text_new (), - "text", 1, - NULL); + column = + gtk_tree_view_column_new_with_attributes (_("New"), + gtk_cell_renderer_text_new (), + "text", 1, + NULL); - gtk_tree_view_append_column (PSPPIRE_ACR(act->acr)->tv, column); - g_object_set (PSPPIRE_ACR (act->acr)->tv, "headers-visible", TRUE, NULL); + gtk_tree_view_append_column (PSPPIRE_ACR(act->acr)->tv, column); + g_object_set (PSPPIRE_ACR (act->acr)->tv, "headers-visible", TRUE, NULL); - sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (PSPPIRE_ACR(act->acr)->tv)); - g_signal_connect (sel, "changed", - G_CALLBACK (on_acr_selection_change), act); - } + sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (PSPPIRE_ACR(act->acr)->tv)); + g_signal_connect (sel, "changed", + G_CALLBACK (on_acr_selection_change), act); + } - g_signal_connect_swapped (oldandnew, "clicked", - G_CALLBACK (run_old_and_new_dialog), act); + g_signal_connect_swapped (oldandnew, "clicked", + G_CALLBACK (run_old_and_new_dialog), act); - g_signal_connect (act->toggle[BUTTON_NEW_VALUE], "toggled", - G_CALLBACK (toggle_sensitivity), act->new_value_entry); + g_signal_connect (act->toggle[BUTTON_NEW_VALUE], "toggled", + G_CALLBACK (toggle_sensitivity), act->new_value_entry); - g_signal_connect (act->string_button, "toggled", - G_CALLBACK (toggle_sensitivity), act->width_entry); + g_signal_connect (act->string_button, "toggled", + G_CALLBACK (toggle_sensitivity), act->width_entry); - g_signal_connect (act->string_button, "toggled", - G_CALLBACK (on_string_toggled), act); + g_signal_connect (act->string_button, "toggled", + G_CALLBACK (on_string_toggled), act); - g_signal_connect (act->convert_button, "toggled", - G_CALLBACK (on_convert_toggled), act); - } + g_signal_connect (act->convert_button, "toggled", + G_CALLBACK (on_convert_toggled), act); } + return xml; } /* Generate a syntax fragment for NV and append it to STR */ diff --git a/src/ui/gui/psppire-dialog-action-recode.h b/src/ui/gui/psppire-dialog-action-recode.h index 8b67e425d9..06c527e72f 100644 --- a/src/ui/gui/psppire-dialog-action-recode.h +++ b/src/ui/gui/psppire-dialog-action-recode.h @@ -107,7 +107,8 @@ GType psppire_dialog_action_recode_get_type (void) ; void psppire_dialog_action_recode_refresh (PsppireDialogAction *); -void psppire_dialog_action_recode_pre_activate (PsppireDialogActionRecode *act, void (*populate_treeview) (PsppireDialogActionRecode *) ); +GtkBuilder * psppire_dialog_action_recode_pre_activate (PsppireDialogActionRecode *act, + void (*populate_treeview) (PsppireDialogActionRecode *) ); GType new_value_get_type (void); diff --git a/src/ui/gui/psppire-dialog-action-regression.c b/src/ui/gui/psppire-dialog-action-regression.c index 0cfadb1401..b475ebb0df 100644 --- a/src/ui/gui/psppire-dialog-action-regression.c +++ b/src/ui/gui/psppire-dialog-action-regression.c @@ -141,20 +141,14 @@ on_save_clicked (PsppireDialogActionRegression *rd) } -static void -psppire_dialog_action_regression_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_regression_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionRegression *act = PSPPIRE_DIALOG_ACTION_REGRESSION (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("regression.ui"); - g_hash_table_insert (thing, a, xml); - } - + GtkBuilder *xml = builder_new ( "regression.ui"); + GtkWidget *stat_button = get_widget_assert (xml, "stat-button"); GtkWidget *save_button = get_widget_assert (xml, "save-button"); @@ -185,7 +179,7 @@ psppire_dialog_action_regression_activate (PsppireDialogAction *a) g_signal_connect_swapped (save_button, "clicked", G_CALLBACK (on_save_clicked), act); - + return xml; } @@ -259,7 +253,7 @@ generate_syntax (const PsppireDialogAction *a) static void psppire_dialog_action_regression_class_init (PsppireDialogActionRegressionClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_regression_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_regression_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-reliability.c b/src/ui/gui/psppire-dialog-action-reliability.c index 0ee1af8e61..9082025f7d 100644 --- a/src/ui/gui/psppire-dialog-action-reliability.c +++ b/src/ui/gui/psppire-dialog-action-reliability.c @@ -119,20 +119,14 @@ refresh (PsppireDialogAction *pda_) FALSE); } -static void -psppire_dialog_action_reliability_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_reliability_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionReliability *act = PSPPIRE_DIALOG_ACTION_RELIABILITY (a); GtkTreeModel *liststore ; - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("reliability.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ( "reliability.ui"); pda->dialog = get_widget_assert (xml, "reliability-dialog"); pda->source = get_widget_assert (xml, "dict-view"); @@ -164,14 +158,14 @@ psppire_dialog_action_reliability_activate (PsppireDialogAction *a) psppire_dialog_action_set_refresh (pda, refresh); psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); - + return xml; } static void psppire_dialog_action_reliability_class_init (PsppireDialogActionReliabilityClass *class) { PsppireDialogActionClass *pdac = PSPPIRE_DIALOG_ACTION_CLASS (class); - psppire_dialog_action_set_activation (class, psppire_dialog_action_reliability_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_reliability_activate; pdac->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-roc.c b/src/ui/gui/psppire-dialog-action-roc.c index 694effb7b8..448d44f2b4 100644 --- a/src/ui/gui/psppire-dialog-action-roc.c +++ b/src/ui/gui/psppire-dialog-action-roc.c @@ -120,20 +120,13 @@ on_state_var_changed (PsppireDialogAction *a) psppire_value_entry_set_variable (PSPPIRE_VALUE_ENTRY (act->state_value), var); } -static void -psppire_dialog_action_roc_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_roc_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionRoc *act = PSPPIRE_DIALOG_ACTION_ROC (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("roc.ui"); - g_hash_table_insert (thing, a, xml); - } - + GtkBuilder *xml = builder_new ( "roc.ui"); pda->dialog = get_widget_assert (xml, "roc-dialog"); pda->source = get_widget_assert (xml, "dict-view"); @@ -157,7 +150,7 @@ psppire_dialog_action_roc_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); - + return xml; } @@ -242,7 +235,7 @@ generate_syntax (const PsppireDialogAction *a) static void psppire_dialog_action_roc_class_init (PsppireDialogActionRocClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_roc_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_roc_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-runs.c b/src/ui/gui/psppire-dialog-action-runs.c index a0e9e30357..40afd8e762 100644 --- a/src/ui/gui/psppire-dialog-action-runs.c +++ b/src/ui/gui/psppire-dialog-action-runs.c @@ -127,19 +127,13 @@ refresh (PsppireDialogAction *rd_) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rd->cb[i]), FALSE); } -static void -psppire_dialog_action_runs_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_runs_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionRuns *act = PSPPIRE_DIALOG_ACTION_RUNS (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("runs.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ( "runs.ui"); pda->dialog = get_widget_assert (xml, "runs-dialog"); pda->source = get_widget_assert (xml, "dict-view"); @@ -153,13 +147,13 @@ psppire_dialog_action_runs_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); - + return xml; } static void psppire_dialog_action_runs_class_init (PsppireDialogActionRunsClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_runs_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_runs_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-scatterplot.c b/src/ui/gui/psppire-dialog-action-scatterplot.c index 891dbf019b..041c857b73 100644 --- a/src/ui/gui/psppire-dialog-action-scatterplot.c +++ b/src/ui/gui/psppire-dialog-action-scatterplot.c @@ -90,20 +90,13 @@ refresh (PsppireDialogAction *rd_) -static void -psppire_dialog_action_scatterplot_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_scatterplot_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionScatterplot *act = PSPPIRE_DIALOG_ACTION_SCATTERPLOT (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("scatterplot.ui"); - g_hash_table_insert (thing, a, xml); - } - + GtkBuilder *xml = builder_new ( "scatterplot.ui"); pda->dialog = get_widget_assert (xml, "scatterplot-dialog"); pda->source = get_widget_assert (xml, "scatterplot-treeview1"); @@ -112,13 +105,13 @@ psppire_dialog_action_scatterplot_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); - + return xml; } static void psppire_dialog_action_scatterplot_class_init (PsppireDialogActionScatterplotClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_scatterplot_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_scatterplot_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-select.c b/src/ui/gui/psppire-dialog-action-select.c index a524de63d9..e5d777dada 100644 --- a/src/ui/gui/psppire-dialog-action-select.c +++ b/src/ui/gui/psppire-dialog-action-select.c @@ -255,111 +255,103 @@ consistency (GtkSpinButton *spin, PsppireDialogActionSelect *act) } } -static void -psppire_dialog_action_select_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_select_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionSelect *act = PSPPIRE_DIALOG_ACTION_SELECT (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); + + GtkBuilder *xml = builder_new ( "select-cases.ui"); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("select-cases.ui"); - g_hash_table_insert (thing, a, xml); - - - pda->dialog = get_widget_assert (xml, "select-cases-dialog"); - pda->source = get_widget_assert (xml, "select-cases-treeview"); + pda->dialog = get_widget_assert (xml, "select-cases-dialog"); + pda->source = get_widget_assert (xml, "select-cases-treeview"); - g_object_set (pda->source, - "selection-mode", GTK_SELECTION_SINGLE, - NULL); - - act->entry = get_widget_assert (xml, "filter-variable-entry"); + g_object_set (pda->source, + "selection-mode", GTK_SELECTION_SINGLE, + NULL); - GtkWidget *selector = get_widget_assert (xml, "psppire-selector-filter"); - psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector), - is_currently_in_entry); + act->entry = get_widget_assert (xml, "filter-variable-entry"); - act->rsample_dialog = get_widget_assert (xml, "select-cases-random-sample-dialog"); - act->percent = get_widget_assert (xml, "radiobutton-sample-percent"); - act->sample_n_cases = get_widget_assert (xml, "radiobutton-sample-n-cases"); - act->table = get_widget_assert (xml, "select-cases-random-sample-table"); + GtkWidget *selector = get_widget_assert (xml, "psppire-selector-filter"); + psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector), + is_currently_in_entry); - act->l0 = get_widget_assert (xml, "random-sample-label");; + act->rsample_dialog = get_widget_assert (xml, "select-cases-random-sample-dialog"); + act->percent = get_widget_assert (xml, "radiobutton-sample-percent"); + act->sample_n_cases = get_widget_assert (xml, "radiobutton-sample-n-cases"); + act->table = get_widget_assert (xml, "select-cases-random-sample-table"); - act->radiobutton_range = get_widget_assert (xml, "radiobutton-range"); - act->range_subdialog = get_widget_assert (xml, "select-cases-range-dialog"); + act->l0 = get_widget_assert (xml, "random-sample-label");; - act->first = get_widget_assert (xml, "range-dialog-first"); - act->last = get_widget_assert (xml, "range-dialog-last"); + act->radiobutton_range = get_widget_assert (xml, "radiobutton-range"); + act->range_subdialog = get_widget_assert (xml, "select-cases-range-dialog"); - g_signal_connect (act->first, "value-changed", G_CALLBACK (consistency), act); - g_signal_connect (act->last, "value-changed", G_CALLBACK (consistency), act); + act->first = get_widget_assert (xml, "range-dialog-first"); + act->last = get_widget_assert (xml, "range-dialog-last"); - act->l1 = get_widget_assert (xml, "range-sample-label"); - act->radiobutton_sample = get_widget_assert (xml, "radiobutton-sample"); + g_signal_connect (act->first, "value-changed", G_CALLBACK (consistency), act); + g_signal_connect (act->last, "value-changed", G_CALLBACK (consistency), act); - act->radiobutton_all = get_widget_assert (xml, "radiobutton-all"); - act->radiobutton_filter_variable = get_widget_assert (xml, "radiobutton-filter-variable"); + act->l1 = get_widget_assert (xml, "range-sample-label"); + act->radiobutton_sample = get_widget_assert (xml, "radiobutton-sample"); - act->radiobutton_filter = get_widget_assert (xml, "radiobutton-filter"); - act->radiobutton_delete = get_widget_assert (xml, "radiobutton-delete"); + act->radiobutton_all = get_widget_assert (xml, "radiobutton-all"); + act->radiobutton_filter_variable = get_widget_assert (xml, "radiobutton-filter-variable"); + act->radiobutton_filter = get_widget_assert (xml, "radiobutton-filter"); + act->radiobutton_delete = get_widget_assert (xml, "radiobutton-delete"); - GtkWidget *button_range = get_widget_assert (xml, "button-range"); - GtkWidget *button_sample = get_widget_assert (xml, "button-sample"); - GtkWidget *button_if =get_widget_assert (xml, "button-if"); + GtkWidget *button_range = get_widget_assert (xml, "button-range"); + GtkWidget *button_sample = get_widget_assert (xml, "button-sample"); - GtkWidget *radiobutton_if = get_widget_assert (xml, "radiobutton-if"); + GtkWidget *button_if =get_widget_assert (xml, "button-if"); - GtkWidget *sample_label = get_widget_assert (xml, "random-sample-label"); + GtkWidget *radiobutton_if = get_widget_assert (xml, "radiobutton-if"); - g_signal_connect (act->radiobutton_all, "toggled", - G_CALLBACK (set_sensitivity_from_toggle_invert), - get_widget_assert (xml, "filter-delete-button-box")); + GtkWidget *sample_label = get_widget_assert (xml, "random-sample-label"); - g_signal_connect (button_if, "clicked", - G_CALLBACK (set_radiobutton), radiobutton_if); + g_signal_connect (act->radiobutton_all, "toggled", + G_CALLBACK (set_sensitivity_from_toggle_invert), + get_widget_assert (xml, "filter-delete-button-box")); - g_signal_connect (button_sample, "clicked", - G_CALLBACK (set_radiobutton), act->radiobutton_sample); + g_signal_connect (button_if, "clicked", + G_CALLBACK (set_radiobutton), radiobutton_if); - g_signal_connect (button_range, "clicked", - G_CALLBACK (set_radiobutton), act->radiobutton_range); + g_signal_connect (button_sample, "clicked", + G_CALLBACK (set_radiobutton), act->radiobutton_sample); - g_signal_connect (selector, "clicked", - G_CALLBACK (set_radiobutton), act->radiobutton_filter_variable); + g_signal_connect (button_range, "clicked", + G_CALLBACK (set_radiobutton), act->radiobutton_range); - g_signal_connect (selector, "selected", - G_CALLBACK (set_radiobutton), act->radiobutton_filter_variable); + g_signal_connect (selector, "clicked", + G_CALLBACK (set_radiobutton), act->radiobutton_filter_variable); - g_signal_connect (act->radiobutton_range, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), - act->l1); + g_signal_connect (selector, "selected", + G_CALLBACK (set_radiobutton), act->radiobutton_filter_variable); - g_signal_connect (act->radiobutton_sample, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), - sample_label); + g_signal_connect (act->radiobutton_range, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), + act->l1); - g_signal_connect (act->radiobutton_filter_variable, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), - act->entry); + g_signal_connect (act->radiobutton_sample, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), + sample_label); - g_signal_connect (button_range, - "clicked", G_CALLBACK (range_subdialog), act); + g_signal_connect (act->radiobutton_filter_variable, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), + act->entry); - g_signal_connect (button_sample, - "clicked", G_CALLBACK (sample_subdialog), act); - } + g_signal_connect (button_range, + "clicked", G_CALLBACK (range_subdialog), act); + g_signal_connect (button_sample, + "clicked", G_CALLBACK (sample_subdialog), act); psppire_dialog_action_set_refresh (pda, refresh); psppire_dialog_action_set_valid_predicate (pda, - dialog_state_valid); - + dialog_state_valid); + return xml; } @@ -560,7 +552,7 @@ generate_syntax (const PsppireDialogAction *a) static void psppire_dialog_action_select_class_init (PsppireDialogActionSelectClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_select_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_select_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-sort.c b/src/ui/gui/psppire-dialog-action-sort.c index ecfffe536b..f59cc42589 100644 --- a/src/ui/gui/psppire-dialog-action-sort.c +++ b/src/ui/gui/psppire-dialog-action-sort.c @@ -89,19 +89,13 @@ dialog_state_valid (gpointer act) } -static void -psppire_dialog_action_sort_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_sort_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionSort *act = PSPPIRE_DIALOG_ACTION_SORT (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("sort.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ( "sort.ui"); pda->dialog = get_widget_assert (xml, "sort-cases-dialog"); pda->source = get_widget_assert (xml, "sort-cases-treeview1"); @@ -113,16 +107,16 @@ psppire_dialog_action_sort_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); - + return xml; } static void psppire_dialog_action_sort_class_init (PsppireDialogActionSortClass *class) { PsppireDialogActionClass *pdac = PSPPIRE_DIALOG_ACTION_CLASS (class); - psppire_dialog_action_set_activation (class, psppire_dialog_action_sort_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_sort_activate; - pdac->generate_syntax = generate_syntax; + pdac->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-split.c b/src/ui/gui/psppire-dialog-action-split.c index 410b2d106f..5a0026e213 100644 --- a/src/ui/gui/psppire-dialog-action-split.c +++ b/src/ui/gui/psppire-dialog-action-split.c @@ -136,48 +136,41 @@ on_off_toggled (GtkToggleButton *togglebutton, gtk_widget_set_sensitive (act->source, state); } -static void -psppire_dialog_action_split_activate (PsppireDialogAction *pda) +static GtkBuilder * +psppire_dialog_action_split_activate (PsppireDialogAction *pda, GVariant *param) { PsppireDialogActionSplit *act = PSPPIRE_DIALOG_ACTION_SPLIT (pda); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, pda); - if (!xml) - { - xml = builder_new ("split-file.ui"); - g_hash_table_insert (thing, pda, xml); + GtkBuilder *xml = builder_new ( "split-file.ui"); - pda->dialog = get_widget_assert (xml, "split-file-dialog"); - pda->source = get_widget_assert (xml, "split-file-dict-treeview"); - act->selector = get_widget_assert (xml, "split-file-selector"); + pda->dialog = get_widget_assert (xml, "split-file-dialog"); + pda->source = get_widget_assert (xml, "split-file-dict-treeview"); + act->selector = get_widget_assert (xml, "split-file-selector"); - act->dest = get_widget_assert (xml, "split-file-grouping-vars"); - act->source = get_widget_assert (xml, "split-file-dict-treeview"); - act->sort = get_widget_assert (xml, "split-sort"); + act->dest = get_widget_assert (xml, "split-file-grouping-vars"); + act->source = get_widget_assert (xml, "split-file-dict-treeview"); + act->sort = get_widget_assert (xml, "split-sort"); - act->off = get_widget_assert (xml, "split-off"); - act->layered = get_widget_assert (xml, "split-layered"); + act->off = get_widget_assert (xml, "split-off"); + act->layered = get_widget_assert (xml, "split-layered"); - act->tv = get_widget_assert (xml, "split-file-grouping-vars"); + act->tv = get_widget_assert (xml, "split-file-grouping-vars"); - g_signal_connect (act->off, "toggled", G_CALLBACK (on_off_toggled), pda); - g_signal_connect_swapped (pda->dialog, "show", G_CALLBACK (refresh), pda); - } + g_signal_connect (act->off, "toggled", G_CALLBACK (on_off_toggled), pda); + g_signal_connect_swapped (pda->dialog, "show", G_CALLBACK (refresh), pda); psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); - + return xml; } static void psppire_dialog_action_split_class_init (PsppireDialogActionSplitClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_split_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_split_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } - static void psppire_dialog_action_split_init (PsppireDialogActionSplit *act) { diff --git a/src/ui/gui/psppire-dialog-action-tt1s.c b/src/ui/gui/psppire-dialog-action-tt1s.c index f9d8bfa608..9fa30913e1 100644 --- a/src/ui/gui/psppire-dialog-action-tt1s.c +++ b/src/ui/gui/psppire-dialog-action-tt1s.c @@ -102,20 +102,13 @@ refresh (PsppireDialogAction *rd_) gtk_list_store_clear (GTK_LIST_STORE (model)); } -static void -psppire_dialog_action_tt1s_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_tt1s_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionTt1s *act = PSPPIRE_DIALOG_ACTION_TT1S (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("t-test.ui"); - g_hash_table_insert (thing, a, xml); - } - + GtkBuilder *xml = builder_new ( "t-test.ui"); GtkWidget *options_button = get_widget_assert (xml, "button1"); pda->dialog = get_widget_assert (xml, "t-test-one-sample-dialog"); @@ -134,7 +127,7 @@ psppire_dialog_action_tt1s_activate (PsppireDialogAction *a) g_signal_connect_swapped (options_button, "clicked", G_CALLBACK (tt_options_dialog_run), act->opt); - + return xml; } static void @@ -148,7 +141,7 @@ static void psppire_dialog_action_tt1s_class_init (PsppireDialogActionTt1sClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); - psppire_dialog_action_set_activation (class, psppire_dialog_action_tt1s_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_tt1s_activate; object_class->finalize = psppire_dialog_action_tt1s_finalize; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; diff --git a/src/ui/gui/psppire-dialog-action-two-sample.c b/src/ui/gui/psppire-dialog-action-two-sample.c index 1d8d92ca50..2ad9b5ce13 100644 --- a/src/ui/gui/psppire-dialog-action-two-sample.c +++ b/src/ui/gui/psppire-dialog-action-two-sample.c @@ -168,44 +168,38 @@ generate_syntax (const PsppireDialogAction *pda) return text; } -static void -psppire_dialog_action_two_sample_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_two_sample_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionTwoSample *act = PSPPIRE_DIALOG_ACTION_TWO_SAMPLE (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("paired-samples.ui"); - g_hash_table_insert (thing, a, xml); + GtkBuilder *xml = builder_new ( "paired-samples.ui"); + /* NPAR Specific options */ + GtkWidget *frame = gtk_frame_new (_("Test Type")); + GtkWidget *bb = gtk_button_box_new (GTK_ORIENTATION_VERTICAL); + GtkWidget *box = get_widget_assert (xml, "dynamic-populate"); - /* NPAR Specific options */ - GtkWidget *frame = gtk_frame_new (_("Test Type")); - GtkWidget *bb = gtk_button_box_new (GTK_ORIENTATION_VERTICAL); - GtkWidget *box = get_widget_assert (xml, "dynamic-populate"); + strcpy (act->nts[NT_WILCOXON].syntax, "/WILCOXON"); + strcpy (act->nts[NT_SIGN].syntax, "/SIGN"); + strcpy (act->nts[NT_MCNEMAR].syntax, "/MCNEMAR"); - strcpy (act->nts[NT_WILCOXON].syntax, "/WILCOXON"); - strcpy (act->nts[NT_SIGN].syntax, "/SIGN"); - strcpy (act->nts[NT_MCNEMAR].syntax, "/MCNEMAR"); + act->nts[NT_WILCOXON].button = gtk_check_button_new_with_mnemonic (_("_Wilcoxon")); + act->nts[NT_SIGN].button = gtk_check_button_new_with_mnemonic (_("_Sign")); + act->nts[NT_MCNEMAR].button = gtk_check_button_new_with_mnemonic (_("_McNemar")); - act->nts[NT_WILCOXON].button = gtk_check_button_new_with_mnemonic (_("_Wilcoxon")); - act->nts[NT_SIGN].button = gtk_check_button_new_with_mnemonic (_("_Sign")); - act->nts[NT_MCNEMAR].button = gtk_check_button_new_with_mnemonic (_("_McNemar")); + gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_WILCOXON].button, FALSE, FALSE, 5); + gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_SIGN].button, FALSE, FALSE, 5); + gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_MCNEMAR].button, FALSE, FALSE, 5); - gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_WILCOXON].button, FALSE, FALSE, 5); - gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_SIGN].button, FALSE, FALSE, 5); - gtk_box_pack_start (GTK_BOX (bb), act->nts[NT_MCNEMAR].button, FALSE, FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), bb); - gtk_container_add (GTK_CONTAINER (frame), bb); + gtk_widget_show_all (frame); - gtk_widget_show_all (frame); + gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 5); - gtk_box_pack_start (GTK_BOX (box), frame, FALSE, FALSE, 5); - } GtkWidget *selector = get_widget_assert (xml, "psppire-selector3"); @@ -228,13 +222,13 @@ psppire_dialog_action_two_sample_activate (PsppireDialogAction *a) psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), select_as_pair_member, act); - + return xml; } static void psppire_dialog_action_two_sample_class_init (PsppireDialogActionTwoSampleClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_two_sample_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_two_sample_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-univariate.c b/src/ui/gui/psppire-dialog-action-univariate.c index 6b6d41dd38..1e998105c7 100644 --- a/src/ui/gui/psppire-dialog-action-univariate.c +++ b/src/ui/gui/psppire-dialog-action-univariate.c @@ -82,19 +82,13 @@ refresh (PsppireDialogAction *rd_) gtk_list_store_clear (GTK_LIST_STORE (liststore)); } -static void -psppire_dialog_action_univariate_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_univariate_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionUnivariate *act = PSPPIRE_DIALOG_ACTION_UNIVARIATE (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("univariate.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ( "univariate.ui"); pda->dialog = get_widget_assert (xml, "univariate-dialog"); pda->source = get_widget_assert (xml, "dict-view"); @@ -104,13 +98,13 @@ psppire_dialog_action_univariate_activate (PsppireDialogAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); - + return xml; } static void psppire_dialog_action_univariate_class_init (PsppireDialogActionUnivariateClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_univariate_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_univariate_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-var-info.c b/src/ui/gui/psppire-dialog-action-var-info.c index b4fa39e4ac..9c7d4fd3e2 100644 --- a/src/ui/gui/psppire-dialog-action-var-info.c +++ b/src/ui/gui/psppire-dialog-action-var-info.c @@ -165,46 +165,42 @@ jump_to (PsppireDialog *d, gint response, gpointer data) g_free (vars); } -static void -psppire_dialog_action_var_info_activate (PsppireDialogAction *a) +static GtkBuilder * +psppire_dialog_action_var_info_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionVarInfo *act = PSPPIRE_DIALOG_ACTION_VAR_INFO (pda); - 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); + GtkBuilder *xml = builder_new ( "variable-info.ui"); - act->output = - psppire_output_view_new (GTK_LAYOUT (get_widget_assert (xml, "layout1")), - NULL); + act->output = + psppire_output_view_new (GTK_LAYOUT (get_widget_assert (xml, "layout1")), + NULL); - pda->dialog = get_widget_assert (xml, "variable-info-dialog"); - pda->source = get_widget_assert (xml, "treeview2"); + pda->dialog = get_widget_assert (xml, "variable-info-dialog"); + pda->source = get_widget_assert (xml, "treeview2"); - g_object_set (pda->source, - "selection-mode", GTK_SELECTION_MULTIPLE, - NULL); + g_object_set (pda->source, + "selection-mode", GTK_SELECTION_MULTIPLE, + NULL); - g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (pda->source)), - "changed", G_CALLBACK (populate_output), - act); + g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (pda->source)), + "changed", G_CALLBACK (populate_output), + act); - g_signal_connect (pda->dialog, "response", G_CALLBACK (jump_to), - pda); + g_signal_connect (pda->dialog, "response", G_CALLBACK (jump_to), + pda); - psppire_dialog_action_set_valid_predicate (pda, - treeview_item_selected); - } + psppire_dialog_action_set_valid_predicate (pda, + treeview_item_selected); + + return xml; } static void psppire_dialog_action_var_info_class_init (PsppireDialogActionVarInfoClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_var_info_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_var_info_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action-weight.c b/src/ui/gui/psppire-dialog-action-weight.c index ec604ec97c..280d3c3c48 100644 --- a/src/ui/gui/psppire-dialog-action-weight.c +++ b/src/ui/gui/psppire-dialog-action-weight.c @@ -119,49 +119,43 @@ on_toggle (GtkToggleButton *off, gpointer data) } -static void -psppire_dialog_action_weight_activate (PsppireDialogAction *pda) +static GtkBuilder * +psppire_dialog_action_weight_activate (PsppireDialogAction *pda, GVariant *param) { PsppireDialogActionWeight *act = PSPPIRE_DIALOG_ACTION_WEIGHT (pda); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, pda); - if (!xml) - { - xml = builder_new ("weight.ui"); - g_hash_table_insert (thing, pda, xml); + GtkBuilder *xml = builder_new ( "weight.ui"); - pda->dialog = get_widget_assert (xml, "weight-cases-dialog"); - pda->source = get_widget_assert (xml, "weight-cases-treeview"); + pda->dialog = get_widget_assert (xml, "weight-cases-dialog"); + pda->source = get_widget_assert (xml, "weight-cases-treeview"); - act->entry = get_widget_assert (xml, "weight-cases-entry"); - act->off = get_widget_assert (xml,"weight-cases-radiobutton1"); - act->on = get_widget_assert (xml, "radiobutton2"); - act->status = get_widget_assert (xml, "weight-status-label"); - GtkWidget *selector = get_widget_assert (xml, "weight-cases-selector"); + act->entry = get_widget_assert (xml, "weight-cases-entry"); + act->off = get_widget_assert (xml,"weight-cases-radiobutton1"); + act->on = get_widget_assert (xml, "radiobutton2"); + act->status = get_widget_assert (xml, "weight-status-label"); + GtkWidget *selector = get_widget_assert (xml, "weight-cases-selector"); - g_signal_connect (selector, "selected", G_CALLBACK (on_select), act); - g_signal_connect (selector, "de-selected", G_CALLBACK (on_deselect), act); - g_signal_connect (act->off, "toggled", G_CALLBACK (on_toggle), act); + g_signal_connect (selector, "selected", G_CALLBACK (on_select), act); + g_signal_connect (selector, "de-selected", G_CALLBACK (on_deselect), act); + g_signal_connect (act->off, "toggled", G_CALLBACK (on_toggle), act); - g_object_set (pda->source, - "selection-mode", GTK_SELECTION_SINGLE, - "predicate", var_is_numeric, - NULL); + g_object_set (pda->source, + "selection-mode", GTK_SELECTION_SINGLE, + "predicate", var_is_numeric, + NULL); - psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector), - is_currently_in_entry); - } + psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector), + is_currently_in_entry); psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); - + return xml; } static void psppire_dialog_action_weight_class_init (PsppireDialogActionWeightClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_weight_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_weight_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } diff --git a/src/ui/gui/psppire-dialog-action.c b/src/ui/gui/psppire-dialog-action.c index 70a5a9d4aa..9eeed98d8d 100644 --- a/src/ui/gui/psppire-dialog-action.c +++ b/src/ui/gui/psppire-dialog-action.c @@ -22,6 +22,7 @@ #include "executor.h" #include "helper.h" #include "psppire-data-window.h" +#include "builder-wrapper.h" static void psppire_dialog_action_init (PsppireDialogAction *act); static void psppire_dialog_action_class_init (PsppireDialogActionClass *class); @@ -216,6 +217,14 @@ psppire_dialog_action_get_hash_table (PsppireDialogAction *act) return t; } +GtkBuilder * +psppire_dialog_action_get_xml (PsppireDialogAction *da) +{ + GHashTable *thing = psppire_dialog_action_get_hash_table (da); + GtkBuilder *xml = g_hash_table_lookup (thing, da); + return xml; +} + static void psppire_dialog_action_activate (PsppireDialogAction *act, GVariant *parameter) @@ -230,9 +239,25 @@ psppire_dialog_action_activate (PsppireDialogAction *act, GVariant *parameter) wl = g_slist_prepend (wl, act->dialog); g_object_set_data (G_OBJECT (act->toplevel), "widget-list", wl); - if (class->activate) - class->activate (act, parameter); + if (class->initial_activate) + { + GHashTable *thing = psppire_dialog_action_get_hash_table (act); + GtkBuilder *xml = g_hash_table_lookup (thing, act); + if (xml == NULL) + { + xml = class->initial_activate (act, parameter); + g_hash_table_insert (thing, act, xml); + } + } + if (class->activate) + { + GHashTable *thing = psppire_dialog_action_get_hash_table (act); + GtkBuilder *xml = g_hash_table_lookup (thing, act); + if (xml != NULL) + class->activate (act, parameter); + } + gtk_window_set_transient_for (GTK_WINDOW (act->dialog), GTK_WINDOW (act->toplevel)); @@ -285,8 +310,6 @@ psppire_dialog_action_class_init (PsppireDialogActionClass *class) class->generate_syntax = NULL; - class->activate = psppire_dialog_action_activate; - g_object_class_install_property (object_class, PROP_TOPLEVEL, toplevel_spec); @@ -322,11 +345,3 @@ psppire_dialog_action_set_refresh (PsppireDialogAction *pda, { g_signal_connect_swapped (pda->dialog, "refresh", G_CALLBACK (refresh), pda); } - - -void -psppire_dialog_action_set_activation (gpointer class, activation activate) -{ - PSPPIRE_DIALOG_ACTION_CLASS (class)->activate = (void (*)(PsppireDialogAction *, GVariant *)) activate; -} - diff --git a/src/ui/gui/psppire-dialog-action.h b/src/ui/gui/psppire-dialog-action.h index 1d613e1b6f..8f79acc4c0 100644 --- a/src/ui/gui/psppire-dialog-action.h +++ b/src/ui/gui/psppire-dialog-action.h @@ -83,6 +83,7 @@ struct _PsppireDialogAction struct _PsppireDialogActionClass { GObjectClass parent_class; + GtkBuilder * (*initial_activate) (PsppireDialogAction *, GVariant *); void (*activate) (PsppireDialogAction *, GVariant *); char * (*generate_syntax) (const PsppireDialogAction *); }; @@ -97,15 +98,11 @@ void psppire_dialog_action_set_refresh (PsppireDialogAction *pda, void psppire_dialog_action_set_valid_predicate (PsppireDialogAction *act, ContentsAreValid dialog_state_valid); -typedef void (*activation) (PsppireDialogAction *); +GtkBuilder * psppire_dialog_action_get_xml (PsppireDialogAction *da); -void psppire_dialog_action_set_activation (gpointer class, activation a); - -GHashTable *psppire_dialog_action_get_hash_table (PsppireDialogAction *act); void psppire_dialog_action_activate_null (PsppireDialogAction *act); - G_END_DECLS #endif /* __PSPPIRE_DIALOG_ACTION_H__ */ -- 2.30.2