[epiphany/wip/bookmarks: 10/76] bookmarks: Store tags in EphyBookmark



commit 43f9c79048a004636db447d0ef3580b5df505805
Author: Iulian Radu <iulian radu67 gmail com>
Date:   Fri Jul 22 12:07:24 2016 +0300

    bookmarks: Store tags in EphyBookmark

 src/ephy-bookmark.c          |   14 +++++++++++++-
 src/ephy-bookmark.h          |    2 ++
 src/ephy-bookmarks-popover.c |    4 ++++
 3 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/src/ephy-bookmark.c b/src/ephy-bookmark.c
index 43b9028..18f1caf 100644
--- a/src/ephy-bookmark.c
+++ b/src/ephy-bookmark.c
@@ -24,6 +24,7 @@ struct _EphyBookmark {
 
   char        *url;
   char        *title;
+  GList       *tags;
 };
 
 G_DEFINE_TYPE (EphyBookmark, ephy_bookmark, G_TYPE_OBJECT)
@@ -85,6 +86,9 @@ ephy_bookmark_finalize (GObject *object)
   g_clear_pointer (&self->url, g_free);
   g_clear_pointer (&self->title, g_free);
 
+  g_list_free_full (self->tags, g_object_unref);
+  self->tags = NULL;
+
   G_OBJECT_CLASS (ephy_bookmark_parent_class)->finalize (object);
 }
 
@@ -134,4 +138,12 @@ ephy_bookmark_get_url (EphyBookmark *self)
   g_return_val_if_fail (EPHY_IS_BOOKMARK (self), NULL);
 
   return self->url;
-}
\ No newline at end of file
+}
+
+void
+ephy_bookmark_set_tags (EphyBookmark *self, GList *tags)
+{
+  g_return_if_fail (EPHY_IS_BOOKMARK (self));
+
+  self->tags = tags;
+}
diff --git a/src/ephy-bookmark.h b/src/ephy-bookmark.h
index f72a994..a45cc00 100644
--- a/src/ephy-bookmark.h
+++ b/src/ephy-bookmark.h
@@ -30,6 +30,8 @@ EphyBookmark        *ephy_bookmark_new          (char *url,
                                                  char *title);
 
 const char          *ephy_bookmark_get_url      (EphyBookmark *self);
+void                 ephy_bookmark_set_tags     (EphyBookmark *self,
+                                                 GList        *tags);
 
 G_END_DECLS
 
diff --git a/src/ephy-bookmarks-popover.c b/src/ephy-bookmarks-popover.c
index c5f3d91..86e53ac 100644
--- a/src/ephy-bookmarks-popover.c
+++ b/src/ephy-bookmarks-popover.c
@@ -138,12 +138,16 @@ ephy_bookmarks_popover_init (EphyBookmarksPopover *self)
 {
   EphyBookmarksManager *manager = ephy_shell_get_bookmarks_manager (ephy_shell_get_default ());
   GList *bookmarks;
+  GList *tags = NULL;
   GList *l;
   EphyBookmark *dummy_bookmark;
 
   gtk_widget_init_template (GTK_WIDGET (self));
 
   dummy_bookmark = ephy_bookmark_new (g_strdup ("https://duckduckgo.com";), g_strdup ("Test title"));
+  tags = g_list_append (tags, g_strdup ("Fun"));
+  tags = g_list_append (tags, g_strdup ("Work"));
+  ephy_bookmark_set_tags (dummy_bookmark, tags);
   ephy_bookmarks_manager_add_bookmark (manager, dummy_bookmark);
 
   dummy_bookmark = ephy_bookmark_new (g_strdup ("https://wikipedia.com";), g_strdup ("wikipedia"));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]