[nautilus] icon-container: remove useless theming properties



commit e2ca42cac78cb0287a1bbb73030e7bba8b171970
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Jan 19 19:30:14 2011 +0100

    icon-container: remove useless theming properties

 libnautilus-private/nautilus-icon-canvas-item.c |   29 +---------
 libnautilus-private/nautilus-icon-container.c   |   70 ++---------------------
 2 files changed, 8 insertions(+), 91 deletions(-)
---
diff --git a/libnautilus-private/nautilus-icon-canvas-item.c b/libnautilus-private/nautilus-icon-canvas-item.c
index d0e862a..cbfd3b7 100644
--- a/libnautilus-private/nautilus-icon-canvas-item.c
+++ b/libnautilus-private/nautilus-icon-canvas-item.c
@@ -1122,7 +1122,7 @@ draw_label_text (NautilusIconCanvasItem *item,
 	PangoLayout *additional_layout;
 	GdkRGBA label_color;
 	gboolean have_editable, have_additional;
-	gboolean needs_frame, needs_highlight, prelight_label, is_rtl_label_beside;
+	gboolean needs_highlight, prelight_label, is_rtl_label_beside;
 	EelIRect text_rect;
 	int x;
 	int max_text_width;
@@ -1193,10 +1193,9 @@ draw_label_text (NautilusIconCanvasItem *item,
 		prepare_pango_layout_for_draw (item, editable_layout);
 
 		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) {
+		if (!needs_highlight && details->text_width > 0 && details->text_height > 0) {
 			if (!(prelight_label && item->details->is_prelit)) {
 				draw_frame (item, 
 					    cr,
@@ -1482,30 +1481,6 @@ real_map_pixbuf (NautilusIconCanvasItem *icon_item)
 
 		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 = eel_gdk_pixbuf_render (temp_pixbuf,
-					    render_mode,
-					    saturation,
-					    brightness,
-					    lighten,
-					    &container->details->normal_icon_color_rgba);
-			g_object_unref (old_pixbuf);
-		}
-	}
 	
 	return temp_pixbuf;
 }
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index 8e23815..67257f6 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -4151,16 +4151,14 @@ setup_background (NautilusIconContainer *container)
 		DEBUG ("Container %p, making color inactive", container);
 		eel_make_color_inactive (&color);
 
-		gdk_window_set_background_rgba (window, &color);
 		gtk_widget_override_background_color (GTK_WIDGET (container), GTK_STATE_FLAG_NORMAL,
 						      &color);
+		gtk_style_context_set_background (style, window);
 	} else {
 		DEBUG ("Container %p, removing color override", container);
 		gtk_widget_override_background_color (GTK_WIDGET (container), GTK_STATE_FLAG_NORMAL,
 						      NULL);
-		gtk_style_context_get_background_color (style, GTK_STATE_FLAG_NORMAL, &color);
-
-		gdk_window_set_background_rgba (window, &color);
+		gtk_style_context_set_background (style, window);
 	}
 }
 
@@ -4215,18 +4213,12 @@ unrealize (GtkWidget *widget)
 
 static void
 style_set (GtkWidget *widget,
-	   GtkStyle  *previous_style)
+	   GtkStyle *previous_style)
 {
 	NautilusIconContainer *container;
-	gboolean frame_text;
 	
 	container = NAUTILUS_ICON_CONTAINER (widget);
-
-	gtk_style_context_get_style (gtk_widget_get_style_context (GTK_WIDGET (container)),
-				     "frame_text", &frame_text,
-				     NULL);
-
-	container->details->use_drop_shadows = container->details->drop_shadows_requested && !frame_text;
+	container->details->use_drop_shadows = container->details->drop_shadows_requested;
 
 	nautilus_icon_container_theme_changed (NAUTILUS_ICON_CONTAINER (widget));
 
@@ -6034,13 +6026,6 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class)
 	canvas_class->draw_background = draw_canvas_background;
 
 	class->start_interactive_search = nautilus_icon_container_start_interactive_search;
-	
-	gtk_widget_class_install_style_property (widget_class,
-						 g_param_spec_boolean ("frame_text",
-								       "Frame Text",
-								       "Draw a frame around unselected text",
-								       FALSE,
-								       G_PARAM_READABLE));
 
 	gtk_widget_class_install_style_property (widget_class,
 						 g_param_spec_boxed ("selection_box_rgba",
@@ -6061,14 +6046,6 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class)
 								     "Color used for information text against a light background",
 								     GDK_TYPE_RGBA,
 								     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",
@@ -6089,13 +6066,6 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class)
 								     GDK_TYPE_RGBA,
 								     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",
@@ -6103,13 +6073,6 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class)
 								     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",
@@ -6117,13 +6080,6 @@ nautilus_icon_container_class_init (NautilusIconContainerClass *class)
 								     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",
@@ -8565,7 +8521,6 @@ setup_label_gcs (NautilusIconContainer *container)
 {
 	GtkWidget *widget;
 	GdkRGBA *light_info_color, *dark_info_color;
-	gboolean frame_text;
 	GtkStyleContext *style;
 	GdkRGBA color;
 	
@@ -8612,14 +8567,7 @@ setup_label_gcs (NautilusIconContainer *container)
 			  LABEL_INFO_COLOR_ACTIVE,
 			  eel_gdk_rgba_is_dark (&color) ? light_info_color : dark_info_color);
 		
-	/* If NautilusIconContainer::frame_text is set, we can safely
-	 * use the foreground color from the theme, because it will
-	 * always be displayed against the gtk background */
-	gtk_style_context_get_style (gtk_widget_get_style_context (GTK_WIDGET (container)),
-				     "frame_text", &frame_text,
-				     NULL);
-
-	if (frame_text || !nautilus_icon_container_get_is_desktop (container)) {
+	if (!nautilus_icon_container_get_is_desktop (container)) {
 		gtk_style_context_get_color (style, GTK_STATE_FLAG_ACTIVE, &color);
 		setup_gc_with_fg (container, LABEL_COLOR, &color);
 
@@ -8697,18 +8645,12 @@ void
 nautilus_icon_container_set_use_drop_shadows (NautilusIconContainer  *container,
 					      gboolean                use_drop_shadows)
 {
-	gboolean frame_text;
-	
-	gtk_style_context_get_style (gtk_widget_get_style_context (GTK_WIDGET (container)),
-				     "frame_text", &frame_text,
-				     NULL);
-
 	if (container->details->drop_shadows_requested == use_drop_shadows) {
 		return;
 	}
 
 	container->details->drop_shadows_requested = use_drop_shadows;
-	container->details->use_drop_shadows = use_drop_shadows && !frame_text;
+	container->details->use_drop_shadows = use_drop_shadows;
 	gtk_widget_queue_draw (GTK_WIDGET (container));
 }
 



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