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/gtktextbuffer.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktextbuffer.c,v
retrieving revision 1.110
diff -r1.110 gtktextbuffer.c
58a59,60
> 
>   guint 	  unselect_on_clear_clipboard;
99c101,102
<   PROP_PASTE_TARGET_LIST
---
>   PROP_PASTE_TARGET_LIST,
>   PROP_UNSELECT_ON_CLEAR_CLIPBOARD
278a282,296
>   /**
>    * GtkTextBuffer:unselect-on-clear-clipboard:
>    *
>    * Whether text should be unselected when attached clipboard is cleared.
>    *
>    * Since: 2.10
>    */
>   g_object_class_install_property (object_class,
>                                    PROP_UNSELECT_ON_CLEAR_CLIPBOARD,
>                                    g_param_spec_boolean ("unselect-on-clear-clipboard",
>                                                          P_("Unselect when clipboard is cleared"),
>                                                          P_("Whether text should be unselected when attached clipboard is cleared"),
>                                                          FALSE,
>                                                          GTK_PARAM_READWRITE));
> 
474a493
>   GtkTextBufferPrivate *priv;
488a508,513
>     case PROP_UNSELECT_ON_CLEAR_CLIPBOARD:
>       priv = GTK_TEXT_BUFFER_GET_PRIVATE (text_buffer);
>       priv->unselect_on_clear_clipboard = g_value_get_boolean (value) != 0;
>       g_object_notify (object, "unselect-on-clear-clipboard");
>       break;
> 
500a526
>   GtkTextBufferPrivate *priv;
534a561,565
>     case PROP_UNSELECT_ON_CLEAR_CLIPBOARD:
>       priv = GTK_TEXT_BUFFER_GET_PRIVATE (text_buffer);
>       g_value_set_boolean (value, priv->unselect_on_clear_clipboard != 0);
>       break;
> 
2893a2925
>   GtkTextBufferPrivate *priv = GTK_TEXT_BUFFER_GET_PRIVATE (buffer);
2895,2903c2927,2938
<   gtk_text_buffer_get_iter_at_mark (buffer, &insert,
<                                     gtk_text_buffer_get_mark (buffer, "insert"));
<   gtk_text_buffer_get_iter_at_mark (buffer, &selection_bound,
<                                     gtk_text_buffer_get_mark (buffer, "selection_bound"));
< 
<   if (!gtk_text_iter_equal (&insert, &selection_bound))
<     gtk_text_buffer_move_mark (buffer,
<                                gtk_text_buffer_get_mark (buffer, "selection_bound"),
<                                &insert);
---
>   if (priv->unselect_on_clear_clipboard)
>     {
>       gtk_text_buffer_get_iter_at_mark (buffer, &insert,
>                                         gtk_text_buffer_get_mark (buffer, "insert"));
>       gtk_text_buffer_get_iter_at_mark (buffer, &selection_bound,
>                                         gtk_text_buffer_get_mark (buffer, "selection_bound"));
> 
>       if (!gtk_text_iter_equal (&insert, &selection_bound))
>         gtk_text_buffer_move_mark (buffer,
>                                    gtk_text_buffer_get_mark (buffer, "selection_bound"),
>                                    &insert);
>     }
Index: gtk/gtktextview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktextview.c,v
retrieving revision 1.306
diff -r1.306 gtktextview.c
1238,1239c1238,1247
< 	  GtkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view),
< 							      GDK_SELECTION_PRIMARY);
---
> 	  GtkSettings *settings;
> 	  GtkClipboard *clipboard;
> 	  gboolean unselect;
> 
> 	  settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
> 	  g_object_get (settings, "gtk-unselect-on-clear-clipboard", &unselect, NULL);
> 	  g_object_set (text_view->buffer, "unselect-on-clear-clipboard", unselect, NULL);
> 
> 	  clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view),
> 						GDK_SELECTION_PRIMARY);
3525,3526c3533,3542
<       GtkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view),
< 							  GDK_SELECTION_PRIMARY);
---
>       GtkSettings *settings;
>       GtkClipboard *clipboard;
>       gboolean unselect;
> 
>       settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
>       g_object_get (settings, "gtk-unselect-on-clear-clipboard", &unselect, NULL);
>       g_object_set (text_view->buffer, "unselect-on-clear-clipboard", unselect, NULL);
> 
>       clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view),
> 					    GDK_SELECTION_PRIMARY);
