summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libnautilus-private/nautilus-bookmark.c26
-rw-r--r--libnautilus-private/nautilus-bookmark.h2
-rw-r--r--src/nautilus-bookmark-list.c65
-rw-r--r--src/nautilus-bookmark-list.h4
-rw-r--r--src/nautilus-places-sidebar.c5
-rw-r--r--src/nautilus-window-menus.c4
6 files changed, 7 insertions, 99 deletions
diff --git a/libnautilus-private/nautilus-bookmark.c b/libnautilus-private/nautilus-bookmark.c
index de4ac904b..2d0586db7 100644
--- a/libnautilus-private/nautilus-bookmark.c
+++ b/libnautilus-private/nautilus-bookmark.c
@@ -640,32 +640,6 @@ nautilus_bookmark_compare_with (gconstpointer a, gconstpointer b)
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 !g_file_equal (bookmark_a->details->location,
- bookmark_b->details->location);
-}
-
GIcon *
nautilus_bookmark_get_symbolic_icon (NautilusBookmark *bookmark)
{
diff --git a/libnautilus-private/nautilus-bookmark.h b/libnautilus-private/nautilus-bookmark.h
index 68e10b0e0..4284fefc7 100644
--- a/libnautilus-private/nautilus-bookmark.h
+++ b/libnautilus-private/nautilus-bookmark.h
@@ -77,8 +77,6 @@ void nautilus_bookmark_set_custom_name (NautilusBookmark
const char *new_name);
int nautilus_bookmark_compare_with (gconstpointer a,
gconstpointer b);
-int nautilus_bookmark_compare_uris (gconstpointer a,
- gconstpointer b);
void nautilus_bookmark_set_scroll_pos (NautilusBookmark *bookmark,
const char *uri);
diff --git a/src/nautilus-bookmark-list.c b/src/nautilus-bookmark-list.c
index 1ff7b8f4a..a3319d97d 100644
--- a/src/nautilus-bookmark-list.c
+++ b/src/nautilus-bookmark-list.c
@@ -251,33 +251,16 @@ nautilus_bookmark_list_append (NautilusBookmarkList *bookmarks,
g_return_if_fail (NAUTILUS_IS_BOOKMARK_LIST (bookmarks));
g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark));
+ if (g_list_find_custom (bookmarks->list, bookmark,
+ nautilus_bookmark_compare_with) != NULL) {
+ return;
+ }
+
insert_bookmark_internal (bookmarks, g_object_ref (bookmark), -1);
nautilus_bookmark_list_save_file (bookmarks);
}
/**
- * nautilus_bookmark_list_contains:
- *
- * Check whether a bookmark with matching name and url is already in the list.
- * @bookmarks: NautilusBookmarkList to check contents of.
- * @bookmark: NautilusBookmark to match against.
- *
- * Return value: TRUE if matching bookmark is in list, FALSE otherwise
- **/
-gboolean
-nautilus_bookmark_list_contains (NautilusBookmarkList *bookmarks,
- NautilusBookmark *bookmark)
-{
- g_return_val_if_fail (NAUTILUS_IS_BOOKMARK_LIST (bookmarks), FALSE);
- g_return_val_if_fail (NAUTILUS_IS_BOOKMARK (bookmark), FALSE);
-
- return g_list_find_custom (bookmarks->list,
- (gpointer)bookmark,
- nautilus_bookmark_compare_with)
- != NULL;
-}
-
-/**
* nautilus_bookmark_list_delete_item_at:
*
* Delete the bookmark at the specified position.
@@ -335,44 +318,6 @@ nautilus_bookmark_list_move_item (NautilusBookmarkList *bookmarks,
}
/**
- * nautilus_bookmark_list_delete_items_with_uri:
- *
- * Delete all bookmarks with the given uri.
- * @bookmarks: the list of bookmarks.
- * @uri: The uri to match.
- **/
-void
-nautilus_bookmark_list_delete_items_with_uri (NautilusBookmarkList *bookmarks,
- const char *uri)
-{
- GList *node, *next;
- gboolean list_changed;
- char *bookmark_uri;
-
- g_return_if_fail (NAUTILUS_IS_BOOKMARK_LIST (bookmarks));
- g_return_if_fail (uri != NULL);
-
- list_changed = FALSE;
- for (node = bookmarks->list; node != NULL; node = next) {
- next = node->next;
-
- bookmark_uri = nautilus_bookmark_get_uri (NAUTILUS_BOOKMARK (node->data));
- if (g_strcmp0 (bookmark_uri, uri) == 0) {
- bookmarks->list = g_list_remove_link (bookmarks->list, node);
- stop_monitoring_bookmark (bookmarks, NAUTILUS_BOOKMARK (node->data));
- g_object_unref (node->data);
- g_list_free_1 (node);
- list_changed = TRUE;
- }
- g_free (bookmark_uri);
- }
-
- if (list_changed) {
- nautilus_bookmark_list_save_file (bookmarks);
- }
-}
-
-/**
* nautilus_bookmark_list_insert_item:
*
* Insert a bookmark at a specified position.
diff --git a/src/nautilus-bookmark-list.h b/src/nautilus-bookmark-list.h
index a9227cfad..b498c1f63 100644
--- a/src/nautilus-bookmark-list.h
+++ b/src/nautilus-bookmark-list.h
@@ -63,12 +63,8 @@ GType nautilus_bookmark_list_get_type (void);
NautilusBookmarkList * nautilus_bookmark_list_new (void);
void nautilus_bookmark_list_append (NautilusBookmarkList *bookmarks,
NautilusBookmark *bookmark);
-gboolean nautilus_bookmark_list_contains (NautilusBookmarkList *bookmarks,
- NautilusBookmark *bookmark);
void nautilus_bookmark_list_delete_item_at (NautilusBookmarkList *bookmarks,
guint index);
-void nautilus_bookmark_list_delete_items_with_uri (NautilusBookmarkList *bookmarks,
- const char *uri);
void nautilus_bookmark_list_insert_item (NautilusBookmarkList *bookmarks,
NautilusBookmark *bookmark,
guint index);
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index 6fc90ae72..b427e0a91 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -1877,10 +1877,7 @@ add_bookmark (NautilusPlacesSidebar *sidebar)
location = g_file_new_for_uri (uri);
bookmark = nautilus_bookmark_new (location, name);
-
- if (!nautilus_bookmark_list_contains (sidebar->bookmarks, bookmark)) {
- nautilus_bookmark_list_append (sidebar->bookmarks, bookmark);
- }
+ nautilus_bookmark_list_append (sidebar->bookmarks, bookmark);
g_object_unref (location);
g_object_unref (bookmark);
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index a61fb241b..6d191865c 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -318,9 +318,7 @@ action_add_bookmark_callback (GtkAction *action,
bookmark = slot->current_location_bookmark;
list = nautilus_application_get_bookmarks (app);
- if (!nautilus_bookmark_list_contains (list, bookmark)) {
- nautilus_bookmark_list_append (list, bookmark);
- }
+ nautilus_bookmark_list_append (list, bookmark);
}
static void