Index: gtk/gtkentry.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkentry.c,v
retrieving revision 1.306
diff -r1.306 gtkentry.c
3858a3859
>   GtkSettings *settings;
3861c3862,3874
<   gtk_editable_select_region (GTK_EDITABLE (entry), entry->current_pos, entry->current_pos);
---
>   settings = gtk_widget_get_settings (data);
>   
>   if (settings)
>     {
>       gboolean unselect;
>       
>       g_object_get (settings, "gtk-unselect-on-clear-clipboard", &unselect, NULL);
>       
>       if (unselect)
>         gtk_editable_select_region (GTK_EDITABLE (entry), 
> 				    entry->current_pos, 
> 				    entry->current_pos);      
>     }
Index: gtk/gtklabel.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtklabel.c,v
retrieving revision 1.197
diff -r1.197 gtklabel.c
3284a3285
>   GtkSettings *settings;
3286a3288
>   settings = gtk_widget_get_settings (GTK_WIDGET (label));
3288c3290
<   if (label->select_info)
---
>   if (settings && label->select_info)
3290c3292
<       label->select_info->selection_anchor = label->select_info->selection_end;
---
>       gboolean unselect;
3292c3294,3300
<       gtk_widget_queue_draw (GTK_WIDGET (label));
---
>       g_object_get (settings, "gtk-unselect-on-clear-clipboard", &unselect, NULL);
>       
>       if (unselect)
>         {
>           label->select_info->selection_anchor = label->select_info->selection_end;
>           gtk_widget_queue_draw (GTK_WIDGET (label));
>         }
Index: gtk/gtksettings.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtksettings.c,v
retrieving revision 1.90
diff -r1.90 gtksettings.c
93c93,94
<   PROP_COLOR_HASH
---
>   PROP_COLOR_HASH,
>   PROP_UNSELECT_ON_CLEAR_CLIPBOARD
530a532,549
> 
>   /**
>    * GtkSettings:gtk-unselect-on-clear-clipboard:
>    *
>    * Controls whether losing PRIMARY selection leads to unselecting text
>    * in old PRIMARY clipboard owner.
>    *
>    * Since: 2.10
>    */
>   result = settings_install_property_parser (class,
> 				             g_param_spec_boolean ("gtk-unselect-on-clear-clipboard",
> 						                   P_("Old nasty selection mode"),
> 						                   P_("Old nasty selection mode."),
> 						                   FALSE,
> 						                   GTK_PARAM_READWRITE),
> 					     NULL);
> 
>   g_assert (result == PROP_UNSELECT_ON_CLEAR_CLIPBOARD);
Index: gtk/gtktextview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktextview.c,v
retrieving revision 1.306
diff -r1.306 gtktextview.c
102a103,104
> #define BUFFER_CLIPBOARD_SET "gtk-text-buffer-clipboard-set"
> 
1196c1198,1199
<       if (GTK_WIDGET_REALIZED (text_view))
---
>       if (GTK_WIDGET_REALIZED (text_view) &&
>           g_object_get_data (G_OBJECT (text_view), BUFFER_CLIPBOARD_SET))
1200a1204,1205
> 	  g_object_set_data (G_OBJECT (text_view), BUFFER_CLIPBOARD_SET, 
> 	                     GINT_TO_POINTER (FALSE));
1238,1240c1243,1256
< 	  GtkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view),
< 							      GDK_SELECTION_PRIMARY);
< 	  gtk_text_buffer_add_selection_clipboard (text_view->buffer, clipboard);
---
> 	  GtkSettings *settings;
> 	  gboolean set_clipboard;
> 	  
> 	  settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
> 	  g_object_get (settings, "gtk-unselect-on-clear-clipboard", &set_clipboard, NULL);
> 	  
> 	  if (set_clipboard)
> 	    {
> 	      GtkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view),
> 							          GDK_SELECTION_PRIMARY);
> 	      gtk_text_buffer_add_selection_clipboard (text_view->buffer, clipboard);
> 	      g_object_set_data (G_OBJECT (text_view), BUFFER_CLIPBOARD_SET, 
> 	                         GINT_TO_POINTER (TRUE));
> 	    }
3525,3527c3541,3554
<       GtkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view),
< 							  GDK_SELECTION_PRIMARY);
<       gtk_text_buffer_add_selection_clipboard (text_view->buffer, clipboard);
---
>       GtkSettings *settings;
>       gboolean set_clipboard;
> 	  
>       settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
>       g_object_get (settings, "gtk-unselect-on-clear-clipboard", &set_clipboard, NULL);
> 	  
>       if (set_clipboard)
>         {
> 	  GtkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view),
> 							      GDK_SELECTION_PRIMARY);
> 	  gtk_text_buffer_add_selection_clipboard (text_view->buffer, clipboard);
> 	  g_object_set_data (G_OBJECT (text_view), BUFFER_CLIPBOARD_SET, 
> 			     GINT_TO_POINTER (TRUE));
> 	}
3548c3575
<   if (text_view->buffer)
---
>   if (text_view->buffer && g_object_get_data (G_OBJECT (text_view), BUFFER_CLIPBOARD_SET))
3552a3580,3581
>       g_object_set_data (G_OBJECT (text_view), BUFFER_CLIPBOARD_SET, 
> 	                 GINT_TO_POINTER (FALSE));
