From: John Darrington Date: Tue, 17 Nov 2009 18:29:56 +0000 (+0100) Subject: Separated psppire_selector_set_subjects into two individual functions X-Git-Tag: sid-i386-build122~21 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b94025a12799b6826a772731b8f58907dca2cf5c;p=pspp-builds.git Separated psppire_selector_set_subjects into two individual functions --- diff --git a/src/ui/gui/compute-dialog.c b/src/ui/gui/compute-dialog.c index bac62167..8a98bb3d 100644 --- a/src/ui/gui/compute-dialog.c +++ b/src/ui/gui/compute-dialog.c @@ -379,7 +379,6 @@ compute_dialog (GObject *o, gpointer data) GtkWidget *functions = get_widget_assert (xml, "compute-treeview2"); GtkWidget *keypad = get_widget_assert (xml, "psppire-keypad1"); GtkWidget *target = get_widget_assert (xml, "compute-entry1"); - GtkWidget *syntax_area = get_widget_assert (xml, "compute-textview1"); GtkWidget *var_selector = get_widget_assert (xml, "compute-selector1"); GtkWidget *func_selector = get_widget_assert (xml, "compute-selector2"); GtkWidget *type_and_label = get_widget_assert (xml, "compute-button1"); @@ -402,19 +401,13 @@ compute_dialog (GObject *o, gpointer data) "selection-mode", GTK_SELECTION_SINGLE, NULL); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (var_selector), - insert_source_row_into_text_view, - NULL, - NULL); - + psppire_selector_set_select_func (PSPPIRE_SELECTOR (var_selector), + insert_source_row_into_text_view, NULL); function_list_populate (GTK_TREE_VIEW (functions)); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (func_selector), - insert_function_into_syntax_area, - NULL, - NULL); - + psppire_selector_set_select_func (PSPPIRE_SELECTOR (func_selector), + insert_function_into_syntax_area, NULL); scd.xml = xml; diff --git a/src/ui/gui/crosstabs-dialog.c b/src/ui/gui/crosstabs-dialog.c index 791eea25..8198520d 100644 --- a/src/ui/gui/crosstabs-dialog.c +++ b/src/ui/gui/crosstabs-dialog.c @@ -429,15 +429,13 @@ crosstabs_dialog (GObject *o, gpointer data) set_dest_model (GTK_TREE_VIEW (dest_rows), dict); set_dest_model (GTK_TREE_VIEW (dest_cols), dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (row_selector), - insert_source_row_into_tree_view, - NULL, - NULL); - - psppire_selector_set_subjects (PSPPIRE_SELECTOR (col_selector), - insert_source_row_into_tree_view, - NULL, - NULL); + psppire_selector_set_select_func (PSPPIRE_SELECTOR (row_selector), + insert_source_row_into_tree_view, + NULL); + + psppire_selector_set_select_func (PSPPIRE_SELECTOR (col_selector), + insert_source_row_into_tree_view, + NULL); cd.row_vars = GTK_TREE_VIEW (dest_rows); cd.col_vars = GTK_TREE_VIEW (dest_cols); diff --git a/src/ui/gui/descriptives-dialog.c b/src/ui/gui/descriptives-dialog.c index 5af2e71a..c29e1d8d 100644 --- a/src/ui/gui/descriptives-dialog.c +++ b/src/ui/gui/descriptives-dialog.c @@ -231,10 +231,8 @@ descriptives_dialog (GObject *o, gpointer data) set_dest_model (GTK_TREE_VIEW (dest), dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector), - insert_source_row_into_tree_view, - NULL, - NULL); + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), + insert_source_row_into_tree_view, NULL); put_checkbox_items_in_treeview (GTK_TREE_VIEW (stats_treeview), B_DS_DEFAULT, diff --git a/src/ui/gui/examine-dialog.c b/src/ui/gui/examine-dialog.c index 79ba48e9..09b5f8b8 100644 --- a/src/ui/gui/examine-dialog.c +++ b/src/ui/gui/examine-dialog.c @@ -285,9 +285,9 @@ examine_dialog (GObject *o, gpointer data) set_dest_model (GTK_TREE_VIEW (ex_d.dep_list), ex_d.dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (dep_selector), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (dep_selector), insert_source_row_into_tree_view, - NULL, NULL); + NULL); psppire_selector_set_allow (PSPPIRE_SELECTOR (dep_selector), numeric_only); @@ -295,14 +295,14 @@ examine_dialog (GObject *o, gpointer data) set_dest_model (GTK_TREE_VIEW (ex_d.fct_list), ex_d.dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (fct_selector), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (fct_selector), insert_source_row_into_tree_view, - NULL, NULL); + NULL); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (id_selector), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (id_selector), insert_source_row_into_entry, - NULL, NULL); + NULL); g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), &ex_d); diff --git a/src/ui/gui/find-dialog.c b/src/ui/gui/find-dialog.c index 39b12bb5..07b73fe8 100644 --- a/src/ui/gui/find-dialog.c +++ b/src/ui/gui/find-dialog.c @@ -246,11 +246,13 @@ find_dialog (GObject *o, gpointer data) "selection-mode", GTK_SELECTION_SINGLE, NULL); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector), - insert_source_row_into_entry, - is_currently_in_entry, - NULL - ); + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), + insert_source_row_into_entry, + NULL + ); + + psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector), + is_currently_in_entry); g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), &fd); diff --git a/src/ui/gui/frequencies-dialog.c b/src/ui/gui/frequencies-dialog.c index 0ec5a73f..1d6a3a2a 100644 --- a/src/ui/gui/frequencies-dialog.c +++ b/src/ui/gui/frequencies-dialog.c @@ -340,9 +340,8 @@ frequencies_dialog (GObject *o, gpointer data) set_dest_model (GTK_TREE_VIEW (dest), fd.dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), insert_source_row_into_tree_view, - NULL, NULL); diff --git a/src/ui/gui/oneway-anova-dialog.c b/src/ui/gui/oneway-anova-dialog.c index 3234c323..e1e3c5ae 100644 --- a/src/ui/gui/oneway-anova-dialog.c +++ b/src/ui/gui/oneway-anova-dialog.c @@ -176,18 +176,19 @@ oneway_anova_dialog (GObject *o, gpointer data) set_dest_model (GTK_TREE_VIEW (ow.vars_treeview), ow.dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector1), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector1), insert_source_row_into_tree_view, - NULL, NULL); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector2), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector2), insert_source_row_into_entry, - is_currently_in_entry, NULL); + psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector2), + is_currently_in_entry); + g_signal_connect_swapped (ow.dialog, "refresh", G_CALLBACK (refresh), &ow); diff --git a/src/ui/gui/psppire-selector.c b/src/ui/gui/psppire-selector.c index 7e0ade25..914c8701 100644 --- a/src/ui/gui/psppire-selector.c +++ b/src/ui/gui/psppire-selector.c @@ -303,6 +303,11 @@ psppire_selector_base_finalize(PsppireSelectorClass *class, static void psppire_selector_init (PsppireSelector *selector) { + selector->select_user_data = NULL; + selector->select_items = NULL; + selector->allow_selection = NULL; + selector->filter = NULL; + selector->arrow = gtk_arrow_new (GTK_ARROW_LEFT, GTK_SHADOW_NONE); selector->filtered_source = NULL; @@ -863,6 +868,12 @@ update_subjects (PsppireSelector *selector) if ( NULL == selector->dest ) return; + if ( selector->filter == NULL) + { + if (GTK_IS_TREE_VIEW (selector->dest)) + selector->filter = is_item_in_dest; + } + if ( NULL == selector->source ) return; @@ -900,22 +911,28 @@ update_subjects (PsppireSelector *selector) } -/* Set SELECT_FUNC and FILTER_FUNC for this selector */ +/* Set FILTER_FUNC for this selector */ void -psppire_selector_set_subjects (PsppireSelector *selector, - SelectItemsFunc *select_func, - FilterItemsFunc *filter_func, - gpointer user_data) +psppire_selector_set_filter_func (PsppireSelector *selector, + FilterItemsFunc *filter_func) { selector->filter = filter_func ; - selector->select_user_data = user_data; - if ( filter_func == NULL) + if ( selector->filter == NULL) { if (GTK_IS_TREE_VIEW (selector->dest)) selector->filter = is_item_in_dest; } +} + +/* Set SELECT_FUNC for this selector */ +void +psppire_selector_set_select_func (PsppireSelector *selector, + SelectItemsFunc *select_func, + gpointer user_data) +{ + selector->select_user_data = user_data; selector->select_items = select_func; } diff --git a/src/ui/gui/psppire-selector.h b/src/ui/gui/psppire-selector.h index 8174f97c..ebe8fb66 100644 --- a/src/ui/gui/psppire-selector.h +++ b/src/ui/gui/psppire-selector.h @@ -113,12 +113,19 @@ struct _PsppireSelectorClass GType psppire_selector_get_type (void); GtkWidget* psppire_selector_new (void); -void psppire_selector_set_subjects (PsppireSelector *, - SelectItemsFunc *, - FilterItemsFunc *, - gpointer ); -void psppire_selector_set_allow (PsppireSelector *, AllowSelectionFunc *); + +/* Set FILTER_FUNC for this selector */ +void psppire_selector_set_filter_func (PsppireSelector *selector, + FilterItemsFunc *filter_func); + +/* Set SELECT_FUNC for this selector */ +void psppire_selector_set_select_func (PsppireSelector *selector, + SelectItemsFunc *select_func, + gpointer user_data); + + +void psppire_selector_set_allow (PsppireSelector *, AllowSelectionFunc *); GType psppire_selector_orientation_get_type (void) G_GNUC_CONST; diff --git a/src/ui/gui/rank-dialog.c b/src/ui/gui/rank-dialog.c index e0d76484..157f2136 100644 --- a/src/ui/gui/rank-dialog.c +++ b/src/ui/gui/rank-dialog.c @@ -310,16 +310,14 @@ rank_dialog (GObject *o, gpointer data) set_dest_model (GTK_TREE_VIEW (rd.rank_vars), rd.dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector1), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector1), insert_source_row_into_tree_view, - NULL, NULL); set_dest_model (GTK_TREE_VIEW (rd.group_vars), rd.dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector2), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector2), insert_source_row_into_tree_view, - NULL, NULL); diff --git a/src/ui/gui/recode-dialog.c b/src/ui/gui/recode-dialog.c index e7fcc6c8..16a20cb1 100644 --- a/src/ui/gui/recode-dialog.c +++ b/src/ui/gui/recode-dialog.c @@ -951,9 +951,8 @@ recode_dialog (PsppireDataWindow *de, gboolean diff) - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), insert_source_row_into_tree_view, - NULL, NULL); psppire_selector_set_allow (PSPPIRE_SELECTOR (selector), homogeneous_types); diff --git a/src/ui/gui/regression-dialog.c b/src/ui/gui/regression-dialog.c index 7d3420af..b52f0f7c 100644 --- a/src/ui/gui/regression-dialog.c +++ b/src/ui/gui/regression-dialog.c @@ -259,14 +259,12 @@ regression_dialog (GObject *o, gpointer data) set_dest_model (GTK_TREE_VIEW (dest_dep), rd.dict); set_dest_model (GTK_TREE_VIEW (dest_indep), rd.dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (dep_selector), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (dep_selector), insert_source_row_into_tree_view, - NULL, NULL); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (indep_selector), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (indep_selector), insert_source_row_into_tree_view, - NULL, NULL); rd.dep_vars = GTK_TREE_VIEW (dest_dep); diff --git a/src/ui/gui/reliability-dialog.c b/src/ui/gui/reliability-dialog.c index d087ed84..3d661a5c 100644 --- a/src/ui/gui/reliability-dialog.c +++ b/src/ui/gui/reliability-dialog.c @@ -142,9 +142,8 @@ reliability_dialog (GObject *o, gpointer data) set_dest_model (GTK_TREE_VIEW (rd.variables), rd.dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), insert_source_row_into_tree_view, - NULL, NULL); { diff --git a/src/ui/gui/select-cases-dialog.c b/src/ui/gui/select-cases-dialog.c index f9d0631e..63061b1f 100644 --- a/src/ui/gui/select-cases-dialog.c +++ b/src/ui/gui/select-cases-dialog.c @@ -331,10 +331,14 @@ select_cases_dialog (GObject *o, gpointer data) "selection-mode", GTK_SELECTION_SINGLE, NULL); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), insert_source_row_into_entry, - is_currently_in_entry, NULL); + + psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector), + is_currently_in_entry); + + } diff --git a/src/ui/gui/sort-cases-dialog.c b/src/ui/gui/sort-cases-dialog.c index 7db07bcd..337aaf05 100644 --- a/src/ui/gui/sort-cases-dialog.c +++ b/src/ui/gui/sort-cases-dialog.c @@ -116,9 +116,8 @@ sort_cases_dialog (GObject *o, gpointer data) set_dest_model (GTK_TREE_VIEW (dest), scd.dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), insert_source_row_into_tree_view, - NULL, NULL); g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), dest); diff --git a/src/ui/gui/split-file-dialog.c b/src/ui/gui/split-file-dialog.c index 57de568a..3546f844 100644 --- a/src/ui/gui/split-file-dialog.c +++ b/src/ui/gui/split-file-dialog.c @@ -197,9 +197,8 @@ split_file_dialog (GObject *o, gpointer data) set_dest_model (GTK_TREE_VIEW (dest), sfd.dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), insert_source_row_into_tree_view, - NULL, NULL); g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), &sfd); diff --git a/src/ui/gui/t-test-independent-samples-dialog.c b/src/ui/gui/t-test-independent-samples-dialog.c index 6e6e678f..473e04e0 100644 --- a/src/ui/gui/t-test-independent-samples-dialog.c +++ b/src/ui/gui/t-test-independent-samples-dialog.c @@ -431,20 +431,21 @@ t_test_independent_samples_dialog (GObject *o, gpointer data) set_dest_model (GTK_TREE_VIEW (test_variables_treeview), tt_d.dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector1), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector1), insert_source_row_into_tree_view, - NULL, NULL); psppire_selector_set_allow (PSPPIRE_SELECTOR (selector1), numeric_only); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector2), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector2), insert_source_row_into_entry, - is_currently_in_entry, NULL); + psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector2), + is_currently_in_entry); + g_signal_connect_swapped (tt_d.define_groups_button, "clicked", G_CALLBACK (run_define_groups), &tt_d); diff --git a/src/ui/gui/t-test-one-sample.c b/src/ui/gui/t-test-one-sample.c index 53f92e1d..1161db5b 100644 --- a/src/ui/gui/t-test-one-sample.c +++ b/src/ui/gui/t-test-one-sample.c @@ -156,9 +156,8 @@ t_test_one_sample_dialog (GObject *o, gpointer data) set_dest_model (GTK_TREE_VIEW (tt_d.vars_treeview), tt_d.dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), insert_source_row_into_tree_view, - NULL, NULL); diff --git a/src/ui/gui/t-test-paired-samples.c b/src/ui/gui/t-test-paired-samples.c index 1eee1de6..a021ce2c 100644 --- a/src/ui/gui/t-test-paired-samples.c +++ b/src/ui/gui/t-test-paired-samples.c @@ -228,11 +228,9 @@ t_test_paired_samples_dialog (GObject *o, gpointer data) } - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector), - select_as_pair_member, - NULL, - &tt_d); - + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), + select_as_pair_member, + &tt_d); g_signal_connect_swapped (dialog, "refresh", G_CALLBACK (refresh), &tt_d); diff --git a/src/ui/gui/transpose-dialog.c b/src/ui/gui/transpose-dialog.c index 83a75cba..2bc7e7b3 100644 --- a/src/ui/gui/transpose-dialog.c +++ b/src/ui/gui/transpose-dialog.c @@ -99,17 +99,18 @@ transpose_dialog (GObject *o, gpointer data) set_dest_model (GTK_TREE_VIEW (dest), dict); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector1), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector1), insert_source_row_into_tree_view, - NULL, NULL); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector2), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector2), insert_source_row_into_entry, - is_currently_in_entry, NULL); + psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector2), + is_currently_in_entry); + g_signal_connect (dialog, "refresh", G_CALLBACK (refresh), xml); diff --git a/src/ui/gui/weight-cases-dialog.c b/src/ui/gui/weight-cases-dialog.c index 03aea92d..1871f7aa 100644 --- a/src/ui/gui/weight-cases-dialog.c +++ b/src/ui/gui/weight-cases-dialog.c @@ -137,11 +137,13 @@ weight_cases_dialog (GObject *o, gpointer data) "predicate", var_is_numeric, NULL); - psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector), + psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector), insert_source_row_into_entry, - is_currently_in_entry, - NULL - ); + NULL); + + psppire_selector_set_filter_func (PSPPIRE_SELECTOR (selector), + is_currently_in_entry); + wcd.entry = GTK_ENTRY (entry); wcd.status = GTK_LABEL (status);