[epiphany/wip/bookmarks: 296/315] bookmarks: Change url/title for ephy_bookmarks_new to transfer none
- From: Iulian Radu <iulianradu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/bookmarks: 296/315] bookmarks: Change url/title for ephy_bookmarks_new to transfer none
- Date: Tue, 27 Sep 2016 17:39:06 +0000 (UTC)
commit 41fd0ab2c99475e2ffd26a33fe5b11acdabf1ede
Author: Iulian Radu <iulian radu67 gmail com>
Date: Fri Sep 23 19:23:59 2016 +0300
bookmarks: Change url/title for ephy_bookmarks_new to transfer none
src/ephy-add-bookmark-popover.c | 4 ++--
src/ephy-bookmark.c | 7 ++++---
src/ephy-bookmark.h | 6 +++---
src/ephy-bookmarks-manager.c | 2 +-
src/profile-migrator/ephy-profile-migrator.c | 2 +-
5 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/src/ephy-add-bookmark-popover.c b/src/ephy-add-bookmark-popover.c
index ec1f1d8..27a8d85 100644
--- a/src/ephy-add-bookmark-popover.c
+++ b/src/ephy-add-bookmark-popover.c
@@ -173,8 +173,8 @@ ephy_add_bookmark_popover_show (EphyAddBookmarkPopover *self)
bookmark = ephy_bookmarks_manager_get_bookmark_by_url (manager, address);
if (!bookmark) {
- bookmark = ephy_bookmark_new (g_strdup (address),
- g_strdup (ephy_embed_get_title (embed)),
+ bookmark = ephy_bookmark_new (address,
+ ephy_embed_get_title (embed),
g_sequence_new (g_free));
ephy_bookmarks_manager_add_bookmark (manager, bookmark);
diff --git a/src/ephy-bookmark.c b/src/ephy-bookmark.c
index 4e6faba..09a6ded 100644
--- a/src/ephy-bookmark.c
+++ b/src/ephy-bookmark.c
@@ -178,11 +178,11 @@ ephy_bookmark_init (EphyBookmark *self)
}
EphyBookmark *
-ephy_bookmark_new (char *url, char *title, GSequence *tags)
+ephy_bookmark_new (const char *url, const char *title, GSequence *tags)
{
return g_object_new (EPHY_TYPE_BOOKMARK,
- "url", url,
- "title", title,
+ "url", g_strdup (url),
+ "title", g_strdup (title),
"tags", tags,
"time-added", g_get_real_time (),
NULL);
@@ -212,6 +212,7 @@ ephy_bookmark_set_url (EphyBookmark *self, const char *url)
{
g_return_if_fail (EPHY_IS_BOOKMARK (self));
+ g_free (self->url);
self->url = g_strdup (url);
}
diff --git a/src/ephy-bookmark.h b/src/ephy-bookmark.h
index 4c06607..8a44c03 100644
--- a/src/ephy-bookmark.h
+++ b/src/ephy-bookmark.h
@@ -26,9 +26,9 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (EphyBookmark, ephy_bookmark, EPHY, BOOKMARK, GObject)
-EphyBookmark *ephy_bookmark_new (char *url,
- char *title,
- GSequence *tags);
+EphyBookmark *ephy_bookmark_new (const char *url,
+ const char *title,
+ GSequence *tags);
void ephy_bookmark_set_time_added (EphyBookmark *self,
gint64 time_added);
diff --git a/src/ephy-bookmarks-manager.c b/src/ephy-bookmarks-manager.c
index 4731cfb..fbb617f 100644
--- a/src/ephy-bookmarks-manager.c
+++ b/src/ephy-bookmarks-manager.c
@@ -564,7 +564,7 @@ ephy_bookmarks_manager_load_from_file (EphyBookmarksManager *self)
g_variant_iter_free (iter);
/* Create the new bookmark. */
- bookmark = ephy_bookmark_new (g_strdup (list[i]), title, tags);
+ bookmark = ephy_bookmark_new (list[i], title, tags);
ephy_bookmark_set_time_added (bookmark, time_added);
g_sequence_prepend (bookmarks, bookmark);
}
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index 619025e..2562aae 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -808,7 +808,7 @@ parse_rdf_item (EphyBookmarksManager *manager,
EphyBookmark *bookmark;
g_sequence_sort (tags, (GCompareDataFunc)ephy_bookmark_tags_compare, NULL);
- bookmark = ephy_bookmark_new ((char *)link, (char *)title, tags);
+ bookmark = ephy_bookmark_new ((const char *)link, (const char *)title, tags);
ephy_bookmarks_manager_add_bookmark (manager, bookmark);
} else {
g_sequence_free (tags);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]