Separated psppire_selector_set_subjects into two individual functions
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 17 Nov 2009 18:29:56 +0000 (19:29 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 17 Nov 2009 18:29:56 +0000 (19:29 +0100)
21 files changed:
src/ui/gui/compute-dialog.c
src/ui/gui/crosstabs-dialog.c
src/ui/gui/descriptives-dialog.c
src/ui/gui/examine-dialog.c
src/ui/gui/find-dialog.c
src/ui/gui/frequencies-dialog.c
src/ui/gui/oneway-anova-dialog.c
src/ui/gui/psppire-selector.c
src/ui/gui/psppire-selector.h
src/ui/gui/rank-dialog.c
src/ui/gui/recode-dialog.c
src/ui/gui/regression-dialog.c
src/ui/gui/reliability-dialog.c
src/ui/gui/select-cases-dialog.c
src/ui/gui/sort-cases-dialog.c
src/ui/gui/split-file-dialog.c
src/ui/gui/t-test-independent-samples-dialog.c
src/ui/gui/t-test-one-sample.c
src/ui/gui/t-test-paired-samples.c
src/ui/gui/transpose-dialog.c
src/ui/gui/weight-cases-dialog.c

index bac6216729350cd040ab447a4191e09b6f49e168..8a98bb3dcac48d8158812d5f9b96bb7c4df6b687 100644 (file)
@@ -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;
 
index 791eea2563871ec7768e5356d8b619632fd7c6b8..8198520d6b686222f518dc4664d32d7db007b28d 100644 (file)
@@ -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);
index 5af2e71ab4d1ae1239495fdb2aeae923587afc85..c29e1d8d66c14a8cda6f6b98f8efc3e3ed6e2370 100644 (file)
@@ -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,
index 79ba48e9b45bc05edbbf604f3b48919c2fed804d..09b5f8b819182e2ae24450e24ebf8f2e9b89bb3c 100644 (file)
@@ -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);
 
index 39b12bb51c163b9e10b756eee22f64765d46b50d..07b73fe84c93d6cdb9e52f51c60a694f4ba0b0dd 100644 (file)
@@ -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);
 
index 0ec5a73f9915bfd2ba58520b04281fce6b29a860..1d6a3a2a4b322e8931be6ee8219a90e891957ab8 100644 (file)
@@ -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);
 
 
index 3234c32325b544140676080aa1ab94802e6fb14a..e1e3c5aeca6542b7cdc48b22cdca3d1113fc37a1 100644 (file)
@@ -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);
 
index 7e0ade25009dd019125f8e7cc8b4a96df4c2f967..914c870174907e22d2b250797a3d20ba231d3e40 100644 (file)
@@ -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;
 }
 
index 8174f97c8f5f4a20a1888774e75a05e72402d1fc..ebe8fb66247a07e646534653d249c13823d196ff 100644 (file)
@@ -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;
index e0d764842d57bd039e645e514d7258d7315139fe..157f213609dc3ccc8d4f517a74649c00eba4df1b 100644 (file)
@@ -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);
 
 
index e7fcc6c81f6c2ac4e6cb51df08fd756ec88e1196..16a20cb1fd93f92ee3cb285ee85996c9852d88c9 100644 (file)
@@ -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);
index 7d3420afe43c05b227c388950c0fb200b5371b29..b52f0f7cd8e2dbc79334d767953ac395c24842d6 100644 (file)
@@ -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);
index d087ed840db21557bd9f4d1c14ded406f1180bcf..3d661a5c50695a76929ba2191b809256e5cf80a6 100644 (file)
@@ -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);
 
   {
index f9d0631ea221602bee6f93258dd065ffd3a3dcdc..63061b1fa3a4b98cd1a2ab1ae92827c53d373497 100644 (file)
@@ -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);
+
+
   }
 
 
index 7db07bcdc8d35ca1cfebd517e54b4577ba3469a0..337aaf053ffba5620de4f6436b09a0f0b602d0a0 100644 (file)
@@ -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);
index 57de568ac24ce855c9198fff9a2ea3af6570217a..3546f84450b7f0188fb19f9180d5950b90245047 100644 (file)
@@ -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);
index 6e6e678f85711c4889e253baa9d7502b820f2e4f..473e04e02b2f86d09dd150862cff4baadb4e78dd 100644 (file)
@@ -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);
 
index 53f92e1d8e18bf6a25dea8c2f15f887a49fd471b..1161db5b8d28edc1fc08f672a605ed32894f336f 100644 (file)
@@ -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);
 
 
index 1eee1de6584f5666e567dcb40f96e92b4fb134f2..a021ce2c3897e19368a3b87468d3f4ce80c4479b 100644 (file)
@@ -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);
index 83a75cba322c3b613973ab51d8ad9a19200b7702..2bc7e7b38073d145b75c6b05c9a0f288a24b59b4 100644 (file)
@@ -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);
 
index 03aea92def8045748c846bfd75626bb01e50d362..1871f7aa9c40a417054c69e12bd4665440e7236b 100644 (file)
@@ -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);