nautilus r14881 - in trunk: . libnautilus-private



Author: cosimoc
Date: Thu Jan 22 20:32:03 2009
New Revision: 14881
URL: http://svn.gnome.org/viewvc/nautilus?rev=14881&view=rev

Log:
2009-01-22  Cosimo Cecchi  <cosimoc gnome org>

        * libnautilus-private/nautilus-icon-container.c:
        (snap_position): make sure we don't snap icons to a grid marker
        which is too near the right margin of the canvas (#527374).

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

Modified: trunk/libnautilus-private/nautilus-icon-container.c
==============================================================================
--- trunk/libnautilus-private/nautilus-icon-container.c	(original)
+++ trunk/libnautilus-private/nautilus-icon-container.c	Thu Jan 22 20:32:03 2009
@@ -1612,12 +1612,17 @@
 	int baseline_y;
 	int icon_width;
 	int icon_height;
+	int total_width;
+	int total_height;
 	EelDRect icon_position;
 	
 	icon_position = nautilus_icon_canvas_item_get_icon_rectangle (icon->item);
 	icon_width = icon_position.x1 - icon_position.x0;
 	icon_height = icon_position.y1 - icon_position.y0;
 
+	total_width = CANVAS_WIDTH (container);
+	total_height = CANVAS_HEIGHT (container);
+
 	if (nautilus_icon_container_is_layout_rtl (container))
 	    *x = get_mirror_x_position (container, icon, *x);
 
@@ -1625,10 +1630,18 @@
 		*x = DESKTOP_PAD_HORIZONTAL + SNAP_SIZE_X - icon_width / 2;
 	}
 
+	if (*x + icon_width / 2 > total_width - (DESKTOP_PAD_HORIZONTAL + SNAP_SIZE_X)) {
+		*x = total_width - (DESKTOP_PAD_HORIZONTAL + SNAP_SIZE_X + (icon_width / 2));
+	}
+
 	if (*y + icon_height < DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y) {
 		*y = DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y - icon_height;
 	}
 
+	if (*y + icon_height > total_height - (DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y)) {
+		*y = total_height - (DESKTOP_PAD_VERTICAL + SNAP_SIZE_Y + (icon_height / 2));
+	}
+
 	center_x = *x + icon_width / 2;
 	*x = SNAP_NEAREST_HORIZONTAL (center_x) - (icon_width / 2);
 	if (nautilus_icon_container_is_layout_rtl (container)) {



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