[nautilus] bookmark: simplify code
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] bookmark: simplify code
- Date: Fri, 19 Oct 2012 19:23:30 +0000 (UTC)
commit 0cd6b88fff28b47a13000e4d0f421fba8543a71c
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Oct 19 15:22:54 2012 -0400
bookmark: simplify code
No need for nautilus_bookmark_copy(), when we can just g_object_ref()
the object.
libnautilus-private/nautilus-bookmark.c | 20 --------------------
libnautilus-private/nautilus-bookmark.h | 6 ++----
src/nautilus-bookmark-list.c | 10 ++--------
3 files changed, 4 insertions(+), 32 deletions(-)
---
diff --git a/libnautilus-private/nautilus-bookmark.c b/libnautilus-private/nautilus-bookmark.c
index 509a8ad..de4ac90 100644
--- a/libnautilus-private/nautilus-bookmark.c
+++ b/libnautilus-private/nautilus-bookmark.c
@@ -666,26 +666,6 @@ nautilus_bookmark_compare_uris (gconstpointer a, gconstpointer b)
bookmark_b->details->location);
}
-NautilusBookmark *
-nautilus_bookmark_copy (NautilusBookmark *bookmark)
-{
- NautilusBookmark *retval;
-
- g_return_val_if_fail (NAUTILUS_IS_BOOKMARK (bookmark), NULL);
-
- retval = nautilus_bookmark_new (bookmark->details->location,
- bookmark->details->has_custom_name ?
- bookmark->details->name : NULL);
- if (bookmark->details->icon) {
- g_object_set (retval, "icon", bookmark->details->icon, NULL);
- }
- if (bookmark->details->symbolic_icon) {
- g_object_set (retval, "symbolic-icon", bookmark->details->symbolic_icon, NULL);
- }
-
- return retval;
-}
-
GIcon *
nautilus_bookmark_get_symbolic_icon (NautilusBookmark *bookmark)
{
diff --git a/libnautilus-private/nautilus-bookmark.h b/libnautilus-private/nautilus-bookmark.h
index cad9198..68e10b0 100644
--- a/libnautilus-private/nautilus-bookmark.h
+++ b/libnautilus-private/nautilus-bookmark.h
@@ -66,17 +66,15 @@ typedef struct NautilusBookmarkClass NautilusBookmarkClass;
GType nautilus_bookmark_get_type (void);
NautilusBookmark * nautilus_bookmark_new (GFile *location,
const char *custom_name);
-NautilusBookmark * nautilus_bookmark_copy (NautilusBookmark *bookmark);
const char * nautilus_bookmark_get_name (NautilusBookmark *bookmark);
GFile * nautilus_bookmark_get_location (NautilusBookmark *bookmark);
char * nautilus_bookmark_get_uri (NautilusBookmark *bookmark);
GIcon * nautilus_bookmark_get_icon (NautilusBookmark *bookmark);
GIcon * nautilus_bookmark_get_symbolic_icon (NautilusBookmark *bookmark);
gboolean nautilus_bookmark_get_exists (NautilusBookmark *bookmark);
-gboolean nautilus_bookmark_get_has_custom_name (NautilusBookmark *bookmark);
+gboolean nautilus_bookmark_get_has_custom_name (NautilusBookmark *bookmark);
void nautilus_bookmark_set_custom_name (NautilusBookmark *bookmark,
- const char *new_name);
-gboolean nautilus_bookmark_uri_known_not_to_exist (NautilusBookmark *bookmark);
+ const char *new_name);
int nautilus_bookmark_compare_with (gconstpointer a,
gconstpointer b);
int nautilus_bookmark_compare_uris (gconstpointer a,
diff --git a/src/nautilus-bookmark-list.c b/src/nautilus-bookmark-list.c
index 9eec5e8..1ff7b8f 100644
--- a/src/nautilus-bookmark-list.c
+++ b/src/nautilus-bookmark-list.c
@@ -251,10 +251,7 @@ nautilus_bookmark_list_append (NautilusBookmarkList *bookmarks,
g_return_if_fail (NAUTILUS_IS_BOOKMARK_LIST (bookmarks));
g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark));
- insert_bookmark_internal (bookmarks,
- nautilus_bookmark_copy (bookmark),
- -1);
-
+ insert_bookmark_internal (bookmarks, g_object_ref (bookmark), -1);
nautilus_bookmark_list_save_file (bookmarks);
}
@@ -391,10 +388,7 @@ nautilus_bookmark_list_insert_item (NautilusBookmarkList *bookmarks,
g_return_if_fail (NAUTILUS_IS_BOOKMARK_LIST (bookmarks));
g_return_if_fail (index <= g_list_length (bookmarks->list));
- insert_bookmark_internal (bookmarks,
- nautilus_bookmark_copy (new_bookmark),
- index);
-
+ insert_bookmark_internal (bookmarks, g_object_ref (new_bookmark), index);
nautilus_bookmark_list_save_file (bookmarks);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]