diff -ur nautilus-3.5.90.really.3.4.2/libnautilus-private/nautilus-icon-container.c nautilus-ted/libnautilus-private/nautilus-icon-container.c --- nautilus-3.5.90.really.3.4.2/libnautilus-private/nautilus-icon-container.c 2012-10-03 13:47:19.000000000 -0500 +++ nautilus-ted/libnautilus-private/nautilus-icon-container.c 2012-10-03 13:46:50.868167012 -0500 @@ -26,6 +26,8 @@ */ #include +#include +#include #include #include "nautilus-icon-container.h" @@ -39,6 +41,7 @@ #include #include #include +#include #include #include @@ -2606,6 +2609,79 @@ } static void +get_rubber_color (GdkRGBA * bgcolor, GdkRGBA * bordercolor, GtkWidget * container) +{ + Atom real_type; + gint result; + gint real_format; + gulong items_read = 0; + gulong items_left = 0; + gchar* colors; + Atom representative_colors_atom; + Display* display; + + if (NAUTILUS_IS_ICON_VIEW_CONTAINER(container) && NAUTILUS_ICON_VIEW_CONTAINER(container)->sort_for_desktop) { + representative_colors_atom = gdk_x11_get_xatom_by_name ("_GNOME_BACKGROUND_REPRESENTATIVE_COLORS"); + display = gdk_x11_display_get_xdisplay (gdk_display_get_default ()); + + gdk_error_trap_push (); + result = XGetWindowProperty (display, + GDK_ROOT_WINDOW (), + representative_colors_atom, + 0L, + G_MAXLONG, + False, + XA_STRING, + &real_type, + &real_format, + &items_read, + &items_left, + (guchar **) &colors); + gdk_flush (); + gdk_error_trap_pop_ignored (); + } + + if (result == Success && items_read) { + /* by treating the result as a nul-terminated string, we + * select the first colour in the list. + */ + GdkRGBA read; + gdk_rgba_parse(&read, colors); + XFree (colors); + + GtkSymbolicColor * sym_read = gtk_symbolic_color_new_literal(&read); + GtkStyleProperties * null_props = gtk_style_properties_new(); + + /* Border */ + GtkSymbolicColor * sym_border = gtk_symbolic_color_new_shade(sym_read, read.green < 0.5 ? 1.1 : 0.9); + gtk_symbolic_color_resolve(sym_border, null_props, bordercolor); + + /* Background */ + GtkSymbolicColor * sym_bg = gtk_symbolic_color_new_alpha(sym_read, 0.6); + gtk_symbolic_color_resolve(sym_bg, null_props, bgcolor); + + gtk_symbolic_color_unref(sym_bg); + gtk_symbolic_color_unref(sym_border); + gtk_symbolic_color_unref(sym_read); + g_object_unref(null_props); + } else { + /* Fallback to the style context if we can't get the Atom */ + GtkStyleContext *context; + + context = gtk_widget_get_style_context (GTK_WIDGET (container)); + gtk_style_context_save (context); + gtk_style_context_add_class (context, GTK_STYLE_CLASS_RUBBERBAND); + + gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, bgcolor); + gtk_style_context_get_border_color (context, GTK_STATE_FLAG_NORMAL, bordercolor); + + gtk_style_context_restore (context); + } + + return; +} + +static void start_rubberbanding (NautilusIconContainer *container, GdkEventButton *event) { @@ -2615,7 +2691,6 @@ GdkRGBA bg_color, border_color; GList *p; NautilusIcon *icon; - GtkStyleContext *context; details = container->details; band_info = &details->rubberband_info; @@ -2632,14 +2707,7 @@ (EEL_CANVAS (container), event->x, event->y, &band_info->start_x, &band_info->start_y); - context = gtk_widget_get_style_context (GTK_WIDGET (container)); - gtk_style_context_save (context); - gtk_style_context_add_class (context, GTK_STYLE_CLASS_RUBBERBAND); - - gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg_color); - gtk_style_context_get_border_color (context, GTK_STATE_FLAG_NORMAL, &border_color); - - gtk_style_context_restore (context); + get_rubber_color(&bg_color, &border_color, GTK_WIDGET(container)); band_info->selection_rectangle = eel_canvas_item_new (eel_canvas_root