[PATCH] Fix shift-select in manual icon layout mode



From bug 150116 [1]:

"When trying to select a range of files if ordering is set to manual,
the range of files is determined by file names instead of spatial
location.

This is especially obvious on the desktop where there is no auto-sort."

Proposed patch attached. If you don't like the two separate code-paths
mangled into one function (like classic C coders do), we can also split
these two loops out into separate functions.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=150116

-- 
Christian Neumair <chris gnome-de org>
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-icon-container.c,v
retrieving revision 1.392
diff -u -p -r1.392 nautilus-icon-container.c
--- libnautilus-private/nautilus-icon-container.c	6 Jul 2005 12:18:27 -0000	1.392
+++ libnautilus-private/nautilus-icon-container.c	12 Jul 2005 16:13:02 -0000
@@ -1771,26 +1782,50 @@ select_range (NautilusIconContainer *con
 
 	unmatched_icon = NULL;
 	select = FALSE;
-	for (p = container->details->icons; p != NULL; p = p->next) {
-		icon = p->data;
+	if (container->details->auto_layout) {
+		for (p = container->details->icons; p != NULL; p = p->next) {
+			icon = p->data;
 
-		if (unmatched_icon == NULL) {
-			if (icon == icon1) {
-				unmatched_icon = icon2;
-				select = TRUE;
-			} else if (icon == icon2) {
-				unmatched_icon = icon1;
-				select = TRUE;
+			if (unmatched_icon == NULL) {
+				if (icon == icon1) {
+					unmatched_icon = icon2;
+					select = TRUE;
+				} else if (icon == icon2) {
+					unmatched_icon = icon1;
+					select = TRUE;
+				}
+			}
+			
+			selection_changed |= icon_set_selected
+				(container, icon, select);
+
+			if (unmatched_icon != NULL && icon == unmatched_icon) {
+				select = FALSE;
 			}
+			
 		}
-		
-		selection_changed |= icon_set_selected
-			(container, icon, select);
+	} else {
+		double x0, x1, y0, y1;
 
-		if (unmatched_icon != NULL && icon == unmatched_icon) {
-			select = FALSE;
+		x0 = MIN (icon1->x, icon2->x);
+		x1 = MAX (icon1->x, icon2->x);
+		y0 = MIN (icon1->y, icon2->y);
+		y1 = MAX (icon1->y, icon2->y);
+
+		for (p = container->details->icons; p != NULL; p = p->next) {
+			icon = p->data;
+
+			if (icon->x >= x0 && icon->x <= x1 &&
+			    icon->y >= y0 && icon->y <= y1) {
+				select = TRUE;
+			} else {
+				select = FALSE;
+			}
+			
+			selection_changed |= icon_set_selected
+				(container, icon, select);
 		}
-		
+
 	}
 	
 	if (selection_changed && icon2 != NULL) {

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



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