Icon view navigation



Dear usability crew,

in an effort to fix bug 9930 [1], which complains that when pressing
right in the last icon column, the selection doesn't move to the next
row, first column, I've noticed that providing a good icon keynav isn't
trivial. Some observations/questions:

* Users (including me) indeed tend to use the right/left key as "give me
next/prev. icon", where the list is read zig-zag, i.e. the nth row, last
icon preceeds the n+1th row, first icon
* When you have the first column/row focused and press left, would you
expect to be taken to the first row, last column? What about the last
icon in the view and the right key?
* Should the selection "wrap"? We currently select everything in the
matrix between and including the start icon of the selection and the
msot recently selected item, i.e. we have a selection pane, as if you
selected everything in between with the rubberband.

The attached patch introduces the behavior described in the first two *.
Maybe an usability tester could point out other observations?

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

-- 
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.390
diff -u -p -r1.390 nautilus-icon-container.c
--- libnautilus-private/nautilus-icon-container.c	5 Jul 2005 12:23:34 -0000	1.390
+++ libnautilus-private/nautilus-icon-container.c	6 Jul 2005 09:02:28 -0000
@@ -186,6 +186,8 @@ static void          handle_vadjustment_
 static void          nautilus_icon_container_prioritize_thumbnailing_for_visible_icons (NautilusIconContainer *container);
 static void          reveal_icon                                    (NautilusIconContainer *container,
 								     NautilusIcon *icon);
+static int           compare_with_start_row                         (NautilusIconContainer *container,
+								     NautilusIcon *icon);
 
 
 static gpointer accessible_parent_class;
@@ -2317,6 +2319,68 @@ leftmost_in_top_row (NautilusIconContain
 }
 
 static gboolean
+rightmost_in_top_row (NautilusIconContainer *container,
+		      NautilusIcon *start_icon,
+		      NautilusIcon *best_so_far,
+		      NautilusIcon *candidate,
+		      void *data)
+{
+	/* Candidates after or in the start row do not qualify. */
+	if (compare_with_start_row (container, candidate) > 0) {
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+static gboolean
+leftmost_in_same_row (NautilusIconContainer *container,
+		      NautilusIcon *start_icon,
+		      NautilusIcon *best_so_far,
+		      NautilusIcon *candidate,
+		      void *data)
+{
+	/* Candidates before the start row do not qualify. */
+	if (best_so_far == NULL &&
+	    compare_with_start_row (container, candidate) == 0) {
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+static gboolean
+rightmost_in_same_row (NautilusIconContainer *container,
+		       NautilusIcon *start_icon,
+		       NautilusIcon *best_so_far,
+		       NautilusIcon *candidate,
+		       void *data)
+{
+	/* Candidates before the start row do not qualify. */
+	if (compare_with_start_row (container, candidate) == 0) {
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+static gboolean
+leftmost_in_bottom_row (NautilusIconContainer *container,
+			NautilusIcon *start_icon,
+			NautilusIcon *best_so_far,
+			NautilusIcon *candidate,
+			void *data)
+{
+	/* Candidates before or in the start row do not qualify. */
+	if (best_so_far != NULL ||
+	    compare_with_start_row (container, candidate) >= 0) {
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
 rightmost_in_bottom_row (NautilusIconContainer *container,
 			 NautilusIcon *start_icon,
 			 NautilusIcon *best_so_far,
@@ -2702,7 +2766,9 @@ keyboard_arrow_key (NautilusIconContaine
 		    IsBetterIconFunction better_start,
 		    IsBetterIconFunction empty_start,
 		    IsBetterIconFunction better_destination,
-		    IsBetterIconFunction better_destination_manual)
+		    IsBetterIconFunction better_destination_manual,
+		    IsBetterIconFunction alternative_destination,
+		    IsBetterIconFunction worse_destination)
 {
 	NautilusIcon *from;
 	NautilusIcon *to;
@@ -2748,6 +2814,19 @@ keyboard_arrow_key (NautilusIconContaine
 			(container, from,
 			 container->details->auto_layout ? better_destination : better_destination_manual,
 			 &data);
+
+		if (container->details->auto_layout) {
+			if (to == NULL &&
+			    alternative_destination != NULL) {
+				to = find_best_icon 
+					(container, from, alternative_destination, &data);
+			}
+			if (to == NULL &&
+			    worse_destination != NULL) {
+				to = find_best_icon
+					(container, from, worse_destination, &data);
+			}
+		}
 	}
 
 	keyboard_move_to (container, to, from, event);
@@ -2766,7 +2845,9 @@ keyboard_right (NautilusIconContainer *c
 			    rightmost_in_bottom_row,
 			    leftmost_in_top_row,
 			    same_row_right_side_leftmost,
-			    closest_in_90_degrees);
+			    closest_in_90_degrees,
+			    leftmost_in_bottom_row,
+			    leftmost_in_same_row);
 }
 
 static void
@@ -2782,7 +2863,9 @@ keyboard_left (NautilusIconContainer *co
 			    leftmost_in_top_row,
 			    rightmost_in_bottom_row,
 			    same_row_left_side_rightmost,
-			    closest_in_90_degrees);
+			    closest_in_90_degrees,
+			    rightmost_in_top_row,
+			    rightmost_in_same_row);
 }
 
 static void
@@ -2798,7 +2881,8 @@ keyboard_down (NautilusIconContainer *co
 			    rightmost_in_bottom_row,
 			    leftmost_in_top_row,
 			    same_column_below_highest,
-			    closest_in_90_degrees);
+			    closest_in_90_degrees,
+			    NULL, NULL);
 }
 
 static void
@@ -2814,7 +2898,8 @@ keyboard_up (NautilusIconContainer *cont
 			    leftmost_in_top_row,
 			    rightmost_in_bottom_row,
 			    same_column_above_lowest,
-			    closest_in_90_degrees);
+			    closest_in_90_degrees,
+			    NULL, NULL);
 }
 
 static void

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



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