Am Mittwoch, den 13.07.2005, 13:33 +0200 schrieb Alexander Larsson: > On Tue, 2005-07-12 at 17:36 +0200, Christian Neumair wrote: > > 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. > > + bookmark = nautilus_bookmark_new (uri, "foo"); > > Creating a bookmark like that does all sorts of i/o, which can cause > authentication and whatnot on a too early state. Instead, just get the > uri from the bookmark and compare it. I didn't realize that the involved backend is *that* complex (GnomeVFS etc.). I wanted to make this code run optimal for big numbers of bookmarks. -- 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.435 diff -u -p -r1.435 nautilus-navigation-window.c --- src/nautilus-navigation-window.c 13 Jul 2005 10:39:43 -0000 1.435 +++ src/nautilus-navigation-window.c 13 Jul 2005 11:44:52 -0000 @@ -270,14 +270,47 @@ always_use_location_entry_changed (gpoin } } +static int +bookmark_list_get_uri_index (GList *list, + const char *uri) +{ + NautilusBookmark *bookmark; + GList *l; + char *tmp; + int i; + + g_return_val_if_fail (uri != NULL, -1); + + for (i = 0, l = list; l != NULL; i++, l = l->next) { + bookmark = NAUTILUS_BOOKMARK (l->data); + + tmp = nautilus_bookmark_get_uri (bookmark); + if (strcmp (tmp, uri) == 0) { + g_free (tmp); + return i; + } + g_free (tmp); + } + + return -1; +} 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