[epiphany] bookmarks: Add ephy_bookmarks_manager_new()



commit cd011c46341d0d9a10b1118a09781394e47e746e
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Mon Nov 21 12:07:20 2016 +0100

    bookmarks: Add ephy_bookmarks_manager_new()
    
    And use it instead of g_object_new().

 src/bookmarks/ephy-bookmarks-manager.c       |    6 ++++++
 src/bookmarks/ephy-bookmarks-manager.h       |    2 ++
 src/ephy-shell.c                             |    2 +-
 src/profile-migrator/ephy-profile-migrator.c |    3 +--
 src/search-provider/ephy-search-provider.c   |    2 +-
 5 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmarks-manager.c b/src/bookmarks/ephy-bookmarks-manager.c
index 2ee2965..84a07d8 100644
--- a/src/bookmarks/ephy-bookmarks-manager.c
+++ b/src/bookmarks/ephy-bookmarks-manager.c
@@ -239,6 +239,12 @@ bookmark_url_changed_cb (EphyBookmark         *bookmark,
   g_signal_emit (self, signals[BOOKMARK_URL_CHANGED], 0, bookmark);
 }
 
+EphyBookmarksManager *
+ephy_bookmarks_manager_new (void)
+{
+  return EPHY_BOOKMARKS_MANAGER (g_object_new (EPHY_TYPE_BOOKMARKS_MANAGER, NULL));
+}
+
 void
 ephy_bookmarks_manager_add_bookmark (EphyBookmarksManager *self,
                                      EphyBookmark         *bookmark)
diff --git a/src/bookmarks/ephy-bookmarks-manager.h b/src/bookmarks/ephy-bookmarks-manager.h
index b419235..f9e100c 100644
--- a/src/bookmarks/ephy-bookmarks-manager.h
+++ b/src/bookmarks/ephy-bookmarks-manager.h
@@ -30,6 +30,8 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (EphyBookmarksManager, ephy_bookmarks_manager, EPHY, BOOKMARKS_MANAGER, GObject)
 
+EphyBookmarksManager *ephy_bookmarks_manager_new                  (void);
+
 void         ephy_bookmarks_manager_add_bookmark                  (EphyBookmarksManager *self,
                                                                    EphyBookmark         *bookmark);
 void         ephy_bookmarks_manager_add_bookmarks                 (EphyBookmarksManager *self,
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 6b085d6..67bcf5b 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -770,7 +770,7 @@ ephy_shell_get_bookmarks_manager (EphyShell *shell)
   g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
 
   if (shell->bookmarks_manager == NULL)
-    shell->bookmarks_manager = EPHY_BOOKMARKS_MANAGER (g_object_new (EPHY_TYPE_BOOKMARKS_MANAGER, NULL));
+    shell->bookmarks_manager = ephy_bookmarks_manager_new ();
 
   return shell->bookmarks_manager;
 }
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index 36e8ccd..c4f387b 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -548,8 +548,7 @@ parse_rdf_item (EphyBookmarksManager *manager,
 static void
 migrate_bookmarks (void)
 {
-  EphyBookmarksManager *manager = EPHY_BOOKMARKS_MANAGER (g_object_new (EPHY_TYPE_BOOKMARKS_MANAGER, NULL));
-
+  EphyBookmarksManager *manager = ephy_bookmarks_manager_new ();
   char *filename;
   xmlDocPtr doc;
   xmlNodePtr child;
diff --git a/src/search-provider/ephy-search-provider.c b/src/search-provider/ephy-search-provider.c
index 627017e..0079773 100644
--- a/src/search-provider/ephy-search-provider.c
+++ b/src/search-provider/ephy-search-provider.c
@@ -370,7 +370,7 @@ ephy_search_provider_init (EphySearchProvider *self)
 
   filename = g_build_filename (ephy_dot_dir (), EPHY_HISTORY_FILE, NULL);
   self->history_service = ephy_history_service_new (filename, TRUE);
-  self->bookmarks_manager = EPHY_BOOKMARKS_MANAGER (g_object_new (EPHY_TYPE_BOOKMARKS_MANAGER, NULL));
+  self->bookmarks_manager = ephy_bookmarks_manager_new ();
   self->model = ephy_completion_model_new (self->history_service, self->bookmarks_manager);
   g_free (filename);
 


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