[PATCH] Desktop Icons with "Keep Aligned"



Hi,

As explained in a number of bug reports (~9 on bugzilla), desktop icon alignment doesn't seem to work exactly right, or at least in a way that is intuitive. My proposed fix is attached at https://bugzilla.gnome.org/show_bug.cgi?id=601469 as well as to this email.

I did some experimenting with grid spacing and found that higher SNAP_SIZE_X / Y values make a better-looking grid. Similar patches appear in some bug reports, but it appears none have been committed yet. Ideally, I think grid spacing should be user-configurable in gconf keys, and it appears https://bugzilla.gnome.org/show_bug.cgi?id=530430 contains a possible patch for this.

The other issue I addressed was how icons can "stack" on each other. I found that using schedule_align_icons() in icon_set_position() makes everything align strictly to the grid. This change also fixes other issues like unaligned icons that are newly created or dragged from another window. I would appreciate any comments on this.

Thanks,
Bill Smith



>From 98e0cb282fb49105d0f28124a2fea53f0a03671b Mon Sep 17 00:00:00 2001
From: Bill Smith <snowmanam2 gmail com>
Date: Thu, 7 Jan 2010 20:55:03 -0600
Subject: [PATCH] Desktop grid snap and overlapping icons

The previous grid size resulted in overlapping icons on the desktop.
This patch corrects the grid size and realigns the icons with
schedule_align_icons() to prevent overlapping icons.
---
 libnautilus-private/nautilus-icon-container.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index ae58a49..429b8c3 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -106,8 +106,8 @@
 /* Desktop layout mode defines */
 #define DESKTOP_PAD_HORIZONTAL 	10
 #define DESKTOP_PAD_VERTICAL 	10
-#define SNAP_SIZE_X 		78
-#define SNAP_SIZE_Y 		20
+#define SNAP_SIZE_X 		130
+#define SNAP_SIZE_Y 		104
 
 #define DEFAULT_SELECTION_BOX_ALPHA 0x40
 #define DEFAULT_HIGHLIGHT_ALPHA 0xff
@@ -225,6 +225,8 @@ static int compare_icons_vertical (NautilusIconContainer *container,
 
 static void store_layout_timestamps_now (NautilusIconContainer *container);
 
+static void schedule_align_icons (NautilusIconContainer *container);
+
 static gpointer accessible_parent_class;
 
 static GQuark accessible_private_data_quark = 0;
@@ -328,6 +330,10 @@ icon_set_position (NautilusIcon *icon,
 
 	container = NAUTILUS_ICON_CONTAINER (EEL_CANVAS_ITEM (icon->item)->canvas);
 
+	if (container->details->keep_aligned) {
+		schedule_align_icons (container);
+	}
+
 	if (icon == get_icon_being_renamed (container)) {
 		end_renaming_mode (container, TRUE);
 	}
-- 
1.6.3.3



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