diff options
author | John Sullivan <sullivan@src.gnome.org> | 2000-09-08 01:03:21 +0000 |
---|---|---|
committer | John Sullivan <sullivan@src.gnome.org> | 2000-09-08 01:03:21 +0000 |
commit | 069f8b16c19ead5f6733aad1c780d2b14925781b (patch) | |
tree | abc971a05e1736f4363b7ac7b491ef383d52d4b7 /libnautilus-extensions/nautilus-bookmark.c | |
parent | bca62084f7a225fe4afa830810a013c149594345 (diff) | |
download | nautilus-069f8b16c19ead5f6733aad1c780d2b14925781b.tar.gz |
Fixed bug 2218 (Duplicate items appear in history list)
Also changed a few places to compare uris with the new
nautilus_uris_match instead of strcmp.
* libnautilus-extensions/nautilus-bookmark.h,
* libnautilus-extensions/nautilus-bookmark.c:
(nautilus_bookmark_compare_with): Use nautilus_uris_match.
(nautilus_bookmark_compare_uris): New function, compares
bookmarks' uris with nautilus_uris_match; ignores names.
* src/nautilus-window-manage-views.c:
(nautilus_window_set_displayed_location), (handle_go_elsewhere),
(open_location): Use nautilus_uris_match.
* src/nautilus-window.c: (nautilus_add_to_history_list):
Use nautilus_bookmark_compare_uris instead of _compare_with.
This was the source of the bug. Due to asynchronicity introduced
sometime after this code was written, when the bookmark for the
current location was created it did not yet know what name to use,
and so it did not match any of the old History items that had the
correct name. But for the History list we only want one entry per
uri anyway, so it needn't have been comparing the names in the
first place.
Diffstat (limited to 'libnautilus-extensions/nautilus-bookmark.c')
-rw-r--r-- | libnautilus-extensions/nautilus-bookmark.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/libnautilus-extensions/nautilus-bookmark.c b/libnautilus-extensions/nautilus-bookmark.c index f34caed17..7cd64e5a2 100644 --- a/libnautilus-extensions/nautilus-bookmark.c +++ b/libnautilus-extensions/nautilus-bookmark.c @@ -36,6 +36,7 @@ #include <libgnomevfs/gnome-vfs-types.h> #include <libgnomevfs/gnome-vfs-uri.h> #include <libgnomevfs/gnome-vfs-utils.h> +#include <libnautilus-extensions/nautilus-file-utilities.h> #include <libnautilus-extensions/nautilus-gdk-pixbuf-extensions.h> enum { @@ -144,15 +145,41 @@ nautilus_bookmark_compare_with (gconstpointer a, gconstpointer b) bookmark_b->details->name) != 0) { return 1; } - - if (strcmp (bookmark_a->details->uri, - bookmark_b->details->uri) != 0) { + + if (!nautilus_uris_match (bookmark_a->details->uri, + bookmark_b->details->uri)) { return 1; } return 0; } +/** + * nautilus_bookmark_compare_uris: + * + * Check whether the uris of two bookmarks are for the same location. + * @a: first NautilusBookmark*. + * @b: second NautilusBookmark*. + * + * Return value: 0 if @a and @b have matching uri, 1 otherwise + * (GCompareFunc style) + **/ +int +nautilus_bookmark_compare_uris (gconstpointer a, gconstpointer b) +{ + NautilusBookmark *bookmark_a; + NautilusBookmark *bookmark_b; + + g_return_val_if_fail (NAUTILUS_IS_BOOKMARK (a), 1); + g_return_val_if_fail (NAUTILUS_IS_BOOKMARK (b), 1); + + bookmark_a = NAUTILUS_BOOKMARK (a); + bookmark_b = NAUTILUS_BOOKMARK (b); + + return !nautilus_uris_match (bookmark_a->details->uri, + bookmark_b->details->uri); +} + NautilusBookmark * nautilus_bookmark_copy (NautilusBookmark *bookmark) { |