From: John Darrington <john@darrington.wattle.id.au>
Date: Sun, 15 Nov 2009 21:30:18 +0000 (+0100)
Subject: PsppireSelector: new properties: "source-widget" and "dest-widget".
X-Git-Tag: sav-api~409^2~50
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c2fa3735ac1115b6c1ad4b5e0613673de2faf4c;p=pspp

PsppireSelector: new properties: "source-widget" and "dest-widget".

Previously, a function psppire_selector_set_subjects was used to
set the destination and source widgets of a PsppireSelector.  This
change adds two new properties, and sets them in the GtkBuilder
definitions instead of in the C code.
---

diff --git a/glade/psppire.xml b/glade/psppire.xml
index 50a0366186..5673d6779b 100644
--- a/glade/psppire.xml
+++ b/glade/psppire.xml
@@ -173,8 +173,9 @@
 	  </displayable-values>
 	</property>
 
-
-	<property id="visible" ignore="True" default="True" />
+	<property id="source-widget"     ignore="True" />
+	<property id="dest-widget"       ignore="True" />
+	<property id="visible"           ignore="True" default="True" />
      </properties>
 
     </glade-widget-class>
diff --git a/src/ui/gui/compute-dialog.c b/src/ui/gui/compute-dialog.c
index c09c757193..34f686162b 100644
--- a/src/ui/gui/compute-dialog.c
+++ b/src/ui/gui/compute-dialog.c
@@ -403,7 +403,6 @@ compute_dialog (GObject *o, gpointer data)
 		NULL);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (var_selector),
-				 dict_view, syntax_area,
 				 insert_source_row_into_text_view,
 				 NULL,
 				 NULL);
@@ -412,7 +411,6 @@ compute_dialog (GObject *o, gpointer data)
   function_list_populate (GTK_TREE_VIEW (functions));
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (func_selector),
-				 functions, syntax_area,
 				 insert_function_into_syntax_area,
 				 NULL,
 				 NULL);
diff --git a/src/ui/gui/crosstabs-dialog.c b/src/ui/gui/crosstabs-dialog.c
index 019d8c361d..1fa3bff21a 100644
--- a/src/ui/gui/crosstabs-dialog.c
+++ b/src/ui/gui/crosstabs-dialog.c
@@ -430,15 +430,11 @@ crosstabs_dialog (GObject *o, gpointer data)
   set_dest_model (GTK_TREE_VIEW (dest_cols), dict);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (row_selector),
-				 source,
-				 dest_rows,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (col_selector),
-				 source,
-				 dest_cols,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
diff --git a/src/ui/gui/crosstabs.ui b/src/ui/gui/crosstabs.ui
index c556c47816..cb90d3cc7b 100644
--- a/src/ui/gui/crosstabs.ui
+++ b/src/ui/gui/crosstabs.ui
@@ -173,6 +173,8 @@
                 <property name="receives_default">True</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                 <property name="border_width">5</property>
+                <property name="source_widget">dict-treeview</property>
+                <property name="dest_widget">rows</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
@@ -188,6 +190,8 @@
                 <property name="receives_default">True</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                 <property name="border_width">5</property>
+                <property name="source_widget">dict-treeview</property>
+                <property name="dest_widget">cols</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
diff --git a/src/ui/gui/descriptives-dialog.c b/src/ui/gui/descriptives-dialog.c
index 318646f8ef..1b49d92130 100644
--- a/src/ui/gui/descriptives-dialog.c
+++ b/src/ui/gui/descriptives-dialog.c
@@ -232,8 +232,6 @@ descriptives_dialog (GObject *o, gpointer data)
   set_dest_model (GTK_TREE_VIEW (dest), dict);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
-				 source,
-				 dest,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
diff --git a/src/ui/gui/descriptives.ui b/src/ui/gui/descriptives.ui
index f5dc93f242..f43ed49566 100644
--- a/src/ui/gui/descriptives.ui
+++ b/src/ui/gui/descriptives.ui
@@ -56,6 +56,8 @@
                         <property name="receives_default">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                         <property name="border_width">5</property>
+                        <property name="source_widget">all-variables</property>
+                        <property name="dest_widget">stat-variables</property>
                       </object>
                     </child>
                   </object>
diff --git a/src/ui/gui/dict-display.c b/src/ui/gui/dict-display.c
index 1665d7ff3f..b06fcb4b53 100644
--- a/src/ui/gui/dict-display.c
+++ b/src/ui/gui/dict-display.c
@@ -125,7 +125,12 @@ is_currently_in_entry (GtkTreeModel *model, GtkTreeIter *iter,
   gint dict_index;
   gint *indeces;
   GtkTreePath *path;
-  const gchar *text =  gtk_entry_get_text (GTK_ENTRY (selector->dest));
+  GtkWidget *entry = NULL;
+  const gchar *text = NULL;
+
+  g_object_get (selector, "dest-widget", &entry, NULL);
+
+  text = gtk_entry_get_text (GTK_ENTRY (entry));
 
   get_base_model (model, iter, &dict, &dict_iter);
 
diff --git a/src/ui/gui/examine-dialog.c b/src/ui/gui/examine-dialog.c
index 470c4dbbe3..85505f72bb 100644
--- a/src/ui/gui/examine-dialog.c
+++ b/src/ui/gui/examine-dialog.c
@@ -286,8 +286,6 @@ examine_dialog (GObject *o, gpointer data)
 
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (dep_selector),
-				 source,
-				 ex_d.dep_list,
 				 insert_source_row_into_tree_view,
 				 NULL, NULL);
 
@@ -298,15 +296,11 @@ examine_dialog (GObject *o, gpointer data)
 
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (fct_selector),
-				 source,
-				 ex_d.fct_list,
 				 insert_source_row_into_tree_view,
 				 NULL, NULL);
 
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (id_selector),
-				 source,
-				 ex_d.id_entry,
 				 insert_source_row_into_entry,
 				 NULL, NULL);
 
diff --git a/src/ui/gui/examine.ui b/src/ui/gui/examine.ui
index 273c19bc8d..e2acfc3f23 100644
--- a/src/ui/gui/examine.ui
+++ b/src/ui/gui/examine.ui
@@ -160,6 +160,8 @@
                     <property name="receives_default">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <property name="border_width">5</property>
+                    <property name="source_widget">treeview1</property>
+                    <property name="dest_widget">entry1</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
@@ -177,6 +179,8 @@
                     <property name="receives_default">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <property name="border_width">5</property>
+                    <property name="source_widget">treeview1</property>
+                    <property name="dest_widget">treeview3</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
@@ -194,6 +198,8 @@
                     <property name="receives_default">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <property name="border_width">5</property>
+                    <property name="source_widget">treeview1</property>
+                    <property name="dest_widget">treeview2</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
diff --git a/src/ui/gui/find-dialog.c b/src/ui/gui/find-dialog.c
index 11ec0603d4..608a4d187c 100644
--- a/src/ui/gui/find-dialog.c
+++ b/src/ui/gui/find-dialog.c
@@ -247,8 +247,6 @@ find_dialog (GObject *o, gpointer data)
 	NULL);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
-				 source,
-				 fd.variable_entry,
 				 insert_source_row_into_entry,
 				 is_currently_in_entry,
 				 NULL
diff --git a/src/ui/gui/frequencies-dialog.c b/src/ui/gui/frequencies-dialog.c
index 8706f3a4e6..2f74e9d263 100644
--- a/src/ui/gui/frequencies-dialog.c
+++ b/src/ui/gui/frequencies-dialog.c
@@ -341,8 +341,6 @@ frequencies_dialog (GObject *o, gpointer data)
 
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
-				 source,
-				 dest,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
diff --git a/src/ui/gui/frequencies.ui b/src/ui/gui/frequencies.ui
index 47e25d49f3..1a24657850 100644
--- a/src/ui/gui/frequencies.ui
+++ b/src/ui/gui/frequencies.ui
@@ -56,6 +56,8 @@
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                         <property name="no_show_all">True</property>
                         <property name="border_width">5</property>
+                        <property name="source_widget">dict-treeview</property>
+                        <property name="dest_widget">var-treeview</property>
                       </object>
                     </child>
                   </object>
diff --git a/src/ui/gui/oneway-anova-dialog.c b/src/ui/gui/oneway-anova-dialog.c
index 1814dd6737..ea390c3342 100644
--- a/src/ui/gui/oneway-anova-dialog.c
+++ b/src/ui/gui/oneway-anova-dialog.c
@@ -177,14 +177,12 @@ oneway_anova_dialog (GObject *o, gpointer data)
 
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector1),
-				 dict_view, ow.vars_treeview,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
 
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector2),
-				 dict_view, ow.factor_entry,
 				 insert_source_row_into_entry,
 				 is_currently_in_entry,
 				 NULL);
diff --git a/src/ui/gui/oneway.ui b/src/ui/gui/oneway.ui
index 6ec3120fa6..a0f7914543 100644
--- a/src/ui/gui/oneway.ui
+++ b/src/ui/gui/oneway.ui
@@ -109,6 +109,8 @@
                 <property name="receives_default">True</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                 <property name="border_width">5</property>
+                <property name="source_widget">oneway-anova-treeview1</property>
+                <property name="dest_widget">oneway-anova-entry</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
@@ -126,6 +128,8 @@
                 <property name="receives_default">True</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                 <property name="border_width">5</property>
+                <property name="source_widget">oneway-anova-treeview1</property>
+                <property name="dest_widget">oneway-anova-treeview2</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
diff --git a/src/ui/gui/psppire-selector.c b/src/ui/gui/psppire-selector.c
index d6ea337525..8e0be3a359 100644
--- a/src/ui/gui/psppire-selector.c
+++ b/src/ui/gui/psppire-selector.c
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2007  Free Software Foundation
+   Copyright (C) 2007, 2009 Free Software Foundation
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -112,22 +112,49 @@ psppire_selector_get_type (void)
   return psppire_selector_type;
 }
 
+static GObjectClass * parent_class = NULL;
 
 static void
-psppire_selector_finalize (GObject *object)
+psppire_selector_finalize (GObject *obj)
 {
+   /* Chain up to the parent class */
+   G_OBJECT_CLASS (parent_class)->finalize (obj);
 }
 
+
+static void
+psppire_selector_dispose (GObject *obj)
+{
+  PsppireSelector *sel = PSPPIRE_SELECTOR (obj);
+
+  if (sel->dispose_has_run)
+    return;
+
+  /* Make sure dispose does not run twice. */
+  sel->dispose_has_run = TRUE;
+
+  g_object_unref (sel->dest);
+  g_object_unref (sel->source);
+
+  /* Chain up to the parent class */
+  G_OBJECT_CLASS (parent_class)->dispose (obj);
+}
+
+
 /* Properties */
 enum
 {
   PROP_0,
-  PROP_ORIENTATION
+  PROP_ORIENTATION,
+  PROP_SOURCE_WIDGET,
+  PROP_DEST_WIDGET
 };
 
 
 static void on_activate (PsppireSelector *selector, gpointer data);
 
+static void update_subjects (PsppireSelector *selector);
+
 
 static void
 psppire_selector_set_property (GObject         *object,
@@ -143,6 +170,14 @@ psppire_selector_set_property (GObject         *object,
       selector->orientation = g_value_get_enum (value);
       set_direction (selector, selector->direction);
       break;
+    case PROP_SOURCE_WIDGET:
+      selector->source = g_value_dup_object (value);
+      update_subjects (selector);
+      break;
+    case PROP_DEST_WIDGET:
+      selector->dest = g_value_dup_object (value);
+      update_subjects (selector);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -163,6 +198,12 @@ psppire_selector_get_property (GObject         *object,
     case PROP_ORIENTATION:
       g_value_set_enum (value, selector->orientation);
       break;
+    case PROP_SOURCE_WIDGET:
+      g_value_take_object (value, selector->source);
+      break;
+    case PROP_DEST_WIDGET:
+      g_value_take_object (value, selector->dest);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -183,6 +224,20 @@ psppire_selector_class_init (PsppireSelectorClass *class)
 		       PSPPIRE_SELECT_SOURCE_BEFORE_DEST /* default value */,
 		       G_PARAM_CONSTRUCT_ONLY |G_PARAM_READWRITE);
 
+  GParamSpec *source_widget_spec = 
+    g_param_spec_object ("source-widget",
+			 "Source Widget",
+			 "The widget to be used as the source for this selector",
+			 GTK_TYPE_WIDGET,
+			 G_PARAM_READWRITE);
+
+  GParamSpec *dest_widget_spec = 
+    g_param_spec_object ("dest-widget",
+			 "Destination Widget",
+			 "The widget to be used as the destination for this selector",
+			 GTK_TYPE_WIDGET,
+			 G_PARAM_READWRITE);
+
 
   object_class->set_property = psppire_selector_set_property;
   object_class->get_property = psppire_selector_get_property;
@@ -191,6 +246,16 @@ psppire_selector_class_init (PsppireSelectorClass *class)
                                    PROP_ORIENTATION,
                                    orientation_spec);
 
+  g_object_class_install_property (object_class,
+                                   PROP_SOURCE_WIDGET,
+                                   source_widget_spec);
+
+  g_object_class_install_property (object_class,
+                                   PROP_DEST_WIDGET,
+                                   dest_widget_spec);
+
+  parent_class = g_type_class_peek_parent (class);
+
   signals [SELECTED] =
     g_signal_new ("selected",
 		  G_TYPE_FROM_CLASS (class),
@@ -219,6 +284,7 @@ psppire_selector_base_init (PsppireSelectorClass *class)
   GObjectClass *object_class = G_OBJECT_CLASS (class);
 
   object_class->finalize = psppire_selector_finalize;
+  object_class->dispose = psppire_selector_dispose;
 
   class->source_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
 }
@@ -251,6 +317,10 @@ psppire_selector_init (PsppireSelector *selector)
   g_signal_connect_swapped (selector->action, "activate", G_CALLBACK (on_activate), selector);
 
   selector->selecting = FALSE;
+
+  selector->source = NULL;
+  selector->dest = NULL;
+  selector->dispose_has_run = FALSE;
 }
 
 
@@ -682,7 +752,17 @@ on_dest_data_delete (GtkTreeModel *tree_model,
 }
 
 
+static void
+xxx (PsppireSelector *selector)
+{
+  GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector->dest));
+
+  g_signal_connect (model, "row-changed", G_CALLBACK (on_dest_data_change),
+		    selector);
 
+  g_signal_connect (model, "row-deleted", G_CALLBACK (on_dest_data_delete),
+		    selector);
+}
 
 /* Set the destination widget to DEST */
 static void
@@ -690,18 +770,16 @@ set_tree_view_dest (PsppireSelector *selector,
 		    GtkTreeView *dest)
 {
   GtkTreeSelection* selection = gtk_tree_view_get_selection (dest);
-  GtkTreeModel *model = gtk_tree_view_get_model (dest);
+
 
   gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
 
   g_signal_connect (selection, "changed", G_CALLBACK (on_dest_treeview_select),
 		    selector);
 
-  g_signal_connect (model, "row-changed", G_CALLBACK (on_dest_data_change),
-		      selector);
 
-  g_signal_connect (model, "row-deleted", G_CALLBACK (on_dest_data_delete),
-		      selector);
+  g_signal_connect_swapped (dest, "notify::model",
+			    G_CALLBACK (xxx), selector);
 
 }
 
@@ -777,53 +855,69 @@ set_entry_dest (PsppireSelector *selector,
 		    G_CALLBACK (on_row_inserted), selector);
 }
 
-
-/* Set SOURCE and DEST for this selector, and
-   set SELECT_FUNC and FILTER_FUNC */
-void
-psppire_selector_set_subjects (PsppireSelector *selector,
-			       GtkWidget *source,
-			       GtkWidget *dest,
-			       SelectItemsFunc *select_func,
-			       FilterItemsFunc *filter_func,
-			       gpointer user_data)
+static void
+update_subjects (PsppireSelector *selector)
 {
-  g_assert(selector);
+  GtkTreeModel *model = NULL;
 
-  selector->filter = filter_func ;
+  if ( NULL == selector->dest )
+    return;
 
-  selector->source = source;
-  selector->dest = dest;
-  selector->select_user_data = user_data;
+  if ( NULL == selector->source )
+    return;
 
-  if ( filter_func == NULL)
-    {
-      if  (GTK_IS_TREE_VIEW (dest))
-	selector->filter = is_item_in_dest;
-    }
+  g_signal_connect_swapped (selector->source, "notify::dictionary",
+			    G_CALLBACK (update_subjects), selector);
 
-  if ( GTK_IS_TREE_VIEW (source))
-    set_tree_view_source (selector, GTK_TREE_VIEW (source) );
-  else
-    g_error ("Unsupported source widget: %s", G_OBJECT_TYPE_NAME (source));
+  g_signal_connect_swapped (selector->source, "notify::model",
+			    G_CALLBACK (update_subjects), selector);
+
+  model = gtk_tree_view_get_model (GTK_TREE_VIEW (selector->source));
 
-  g_assert ( GTK_IS_TREE_MODEL_FILTER (selector->filtered_source));
+  if ( NULL == model)
+    return;
 
-  if ( NULL == dest)
+
+  if ( GTK_IS_TREE_VIEW (selector->source))
+    set_tree_view_source (selector, GTK_TREE_VIEW (selector->source) );
+  else
+    g_error ("Unsupported source widget: %s", G_OBJECT_TYPE_NAME (selector->source));
+
+  if ( NULL == selector->dest)
     ;
-  else if  ( GTK_IS_TREE_VIEW (dest))
-    set_tree_view_dest (selector, GTK_TREE_VIEW (dest));
+  else if  ( GTK_IS_TREE_VIEW (selector->dest))
+    {
+      set_tree_view_dest (selector, GTK_TREE_VIEW (selector->dest));
+    }
 
-  else if ( GTK_IS_ENTRY (dest))
-    set_entry_dest (selector, GTK_ENTRY (dest));
+  else if ( GTK_IS_ENTRY (selector->dest))
+    set_entry_dest (selector, GTK_ENTRY (selector->dest));
 
-  else if (GTK_IS_TEXT_VIEW (dest))
+  else if (GTK_IS_TEXT_VIEW (selector->dest))
     {
       /* Nothing to be done */
     }
-
   else
-    g_error ("Unsupported destination widget: %s", G_OBJECT_TYPE_NAME (dest));
+    g_error ("Unsupported destination widget: %s", G_OBJECT_TYPE_NAME (selector->dest));
+
+}
+
+
+/* Set SELECT_FUNC and FILTER_FUNC for this selector */
+void
+psppire_selector_set_subjects (PsppireSelector *selector,
+			       SelectItemsFunc *select_func,
+			       FilterItemsFunc *filter_func,
+			       gpointer user_data)
+{
+  selector->filter = filter_func ;
+  selector->select_user_data = user_data;
+
+  if ( filter_func == NULL)
+    {
+      if  (GTK_IS_TREE_VIEW (selector->dest))
+	selector->filter = is_item_in_dest;
+    }
 
   selector->select_items = select_func;
 }
@@ -831,7 +925,7 @@ psppire_selector_set_subjects (PsppireSelector *selector,
 
 
 void
-psppire_selector_set_allow        (PsppireSelector *selector , AllowSelectionFunc *allow)
+psppire_selector_set_allow (PsppireSelector *selector, AllowSelectionFunc *allow)
 {
   selector->allow_selection = allow;
 }
diff --git a/src/ui/gui/psppire-selector.h b/src/ui/gui/psppire-selector.h
index 6fff5d4269..8174f97c8f 100644
--- a/src/ui/gui/psppire-selector.h
+++ b/src/ui/gui/psppire-selector.h
@@ -77,7 +77,10 @@ struct _PsppireSelector
   GtkWidget *arrow;
   GtkAction *action;
 
+  gboolean dispose_has_run;
+
   enum psppire_selector_dir direction;
+
   GtkWidget *source;
   GtkWidget *dest;
 
@@ -111,8 +114,6 @@ struct _PsppireSelectorClass
 GType      psppire_selector_get_type        (void);
 GtkWidget* psppire_selector_new             (void);
 void       psppire_selector_set_subjects    (PsppireSelector *,
-					     GtkWidget *,
-					     GtkWidget *,
 					     SelectItemsFunc *,
 					     FilterItemsFunc *,
 					     gpointer );
diff --git a/src/ui/gui/psppire.ui b/src/ui/gui/psppire.ui
index 06cce7beeb..99d9ed06e0 100644
--- a/src/ui/gui/psppire.ui
+++ b/src/ui/gui/psppire.ui
@@ -85,6 +85,8 @@
                                 <property name="can_focus">False</property>
                                 <property name="receives_default">False</property>
                                 <property name="border_width">5</property>
+                                <property name="source_widget">weight-cases-treeview</property>
+                                <property name="dest_widget">weight-cases-entry</property>
                               </object>
                               <packing>
                                 <property name="position">0</property>
@@ -324,6 +326,8 @@
                     <property name="can_focus">False</property>
                     <property name="receives_default">False</property>
                     <property name="border_width">5</property>
+                    <property name="source_widget">source-treeview</property>
+                    <property name="dest_widget">new-name-entry</property>
                   </object>
                   <packing>
                     <property name="top_attach">1</property>
@@ -338,6 +342,8 @@
                     <property name="can_focus">False</property>
                     <property name="receives_default">False</property>
                     <property name="border_width">5</property>
+                    <property name="source_widget">source-treeview</property>
+                    <property name="dest_widget">variables-treeview</property>
                   </object>
                   <packing>
                     <property name="x_options"></property>
@@ -501,6 +507,8 @@
                                 <property name="receives_default">True</property>
                                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                 <property name="border_width">5</property>
+                                <property name="source_widget">split-file-dict-treeview</property>
+                                <property name="dest_widget">split-file-grouping-vars</property>
                               </object>
                             </child>
                           </object>
@@ -821,6 +829,8 @@
                         <property name="receives_default">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                         <property name="border_width">5</property>
+                        <property name="source_widget">compute-treeview1</property>
+                        <property name="dest_widget">compute-textview1</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -934,6 +944,8 @@
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                             <property name="border_width">5</property>
                             <property name="orientation">source below destination</property>
+                            <property name="source_widget">compute-treeview2</property>
+                            <property name="dest_widget">compute-textview1</property>
                           </object>
                           <packing>
                             <property name="fill">False</property>
@@ -1241,6 +1253,8 @@
                                             <property name="receives_default">True</property>
                                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                             <property name="border_width">5</property>
+                                            <property name="source_widget">select-cases-treeview</property>
+                                            <property name="dest_widget">filter-variable-entry</property>
                                           </object>
                                           <packing>
                                             <property name="expand">False</property>
diff --git a/src/ui/gui/rank-dialog.c b/src/ui/gui/rank-dialog.c
index b2894095b7..ec3cccfaa3 100644
--- a/src/ui/gui/rank-dialog.c
+++ b/src/ui/gui/rank-dialog.c
@@ -311,8 +311,6 @@ rank_dialog (GObject *o, gpointer data)
   set_dest_model (GTK_TREE_VIEW (rd.rank_vars), rd.dict);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector1),
-				 vars,
-				 rd.rank_vars,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
@@ -320,8 +318,6 @@ rank_dialog (GObject *o, gpointer data)
   set_dest_model (GTK_TREE_VIEW (rd.group_vars), rd.dict);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector2),
-				 vars,
-				 rd.group_vars,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
diff --git a/src/ui/gui/rank.ui b/src/ui/gui/rank.ui
index 5b7d6f4b27..1b2a8245d5 100644
--- a/src/ui/gui/rank.ui
+++ b/src/ui/gui/rank.ui
@@ -144,6 +144,8 @@
                     <property name="receives_default">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <property name="border_width">5</property>
+                    <property name="source_widget">dict-treeview</property>
+                    <property name="dest_widget">group-vars-treeview</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
@@ -161,6 +163,8 @@
                     <property name="receives_default">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <property name="border_width">5</property>
+                    <property name="source_widget">dict-treeview</property>
+                    <property name="dest_widget">variables-treeview</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
diff --git a/src/ui/gui/recode-dialog.c b/src/ui/gui/recode-dialog.c
index 0bb82eb335..c3e48a882b 100644
--- a/src/ui/gui/recode-dialog.c
+++ b/src/ui/gui/recode-dialog.c
@@ -952,8 +952,6 @@ recode_dialog (PsppireDataWindow *de, gboolean diff)
 
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
-				 rd.dict_treeview,
-				 rd.variable_treeview,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
diff --git a/src/ui/gui/recode.ui b/src/ui/gui/recode.ui
index 4acd7fc4c4..711a4eafb6 100644
--- a/src/ui/gui/recode.ui
+++ b/src/ui/gui/recode.ui
@@ -720,6 +720,8 @@
             <property name="receives_default">True</property>
             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
             <property name="border_width">5</property>
+            <property name="source_widget">treeview1</property>
+            <property name="dest_widget">treeview2</property>
           </object>
           <packing>
             <property name="left_attach">1</property>
diff --git a/src/ui/gui/regression-dialog.c b/src/ui/gui/regression-dialog.c
index eaca17e074..87101397be 100644
--- a/src/ui/gui/regression-dialog.c
+++ b/src/ui/gui/regression-dialog.c
@@ -260,15 +260,11 @@ regression_dialog (GObject *o, gpointer data)
   set_dest_model (GTK_TREE_VIEW (dest_indep), rd.dict);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (dep_selector),
-				 source,
-				 dest_dep,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (indep_selector),
-				 source,
-				 dest_indep,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
diff --git a/src/ui/gui/regression.ui b/src/ui/gui/regression.ui
index 190e686671..437a1f6b08 100644
--- a/src/ui/gui/regression.ui
+++ b/src/ui/gui/regression.ui
@@ -67,6 +67,8 @@
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                 <property name="no_show_all">True</property>
                 <property name="border_width">5</property>
+                <property name="source_widget">dict-view</property>
+                <property name="dest_widget">dep-view</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
@@ -83,6 +85,8 @@
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                 <property name="no_show_all">True</property>
                 <property name="border_width">5</property>
+                <property name="source_widget">dict-view</property>
+                <property name="dest_widget">indep-view</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
diff --git a/src/ui/gui/reliability-dialog.c b/src/ui/gui/reliability-dialog.c
index 66c8bf5ce4..6b8243610e 100644
--- a/src/ui/gui/reliability-dialog.c
+++ b/src/ui/gui/reliability-dialog.c
@@ -143,8 +143,6 @@ reliability_dialog (GObject *o, gpointer data)
   set_dest_model (GTK_TREE_VIEW (rd.variables), rd.dict);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
-				 source,
-				 rd.variables,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
diff --git a/src/ui/gui/reliability.ui b/src/ui/gui/reliability.ui
index a4236b77a1..364ea89387 100644
--- a/src/ui/gui/reliability.ui
+++ b/src/ui/gui/reliability.ui
@@ -70,6 +70,8 @@
                         <property name="receives_default">True</property>
                         <property name="no_show_all">True</property>
                         <property name="border_width">5</property>
+                        <property name="source_widget">dict-view</property>
+                        <property name="dest_widget">treeview2</property>
                       </object>
                     </child>
                   </object>
diff --git a/src/ui/gui/select-cases-dialog.c b/src/ui/gui/select-cases-dialog.c
index 56b10d2c54..c46595c65e 100644
--- a/src/ui/gui/select-cases-dialog.c
+++ b/src/ui/gui/select-cases-dialog.c
@@ -332,8 +332,6 @@ select_cases_dialog (GObject *o, gpointer data)
 		  GTK_SELECTION_SINGLE, NULL);
 
     psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
-				   source,
-				   entry,
 				   insert_source_row_into_entry,
 				   is_currently_in_entry,
 				   NULL);
diff --git a/src/ui/gui/sort-cases-dialog.c b/src/ui/gui/sort-cases-dialog.c
index cde70ccf83..242b7d3c07 100644
--- a/src/ui/gui/sort-cases-dialog.c
+++ b/src/ui/gui/sort-cases-dialog.c
@@ -117,8 +117,6 @@ sort_cases_dialog (GObject *o, gpointer data)
   set_dest_model (GTK_TREE_VIEW (dest), scd.dict);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
-				 source,
-				 dest,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
diff --git a/src/ui/gui/sort.ui b/src/ui/gui/sort.ui
index c7e4b2d403..b80affaf09 100644
--- a/src/ui/gui/sort.ui
+++ b/src/ui/gui/sort.ui
@@ -51,6 +51,8 @@
                     <property name="receives_default">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <property name="border_width">5</property>
+                    <property name="source_widget">sort-cases-treeview1</property>
+                    <property name="dest_widget">sort-cases-treeview2</property>
                   </object>
                 </child>
               </object>
diff --git a/src/ui/gui/split-file-dialog.c b/src/ui/gui/split-file-dialog.c
index 613f8e91fe..8ae69213c2 100644
--- a/src/ui/gui/split-file-dialog.c
+++ b/src/ui/gui/split-file-dialog.c
@@ -198,8 +198,6 @@ split_file_dialog (GObject *o, gpointer data)
   set_dest_model (GTK_TREE_VIEW (dest), sfd.dict);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
-				 source,
-				 dest,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
diff --git a/src/ui/gui/t-test-independent-samples-dialog.c b/src/ui/gui/t-test-independent-samples-dialog.c
index 5d77ce4303..03cce8d443 100644
--- a/src/ui/gui/t-test-independent-samples-dialog.c
+++ b/src/ui/gui/t-test-independent-samples-dialog.c
@@ -432,7 +432,6 @@ t_test_independent_samples_dialog (GObject *o, gpointer data)
 
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector1),
-				 dict_view, test_variables_treeview,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
@@ -442,7 +441,6 @@ t_test_independent_samples_dialog (GObject *o, gpointer data)
 
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector2),
-				 dict_view, tt_d.groups_entry,
 				 insert_source_row_into_entry,
 				 is_currently_in_entry,
 				 NULL);
diff --git a/src/ui/gui/t-test-one-sample.c b/src/ui/gui/t-test-one-sample.c
index 8b2d8af795..5e5f35e4c7 100644
--- a/src/ui/gui/t-test-one-sample.c
+++ b/src/ui/gui/t-test-one-sample.c
@@ -157,7 +157,6 @@ t_test_one_sample_dialog (GObject *o, gpointer data)
 
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
-				 dict_view, tt_d.vars_treeview,
 				 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 15b99ad219..1e14dfa177 100644
--- a/src/ui/gui/t-test-paired-samples.c
+++ b/src/ui/gui/t-test-paired-samples.c
@@ -229,8 +229,6 @@ t_test_paired_samples_dialog (GObject *o, gpointer data)
 
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
-				 dict_view,
-				 tt_d.pairs_treeview,
 				 select_as_pair_member,
 				 NULL,
 				 &tt_d);
diff --git a/src/ui/gui/t-test.ui b/src/ui/gui/t-test.ui
index 74d8d0682d..48ac09401a 100644
--- a/src/ui/gui/t-test.ui
+++ b/src/ui/gui/t-test.ui
@@ -93,6 +93,8 @@
                     <property name="receives_default">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <property name="border_width">5</property>
+                    <property name="source_widget">indep-samples-t-test-treeview1</property>
+                    <property name="dest_widget">indep-samples-t-test-treeview2</property>
                   </object>
                   <packing>
                     <property name="x_options"></property>
@@ -106,6 +108,8 @@
                     <property name="receives_default">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <property name="border_width">5</property>
+                    <property name="source_widget">indep-samples-t-test-treeview1</property>
+                    <property name="dest_widget">indep-samples-t-test-entry</property>
                   </object>
                   <packing>
                     <property name="top_attach">1</property>
@@ -681,6 +685,8 @@
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                 <property name="no_show_all">True</property>
                 <property name="border_width">5</property>
+                <property name="source_widget">one-sample-t-test-treeview2</property>
+                <property name="dest_widget">one-sample-t-test-treeview1</property>
               </object>
             </child>
           </object>
@@ -741,6 +747,8 @@
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <property name="no_show_all">True</property>
                     <property name="border_width">5</property>
+                    <property name="source_widget">paired-samples-t-test-treeview1</property>
+                    <property name="dest_widget">paired-samples-t-test-treeview2</property>
                   </object>
                 </child>
               </object>
diff --git a/src/ui/gui/transpose-dialog.c b/src/ui/gui/transpose-dialog.c
index 36640f6f75..1d8744d5ee 100644
--- a/src/ui/gui/transpose-dialog.c
+++ b/src/ui/gui/transpose-dialog.c
@@ -91,7 +91,6 @@ transpose_dialog (GObject *o, gpointer data)
   GtkWidget *dest = get_widget_assert (xml, "variables-treeview");
   GtkWidget *selector1 = get_widget_assert (xml, "psppire-selector2");
   GtkWidget *selector2 = get_widget_assert (xml, "psppire-selector3");
-  GtkWidget *new_name_entry = get_widget_assert (xml, "new-name-entry");
 
   g_object_get (de->data_editor, "var-store", &vs, NULL);
 
@@ -101,14 +100,12 @@ transpose_dialog (GObject *o, gpointer data)
   set_dest_model (GTK_TREE_VIEW (dest), dict);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector1),
-				 source, dest,
 				 insert_source_row_into_tree_view,
 				 NULL,
 				 NULL);
 
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector2),
-				 source, new_name_entry,
 				 insert_source_row_into_entry,
 				 is_currently_in_entry,
 				 NULL);
diff --git a/src/ui/gui/weight-cases-dialog.c b/src/ui/gui/weight-cases-dialog.c
index b3087159f9..b43d49c3f5 100644
--- a/src/ui/gui/weight-cases-dialog.c
+++ b/src/ui/gui/weight-cases-dialog.c
@@ -138,15 +138,11 @@ weight_cases_dialog (GObject *o, gpointer data)
 				 NULL);
 
   psppire_selector_set_subjects (PSPPIRE_SELECTOR (selector),
-				 source,
-				 entry,
 				 insert_source_row_into_entry,
 				 is_currently_in_entry,
 				 NULL
 				 );
 
-
-
   wcd.entry = GTK_ENTRY (entry);
   wcd.status = GTK_LABEL (status);
   wcd.off = GTK_TOGGLE_BUTTON (radiobutton1);