Re: patch: new themable render modes for icons



On Fri, 2006-11-24 at 22:06 +0100, JackTheDipper wrote:
> That's right. Here's the latest patch. ;-)
> 
> Alexander Larsson wrote:
> > I remember you saying that you had further work on this. Do you have the
> > latest version of the patch?

I fixed a couple of warnings and cleaned up some indentation. The new
version is attached.

There seem to be a bug in it though. With the default settings when i
mouse over icons on the desktop the text turns black.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a genetically engineered drug-addicted hairdresser with a mysterious 
suitcase handcuffed to his arm. She's a chain-smoking Buddhist magician's 
assistant descended from a line of powerful witches. They fight crime! 
Index: libnautilus-private/nautilus-icon-canvas-item.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-canvas-item.c,v
retrieving revision 1.202
diff -u -p -r1.202 nautilus-icon-canvas-item.c
--- libnautilus-private/nautilus-icon-canvas-item.c	23 Nov 2006 14:08:43 -0000	1.202
+++ libnautilus-private/nautilus-icon-canvas-item.c	28 Nov 2006 09:42:51 -0000
@@ -225,6 +225,8 @@ static void      draw_embedded_text     
 						      int                            x,
 						      int                            y);
 
+static GdkPixbuf *nautilus_icon_canvas_lighten_pixbuf (GdkPixbuf* src, guint lighten_value);
+
 
 static NautilusIconCanvasItemClass *parent_class = NULL;
 static gpointer accessible_parent_class = NULL;
@@ -959,7 +961,7 @@ draw_or_measure_label_text (NautilusIcon
 	PangoLayout *additional_layout;
 	GdkColor *label_color;
 	int icon_width;
-	gboolean have_editable, have_additional, needs_highlight, needs_frame;
+	gboolean have_editable, have_additional, needs_highlight, needs_frame, prelight_label;
 	int max_text_width;
 	int x;
 	GdkGC *gc;
@@ -1097,21 +1099,34 @@ draw_or_measure_label_text (NautilusIcon
 	if (have_editable) {
 		gtk_widget_style_get (GTK_WIDGET (container),
 				      "frame_text", &needs_frame,
+				      "activate_prelight_icon_label", &prelight_label,
 				      NULL);
 		if (needs_frame && !needs_highlight && details->text_width > 0 && details->text_height > 0) {
-			draw_frame (item, 
-				    drawable,
-				    container->details->normal_color_rgba,
-				    create_mask,
-				    text_rect.x0,
-				    text_rect.y0,
-				    text_rect.x1 - text_rect.x0,
-				    text_rect.y1 - text_rect.y0);
+			if (!(prelight_label && item->details->is_prelit)) {
+				draw_frame (item, 
+					    drawable,
+					    container->details->normal_color_rgba,
+					    create_mask,
+					    text_rect.x0,
+					    text_rect.y0,
+					    text_rect.x1 - text_rect.x0,
+					    text_rect.y1 - text_rect.y0);
+			} else {
+				draw_frame (item, 
+					    drawable,
+					    container->details->prelight_color_rgba,
+					    create_mask,
+					    text_rect.x0,
+					    text_rect.y0,
+					    text_rect.x1 - text_rect.x0,
+					    text_rect.y1 - text_rect.y0);
+			}
 		}
 		
 		gc = nautilus_icon_container_get_label_color_and_gc
 			(NAUTILUS_ICON_CONTAINER (canvas_item->canvas),
-			 &label_color, TRUE, needs_highlight);
+			 &label_color, TRUE, needs_highlight,
+			 item->details->is_prelit);
 
 		draw_label_layout (item, drawable,
 				   editable_layout, needs_highlight,
@@ -1123,7 +1138,8 @@ draw_or_measure_label_text (NautilusIcon
 	if (have_additional) {
 		gc = nautilus_icon_container_get_label_color_and_gc
 			(NAUTILUS_ICON_CONTAINER (canvas_item->canvas),
-			 &label_color, FALSE, needs_highlight);
+			 &label_color, FALSE, needs_highlight,
+			 item->details->is_prelit);
 		
 		draw_label_layout (item, drawable,
 				   additional_layout, needs_highlight,
@@ -1443,24 +1459,150 @@ draw_mask (GdkPixbuf *pixbuf, GdkDrawabl
 					   128);
 }
 
+/* should be moved to libeel! */
+static guchar
+nautilus_icon_canvas_lighten_pixbuf_component (guchar cur_value, guint lighten_value) {
+	int new_value = cur_value;
+	if (lighten_value > 0) {
+		new_value += lighten_value + (new_value >> 3);
+		if (new_value > 255) {
+			new_value = 255;
+		}
+	}
+	return (guchar) new_value;
+}
+
+/* should be moved to libeel! */
+static GdkPixbuf *
+nautilus_icon_canvas_lighten_pixbuf (GdkPixbuf* src, guint lighten_value) {
+	GdkPixbuf *dest;
+	int i, j;
+	int width, height, has_alpha, src_row_stride, dst_row_stride;
+	guchar *target_pixels, *original_pixels;
+	guchar *pixsrc, *pixdest;
+
+	g_return_val_if_fail (gdk_pixbuf_get_colorspace (src) == GDK_COLORSPACE_RGB, NULL);
+	g_return_val_if_fail ((!gdk_pixbuf_get_has_alpha (src)
+			       && gdk_pixbuf_get_n_channels (src) == 3)
+			      || (gdk_pixbuf_get_has_alpha (src)
+				  && gdk_pixbuf_get_n_channels (src) == 4), NULL);
+	g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (src) == 8, NULL);
+
+	dest = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (src),
+			       gdk_pixbuf_get_has_alpha (src),
+			       gdk_pixbuf_get_bits_per_sample (src),
+			       gdk_pixbuf_get_width (src),
+			       gdk_pixbuf_get_height (src));
+	
+	has_alpha = gdk_pixbuf_get_has_alpha (src);
+	width = gdk_pixbuf_get_width (src);
+	height = gdk_pixbuf_get_height (src);
+	dst_row_stride = gdk_pixbuf_get_rowstride (dest);
+	src_row_stride = gdk_pixbuf_get_rowstride (src);
+	target_pixels = gdk_pixbuf_get_pixels (dest);
+	original_pixels = gdk_pixbuf_get_pixels (src);
+
+	for (i = 0; i < height; i++) {
+		pixdest = target_pixels + i * dst_row_stride;
+		pixsrc = original_pixels + i * src_row_stride;
+		for (j = 0; j < width; j++) {		
+			*pixdest++ = nautilus_icon_canvas_lighten_pixbuf_component (*pixsrc++, lighten_value);
+			*pixdest++ = nautilus_icon_canvas_lighten_pixbuf_component (*pixsrc++, lighten_value);
+			*pixdest++ = nautilus_icon_canvas_lighten_pixbuf_component (*pixsrc++, lighten_value);
+			if (has_alpha) {
+				*pixdest++ = *pixsrc++;
+			}
+		}
+	}
+	return dest;
+}
+
+
+
+static GdkPixbuf *
+render_icon (GdkPixbuf *pixbuf, guint render_mode, guint saturation, guint brightness, guint lighten_value, guint color)
+{
+ 	GdkPixbuf *temp_pixbuf, *old_pixbuf;
+
+	if (render_mode == 1) {
+	/* lighten icon */
+		temp_pixbuf = eel_create_spotlight_pixbuf (pixbuf);
+	}
+	else if (render_mode == 2) {
+	/* colorize icon */
+		temp_pixbuf = eel_create_colorized_pixbuf (pixbuf,
+				   EEL_RGBA_COLOR_GET_R (color),
+				   EEL_RGBA_COLOR_GET_G (color),
+				   EEL_RGBA_COLOR_GET_B (color));
+	} else if (render_mode == 3) {
+	/* monochromely colorize icon */
+		old_pixbuf = eel_create_darkened_pixbuf (pixbuf, 0, 255);		
+		temp_pixbuf = eel_create_colorized_pixbuf (old_pixbuf,
+				   EEL_RGBA_COLOR_GET_R (color),
+				   EEL_RGBA_COLOR_GET_G (color),
+				   EEL_RGBA_COLOR_GET_B (color));
+		g_object_unref (old_pixbuf);
+	} else {
+		temp_pixbuf = NULL;
+	}
+
+	if (saturation < 255 || brightness < 255 || temp_pixbuf == NULL) { // temp_pixbuf == NULL just for safer code (return copy)
+		old_pixbuf = temp_pixbuf;
+		temp_pixbuf = eel_create_darkened_pixbuf (temp_pixbuf ? temp_pixbuf : pixbuf, saturation, brightness);
+		if (old_pixbuf) {
+			g_object_unref (old_pixbuf);
+		}
+	}
+
+	if (lighten_value > 0) {
+		old_pixbuf = temp_pixbuf;
+  		temp_pixbuf = nautilus_icon_canvas_lighten_pixbuf (temp_pixbuf ? temp_pixbuf : pixbuf, lighten_value);
+		if (old_pixbuf) {
+			g_object_unref (old_pixbuf);
+		}
+	}
+
+	return temp_pixbuf;
+}
+
 /* shared code to highlight or dim the passed-in pixbuf */
 static GdkPixbuf *
 real_map_pixbuf (NautilusIconCanvasItem *icon_item)
 {
 	EelCanvas *canvas;
 	char *audio_filename;
+	NautilusIconContainer *container;
 	GdkPixbuf *temp_pixbuf, *old_pixbuf, *audio_pixbuf;
 	double zoom;
+	guint render_mode, saturation, brightness, lighten;
 	
 	temp_pixbuf = icon_item->details->pixbuf;
 	canvas = EEL_CANVAS_ITEM(icon_item)->canvas;
+	container = NAUTILUS_ICON_CONTAINER (canvas);
 
 	g_object_ref (temp_pixbuf);
 
 	if (icon_item->details->is_prelit) {
 		old_pixbuf = temp_pixbuf;
-		temp_pixbuf = eel_create_spotlight_pixbuf (temp_pixbuf);
-		g_object_unref (old_pixbuf);
+
+		gtk_widget_style_get (GTK_WIDGET (container),
+			      "prelight_icon_render_mode", &render_mode,
+			      "prelight_icon_saturation", &saturation,
+			      "prelight_icon_brightness", &brightness,
+			      "prelight_icon_lighten", &lighten,
+			      NULL);
+
+		if (render_mode > 0 || saturation < 255 || brightness < 255) {
+			temp_pixbuf = render_icon (temp_pixbuf,
+				render_mode,
+				saturation,
+				brightness,
+				lighten,
+				container->details->prelight_icon_color_rgba);
+			g_object_unref (old_pixbuf);
+       	}
+
+
 
 		/* FIXME bugzilla.gnome.org 42471: This hard-wired image is inappropriate to
 		 * this level of code, which shouldn't know that the
@@ -1512,12 +1654,36 @@ real_map_pixbuf (NautilusIconCanvasItem 
 
 		temp_pixbuf = eel_create_colorized_pixbuf (temp_pixbuf,
 							   EEL_RGBA_COLOR_GET_R (color),
-							   EEL_RGBA_COLOR_GET_G(color),
+							   EEL_RGBA_COLOR_GET_G (color),
 							   EEL_RGBA_COLOR_GET_B (color));
 							   
 		g_object_unref (old_pixbuf);
 	} 
 
+	if (!icon_item->details->is_active
+			&& !icon_item->details->is_prelit
+			&& !icon_item->details->is_highlighted_for_selection
+			&& !icon_item->details->is_highlighted_for_drop) {
+		old_pixbuf = temp_pixbuf;
+
+		gtk_widget_style_get (GTK_WIDGET (container),
+			      "normal_icon_render_mode", &render_mode,
+			      "normal_icon_saturation", &saturation,
+			      "normal_icon_brightness", &brightness,
+			      "normal_icon_lighten", &lighten,
+			      NULL);
+		if (render_mode > 0 || saturation < 255 || brightness < 255) {
+			/* if theme requests colorization */
+			temp_pixbuf = render_icon (temp_pixbuf,
+					    render_mode,
+					    saturation,
+					    brightness,
+					    lighten,
+					    container->details->normal_icon_color_rgba);
+			g_object_unref (old_pixbuf);
+		}
+	}
+	
 	return temp_pixbuf;
 }
 
@@ -1620,6 +1786,7 @@ nautilus_icon_canvas_item_draw (EelCanva
 	icon_rect = icon_item->details->canvas_rect;
 	
 	/* if the pre-lit or selection flag is set, make a pre-lit or darkened pixbuf and draw that instead */
+	/* and colorize normal pixbuf if rc wants that */
 	temp_pixbuf = map_pixbuf (icon_item);
 	pixbuf_rect.x = icon_rect.x0;
 	pixbuf_rect.y = icon_rect.y0;
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v
retrieving revision 1.424
diff -u -p -r1.424 nautilus-icon-container.c
--- libnautilus-private/nautilus-icon-container.c	28 Nov 2006 09:09:25 -0000	1.424
+++ libnautilus-private/nautilus-icon-container.c	28 Nov 2006 09:42:51 -0000
@@ -116,9 +116,19 @@
 #define DEFAULT_SELECTION_BOX_ALPHA 0x40
 #define DEFAULT_HIGHLIGHT_ALPHA 0xff
 #define DEFAULT_NORMAL_ALPHA 0xff
+#define DEFAULT_PRELIGHT_ALPHA 0xff
 #define DEFAULT_LIGHT_INFO_COLOR 0xAAAAFD
 #define DEFAULT_DARK_INFO_COLOR  0x33337F
 
+#define DEFAULT_NORMAL_ICON_RENDER_MODE 0
+#define DEFAULT_PRELIGHT_ICON_RENDER_MODE 1
+#define DEFAULT_NORMAL_ICON_SATURATION 255
+#define DEFAULT_PRELIGHT_ICON_SATURATION 255
+#define DEFAULT_NORMAL_ICON_BRIGHTNESS 255
+#define DEFAULT_PRELIGHT_ICON_BRIGHTNESS 255
+#define DEFAULT_NORMAL_ICON_LIGHTEN 0
+#define DEFAULT_PRELIGHT_ICON_LIGHTEN 0
+
 #define MINIMUM_EMBEDDED_TEXT_RECT_WIDTH       20
 #define MINIMUM_EMBEDDED_TEXT_RECT_HEIGHT      20
 
@@ -4881,6 +4891,13 @@ nautilus_icon_container_class_init (Naut
 								     DEFAULT_NORMAL_ALPHA,
 								     G_PARAM_READABLE));
 	gtk_widget_class_install_style_property (widget_class,
+						 g_param_spec_uchar ("prelight_alpha",
+								     _("Prelight Alpha"),
+								     _("Opacity of the prelight icons if frame_text is set"),
+								     0, 0xff,
+								     DEFAULT_PRELIGHT_ALPHA,
+								     G_PARAM_READABLE));
+	gtk_widget_class_install_style_property (widget_class,
 						 g_param_spec_boxed ("light_info_color",
 								     "Light Info Color",
 								     "Color used for information text against a dark background",
@@ -4893,6 +4910,82 @@ nautilus_icon_container_class_init (Naut
 								     GDK_TYPE_COLOR,
 								     G_PARAM_READABLE));
 
+	gtk_widget_class_install_style_property (widget_class,
+						 g_param_spec_uint ("normal_icon_render_mode",
+								     "Normal Icon Render Mode",
+								     "Mode of normal icons being rendered (0=normal, 1=spotlight, 2=colorize, 3=colorize-monochromely)",
+								     0, 3,
+								     DEFAULT_NORMAL_ICON_RENDER_MODE,
+								     G_PARAM_READABLE));
+	gtk_widget_class_install_style_property (widget_class,
+						 g_param_spec_uint ("prelight_icon_render_mode",
+								     "Prelight Icon Render Mode",
+								     "Mode of prelight icons being rendered (0=normal, 1=spotlight, 2=colorize, 3=colorize-monochromely)",
+								     0, 3,
+								     DEFAULT_PRELIGHT_ICON_RENDER_MODE,
+								     G_PARAM_READABLE));
+	gtk_widget_class_install_style_property (widget_class,
+						 g_param_spec_boxed ("normal_icon_color",
+								     "Icon Normal Color",
+								     "Color used for colorizing icons in normal state (default base[NORMAL])",
+								     GDK_TYPE_COLOR,
+								     G_PARAM_READABLE));
+	gtk_widget_class_install_style_property (widget_class,
+						 g_param_spec_boxed ("prelight_icon_color",
+								     "Icon Prelight Color",
+								     "Color used for colorizing prelighted icons (default base[PRELIGHT])",
+								     GDK_TYPE_COLOR,
+								     G_PARAM_READABLE));
+	gtk_widget_class_install_style_property (widget_class,
+						 g_param_spec_uint ("normal_icon_saturation",
+								     "Normal Icon Saturation",
+								     "Saturation of icons in normal state",
+								     0, 255,
+								     DEFAULT_NORMAL_ICON_SATURATION,
+								     G_PARAM_READABLE));
+	gtk_widget_class_install_style_property (widget_class,
+						 g_param_spec_uint ("prelight_icon_saturation",
+								     "Prelight Icon Saturation",
+								     "Saturation of icons in prelight state",
+								     0, 255,
+								     DEFAULT_PRELIGHT_ICON_SATURATION,
+								     G_PARAM_READABLE));
+	gtk_widget_class_install_style_property (widget_class,
+						 g_param_spec_uint ("normal_icon_brightness",
+								     "Normal Icon Brightness",
+								     "Brightness of icons in normal state",
+								     0, 255,
+								     DEFAULT_NORMAL_ICON_BRIGHTNESS,
+								     G_PARAM_READABLE));
+	gtk_widget_class_install_style_property (widget_class,
+						 g_param_spec_uint ("prelight_icon_brightness",
+								     "Prelight Icon Brightness",
+								     "Brightness of icons in prelight state",
+								     0, 255,
+								     DEFAULT_PRELIGHT_ICON_BRIGHTNESS,
+								     G_PARAM_READABLE));
+	gtk_widget_class_install_style_property (widget_class,
+						 g_param_spec_uint ("normal_icon_lighten",
+								     "Normal Icon Lighten",
+								     "Lighten icons in normal state",
+								     0, 255,
+								     DEFAULT_NORMAL_ICON_LIGHTEN,
+								     G_PARAM_READABLE));
+	gtk_widget_class_install_style_property (widget_class,
+						 g_param_spec_uint ("prelight_icon_lighten",
+								     "Prelight Icon Lighten",
+								     "Lighten icons in prelight state",
+								     0, 255,
+								     DEFAULT_PRELIGHT_ICON_LIGHTEN,
+								     G_PARAM_READABLE));
+	gtk_widget_class_install_style_property (widget_class,
+						 g_param_spec_boolean ("activate_prelight_icon_label",
+								     "Activate Prelight Icon Label",
+								     "Whether icon labels should make use of its prelight color in prelight state",
+								     FALSE,
+								     G_PARAM_READABLE));
+								     								     
+
 	binding_set = gtk_binding_set_by_class (class);
 
 	gtk_binding_entry_add_signal (binding_set, GDK_f, GDK_CONTROL_MASK, "start_interactive_search", 0);
@@ -4926,7 +5019,6 @@ handle_focus_out_event (GtkWidget *widge
 {
 	/* End renaming and commit change. */
 	end_renaming_mode (NAUTILUS_ICON_CONTAINER (widget), TRUE);
-	
 	update_selected (NAUTILUS_ICON_CONTAINER (widget));
 
 	return FALSE;
@@ -7016,10 +7108,11 @@ GdkGC *
 nautilus_icon_container_get_label_color_and_gc (NautilusIconContainer *container,
 						GdkColor             **color,
 						gboolean               is_name,
-						gboolean               is_highlight)
+						gboolean               is_highlight,
+						gboolean		  is_prelit)
 {
 	int idx;
-
+	
 	if (is_name) {
 		if (is_highlight) {
 			if (GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (container))) {
@@ -7028,7 +7121,11 @@ nautilus_icon_container_get_label_color_
 				idx = LABEL_COLOR_ACTIVE;
 			}
 		} else {
-			idx = LABEL_COLOR;
+			if (is_prelit) {
+				idx = LABEL_COLOR_PRELIGHT;
+			} else {
+				idx = LABEL_COLOR;
+			}
 		}
 	} else {
 		if (is_highlight) {
@@ -7108,6 +7205,7 @@ setup_label_gcs (NautilusIconContainer *
 
 	setup_gc_with_fg (container, LABEL_COLOR_HIGHLIGHT, eel_gdk_color_to_rgb (&widget->style->text[GTK_STATE_SELECTED]));
 	setup_gc_with_fg (container, LABEL_COLOR_ACTIVE, eel_gdk_color_to_rgb (&widget->style->text[GTK_STATE_ACTIVE]));
+	setup_gc_with_fg (container, LABEL_COLOR_PRELIGHT, eel_gdk_color_to_rgb (&widget->style->text[GTK_STATE_PRELIGHT]));
 	setup_gc_with_fg (container, 
 			  LABEL_INFO_COLOR_HIGHLIGHT, 
 			  eel_gdk_color_is_dark (&GTK_WIDGET (container)->style->base[GTK_STATE_SELECTED]) ? light_info_value : dark_info_value);
@@ -7233,7 +7331,8 @@ nautilus_icon_container_theme_changed (g
 {
 	NautilusIconContainer *container;
 	GtkStyle *style;
-	guchar highlight_alpha, normal_alpha;
+	GdkColor *prelight_icon_color, *normal_icon_color;
+	guchar highlight_alpha, normal_alpha, prelight_alpha;
 
 	container = NAUTILUS_ICON_CONTAINER (user_data);
 	
@@ -7261,17 +7360,70 @@ nautilus_icon_container_theme_changed (g
 				     style->base[GTK_STATE_ACTIVE].green >> 8, 
 				     style->base[GTK_STATE_ACTIVE].blue >> 8,
 				     highlight_alpha);
-	
+
+	/* load the prelight icon color */
+	gtk_widget_style_get (GTK_WIDGET (container),
+			      "prelight_icon_color", &prelight_icon_color,
+			      NULL);
+
+	if (prelight_icon_color) {
+		container->details->prelight_icon_color_rgba = 
+			EEL_RGBA_COLOR_PACK (prelight_icon_color->red >> 8, 
+					     prelight_icon_color->green >> 8, 
+					     prelight_icon_color->blue >> 8,
+					     255);
+	} else { /* if not defined by rc, set to default value */
+		container->details->prelight_icon_color_rgba = 
+			EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_PRELIGHT].red >> 8,
+					     style->base[GTK_STATE_PRELIGHT].green >> 8,
+					     style->base[GTK_STATE_PRELIGHT].blue >> 8,
+					     255);
+	}
+  
+  
+	/* load the normal icon color */
+	gtk_widget_style_get (GTK_WIDGET (container),
+			      "normal_icon_color", &normal_icon_color,
+			      NULL);
+
+	if (normal_icon_color) {
+		container->details->normal_icon_color_rgba = 
+			EEL_RGBA_COLOR_PACK (normal_icon_color->red >> 8, 
+					     normal_icon_color->green >> 8, 
+					     normal_icon_color->blue >> 8,
+					     255);
+	} else { /* if not defined by rc, set to default value */
+		container->details->normal_icon_color_rgba = 
+			EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_NORMAL].red >> 8, 
+					     style->base[GTK_STATE_NORMAL].green >> 8, 
+					     style->base[GTK_STATE_NORMAL].blue >> 8,
+					     255);
+	}
+
+
 	/* load the normal color */
 	gtk_widget_style_get (GTK_WIDGET (container),
 			      "normal_alpha", &normal_alpha,
 			      NULL);
-	
+
 	container->details->normal_color_rgba = 
 		EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_NORMAL].red >> 8, 
 				     style->base[GTK_STATE_NORMAL].green >> 8, 
 				     style->base[GTK_STATE_NORMAL].blue >> 8,
 				     normal_alpha);
+
+
+	/* load the prelight color */
+	gtk_widget_style_get (GTK_WIDGET (container),
+			      "prelight_alpha", &prelight_alpha,
+			      NULL);
+
+	container->details->prelight_color_rgba = 
+		EEL_RGBA_COLOR_PACK (style->base[GTK_STATE_PRELIGHT].red >> 8, 
+				     style->base[GTK_STATE_PRELIGHT].green >> 8, 
+				     style->base[GTK_STATE_PRELIGHT].blue >> 8,
+				     prelight_alpha);
+
 
 	setup_label_gcs (container);
 }
Index: libnautilus-private/nautilus-icon-private.h
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-private.h,v
retrieving revision 1.85
diff -u -p -r1.85 nautilus-icon-private.h
--- libnautilus-private/nautilus-icon-private.h	28 Nov 2006 09:09:31 -0000	1.85
+++ libnautilus-private/nautilus-icon-private.h	28 Nov 2006 09:42:51 -0000
@@ -104,6 +104,7 @@ enum {
 	LABEL_COLOR,
 	LABEL_COLOR_HIGHLIGHT,
 	LABEL_COLOR_ACTIVE,
+	LABEL_COLOR_PRELIGHT,
 	LABEL_INFO_COLOR,
 	LABEL_INFO_COLOR_HIGHLIGHT,
 	LABEL_INFO_COLOR_ACTIVE,
@@ -196,7 +197,10 @@ struct NautilusIconContainerDetails {
 	guint32    highlight_color_rgba;
 	guint32    active_color_rgba;
 	guint32    normal_color_rgba;
-	
+	guint32    prelight_color_rgba;
+	guint32    prelight_icon_color_rgba;
+	guint32    normal_icon_color_rgba;
+
 	/* colors for text labels */
 	GdkGC   *label_gcs    [LAST_LABEL_COLOR];
 	GdkColor label_colors [LAST_LABEL_COLOR];
@@ -298,6 +302,7 @@ void          nautilus_icon_container_up
 GdkGC        *nautilus_icon_container_get_label_color_and_gc      (NautilusIconContainer *container,
 								   GdkColor             **color,
 								   gboolean               first_line,
-								   gboolean               needs_highlight);
+								   gboolean               needs_highlight,
+								   gboolean		     is_prelit);
 
 #endif /* NAUTILUS_ICON_CONTAINER_PRIVATE_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]