[PATCH] Fix pathbar history issue



From bug 310068 [1]:

"Steps to reproduce the problem:
1. Enter a folder with lots of stuff in it so that the scroll bar
appears
2. Scroll down a bit, then enter a sub-folder
3. Use the path bar to go back to the previous folder

Actual Results:
Scroll bar is at the beginning ot the parent folder.

Expected Results:
Scroll bar is at the position I scrolled to prior to entering the
sub-folder."

Proposed patch attached. I've fixed this by treating a pathbar location
change as back action if the target location is in the history.

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

-- 
Christian Neumair <chris gnome-de org>
Index: src/nautilus-navigation-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-navigation-window.c,v
retrieving revision 1.434
diff -u -p -r1.434 nautilus-navigation-window.c
--- src/nautilus-navigation-window.c	11 Jul 2005 08:52:21 -0000	1.434
+++ src/nautilus-navigation-window.c	12 Jul 2005 15:32:40 -0000
@@ -270,14 +264,50 @@ always_use_location_entry_changed (gpoin
 	}
 }
 
+static int
+bookmark_list_get_uri_index (GList *list,
+			     const char *uri)
+{
+	NautilusBookmark *bookmark;
+	GList *l;
+	int i;
+
+	g_return_val_if_fail (uri != NULL, -1);
+
+	bookmark = nautilus_bookmark_new (uri, "foo");
+
+	for (i = 0, l = list; l != NULL; i++, l = l->next) {
+		if (nautilus_bookmark_compare_uris (NAUTILUS_BOOKMARK (l->data), bookmark) == 0) {
+			break;
+		}
+	}
+
+	g_object_unref (bookmark);
+
+	if (l == NULL) {
+		return -1;
+	} else {
+		return i;
+	}
+
+}
 
 static void
 path_bar_location_changed_callback (GtkWidget *widget,
 				    const char *uri,
 				    NautilusNavigationWindow *window)
 {
+	int i;
+
 	g_assert (NAUTILUS_IS_NAVIGATION_WINDOW (window));
-	nautilus_window_go_to (NAUTILUS_WINDOW (window), uri);
+
+	/* check whether we already visited the target location */
+	i = bookmark_list_get_uri_index (window->back_list, uri);
+	if (i >= 0) {
+		nautilus_navigation_window_back_or_forward (window, TRUE, i);
+	} else {
+		nautilus_window_go_to (NAUTILUS_WINDOW (window), uri);
+	}
 }
 
 

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



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