nautilus r14616 - in trunk: . libnautilus-private



Author: cneumair
Date: Fri Sep 12 10:05:08 2008
New Revision: 14616
URL: http://svn.gnome.org/viewvc/nautilus?rev=14616&view=rev

Log:
2008-09-12  Christian Neumair  <cneumair gnome org>

	* libnautilus-private/nautilus-icon-canvas-item.c
	(nautilus_icon_canvas_item_set_is_visible),
	(nautilus_icon_canvas_item_invalidate_label):
	* libnautilus-private/nautilus-icon-canvas-item.h:
	* libnautilus-private/nautilus-icon-container.c
	(invalidate_labels), (nautilus_icon_container_set_layout_mode),
	(nautilus_icon_container_set_label_position),
	(nautilus_icon_container_set_font),
	(nautilus_icon_container_set_font_size_table),
	(nautilus_icon_container_set_all_columns_same_width):
	Add nautilus_icon_canvas_item_invalidate_label(), which removes the
	associated PangoLayout - used when resetting attributes, e.g. when the
	zoom level changes or when switching from âtext belowâ to âtext
	besidesâ mode. Fixes #551862.


Modified:
   trunk/ChangeLog
   trunk/libnautilus-private/nautilus-icon-canvas-item.c
   trunk/libnautilus-private/nautilus-icon-canvas-item.h
   trunk/libnautilus-private/nautilus-icon-container.c

Modified: trunk/libnautilus-private/nautilus-icon-canvas-item.c
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-canvas-item.c	(original)
+++ trunk/libnautilus-private/nautilus-icon-canvas-item.c	Fri Sep 12 10:05:08 2008
@@ -1427,18 +1427,28 @@
 	item->details->is_visible = visible;
 
 	if (!visible) {
-		if (item->details->editable_text_layout) {
-			g_object_unref (item->details->editable_text_layout);
-			item->details->editable_text_layout = NULL;
-		}
-		if (item->details->additional_text_layout) {
-			g_object_unref (item->details->additional_text_layout);
-			item->details->additional_text_layout = NULL;
-		}
-		if (item->details->embedded_text_layout) {
-			g_object_unref (item->details->embedded_text_layout);
-			item->details->embedded_text_layout = NULL;
-		}
+		nautilus_icon_canvas_item_invalidate_label (item);
+	}
+}
+
+void
+nautilus_icon_canvas_item_invalidate_label (NautilusIconCanvasItem     *item)
+{
+	nautilus_icon_canvas_item_invalidate_label_size (item);
+
+	if (item->details->editable_text_layout) {
+		g_object_unref (item->details->editable_text_layout);
+		item->details->editable_text_layout = NULL;
+	}
+
+	if (item->details->additional_text_layout) {
+		g_object_unref (item->details->additional_text_layout);
+		item->details->additional_text_layout = NULL;
+	}
+
+	if (item->details->embedded_text_layout) {
+		g_object_unref (item->details->embedded_text_layout);
+		item->details->embedded_text_layout = NULL;
 	}
 }
 

Modified: trunk/libnautilus-private/nautilus-icon-canvas-item.h
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-canvas-item.h	(original)
+++ trunk/libnautilus-private/nautilus-icon-canvas-item.h	Fri Sep 12 10:05:08 2008
@@ -93,6 +93,7 @@
 gboolean    nautilus_icon_canvas_item_hit_test_stretch_handles (NautilusIconCanvasItem       *item,
 								EelDPoint                     world_point,
 								GtkCornerType                *corner);
+void        nautilus_icon_canvas_item_invalidate_label         (NautilusIconCanvasItem       *item);
 void        nautilus_icon_canvas_item_invalidate_label_size    (NautilusIconCanvasItem       *item);
 EelDRect    nautilus_icon_canvas_item_get_icon_rectangle       (const NautilusIconCanvasItem *item);
 EelDRect    nautilus_icon_canvas_item_get_text_rectangle       (NautilusIconCanvasItem       *item,

Modified: trunk/libnautilus-private/nautilus-icon-container.c
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-container.c	(original)
+++ trunk/libnautilus-private/nautilus-icon-container.c	Fri Sep 12 10:05:08 2008
@@ -2294,6 +2294,20 @@
 	}
 }
 
+/* invalidate the entire labels (i.e. their attributes) for all the icons */
+static void
+invalidate_labels (NautilusIconContainer *container)
+{
+	GList *p;
+	NautilusIcon *icon;
+	
+	for (p = container->details->icons; p != NULL; p = p->next) {
+		icon = p->data;
+
+		nautilus_icon_canvas_item_invalidate_label (icon->item);		
+	}
+}
+
 static gboolean
 select_range (NautilusIconContainer *container,
 	      NautilusIcon *icon1,
@@ -7985,7 +7999,7 @@
 	g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (container));
 
 	container->details->layout_mode = mode;
-	invalidate_label_sizes (container);
+	invalidate_labels (container);
 
 	redo_layout (container);
 
@@ -8001,7 +8015,7 @@
 	if (container->details->label_position != position) {
 		container->details->label_position = position;
 
-		invalidate_label_sizes (container);
+		invalidate_labels (container);
 		nautilus_icon_container_request_update_all (container);
 
 		schedule_redo_layout (container);
@@ -8715,7 +8729,7 @@
 	g_free (container->details->font);
 	container->details->font = g_strdup (font);
 
-	invalidate_label_sizes (container);
+	invalidate_labels (container);
 	nautilus_icon_container_request_update_all (container);
 	gtk_widget_queue_draw (GTK_WIDGET (container));
 }
@@ -8739,7 +8753,7 @@
 	}
 
 	if (old_font_size != container->details->font_size_table[container->details->zoom_level]) {
-		invalidate_label_sizes (container);
+		invalidate_labels (container);
 		nautilus_icon_container_request_update_all (container);
 	}
 }
@@ -8806,7 +8820,7 @@
 	if (all_columns_same_width != container->details->all_columns_same_width) {
 		container->details->all_columns_same_width = all_columns_same_width;
 
-		invalidate_label_sizes (container);
+		invalidate_labels (container);
 		nautilus_icon_container_request_update_all (container);
 	}
 }



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