summaryrefslogtreecommitdiff
path: root/src/nautilus-bookmark-list.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2012-10-22 12:44:29 -0400
committerCosimo Cecchi <cosimoc@gnome.org>2012-10-22 12:44:29 -0400
commit26e6907a9343e45500d4c3373e4210d072db08e1 (patch)
tree60fc2b00fda7f8487fa0bdda0b55f274435d4178 /src/nautilus-bookmark-list.c
parentd09413bcff9b62af6ea58d003ffe2b76c792a57f (diff)
downloadnautilus-26e6907a9343e45500d4c3373e4210d072db08e1.tar.gz
bookmark-list: change item_with_uri() API to use a GFile instead
Avoid GFile<->URI roundtrips if possible. Also, this will allow us to use the same API for another purpose.
Diffstat (limited to 'src/nautilus-bookmark-list.c')
-rw-r--r--src/nautilus-bookmark-list.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/nautilus-bookmark-list.c b/src/nautilus-bookmark-list.c
index a3319d97d..24dbe9244 100644
--- a/src/nautilus-bookmark-list.c
+++ b/src/nautilus-bookmark-list.c
@@ -356,35 +356,35 @@ nautilus_bookmark_list_item_at (NautilusBookmarkList *bookmarks, guint index)
}
/**
- * nautilus_bookmark_list_item_with_uri:
+ * nautilus_bookmark_list_item_with_location:
*
- * Get the bookmark with the specified URI, if any
+ * Get the bookmark with the specified location, if any
* @bookmarks: the list of bookmarks.
- * @uri: an URI
+ * @location: a #GFile
*
- * Return value: the bookmark with URI @uri, or %NULL.
+ * Return value: the bookmark with location @location, or %NULL.
**/
NautilusBookmark *
-nautilus_bookmark_list_item_with_uri (NautilusBookmarkList *bookmarks,
- const gchar *uri)
+nautilus_bookmark_list_item_with_location (NautilusBookmarkList *bookmarks,
+ GFile *location)
{
GList *node;
- gchar *bookmark_uri;
+ GFile *bookmark_location;
NautilusBookmark *bookmark;
gboolean found = FALSE;
g_return_val_if_fail (NAUTILUS_IS_BOOKMARK_LIST (bookmarks), NULL);
- g_return_val_if_fail (uri != NULL, NULL);
+ g_return_val_if_fail (G_IS_FILE (location), NULL);
for (node = bookmarks->list; node != NULL; node = node->next) {
bookmark = node->data;
- bookmark_uri = nautilus_bookmark_get_uri (bookmark);
+ bookmark_location = nautilus_bookmark_get_location (bookmark);
- if (g_strcmp0 (uri, bookmark_uri) == 0) {
+ if (g_file_equal (location, bookmark_location)) {
found = TRUE;
}
- g_free (bookmark_uri);
+ g_object_unref (bookmark_location);
if (found) {
return bookmark;