[recipes] Simplify shell search provider setup



commit 5ee5fdd133e0aebe694d586ea75128f20740ea07
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Mar 14 22:01:22 2017 -0400

    Simplify shell search provider setup
    
    No need to pass in the recipe store anymore,
    we have a singleton now.

 src/gr-app.c                   |    9 ++++-----
 src/gr-shell-search-provider.c |    8 +-------
 src/gr-shell-search-provider.h |    5 ++---
 3 files changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/src/gr-app.c b/src/gr-app.c
index a411113..1b8c162 100644
--- a/src/gr-app.c
+++ b/src/gr-app.c
@@ -406,15 +406,14 @@ gr_app_open (GApplication  *app,
 }
 
 static gboolean
-gr_app_dbus_register (GApplication    *application,
-                      GDBusConnection *connection,
-                      const gchar     *object_path,
-                      GError         **error)
+gr_app_dbus_register (GApplication     *application,
+                      GDBusConnection  *connection,
+                      const gchar      *object_path,
+                      GError          **error)
 {
         GrApp *app = GR_APP (application);
 
         app->search_provider = gr_shell_search_provider_new ();
-        gr_shell_search_provider_setup (app->search_provider, gr_recipe_store_get ());
 
         return gr_shell_search_provider_register (app->search_provider, connection, error);
 }
diff --git a/src/gr-shell-search-provider.c b/src/gr-shell-search-provider.c
index 5110b70..f3d01e3 100644
--- a/src/gr-shell-search-provider.c
+++ b/src/gr-shell-search-provider.c
@@ -311,6 +311,7 @@ search_provider_dispose (GObject *obj)
 static void
 gr_shell_search_provider_init (GrShellSearchProvider *self)
 {
+        self->store = g_object_ref (gr_recipe_store_get ());
         self->metas_cache = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                    g_free, (GDestroyNotify) g_variant_unref);
 
@@ -341,10 +342,3 @@ gr_shell_search_provider_new (void)
 {
         return g_object_new (gr_shell_search_provider_get_type (), NULL);
 }
-
-void
-gr_shell_search_provider_setup (GrShellSearchProvider *provider,
-                                GrRecipeStore         *store)
-{
-        provider->store = g_object_ref (store);
-}
diff --git a/src/gr-shell-search-provider.h b/src/gr-shell-search-provider.h
index 26a6688..5061d62 100644
--- a/src/gr-shell-search-provider.h
+++ b/src/gr-shell-search-provider.h
@@ -30,12 +30,11 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (GrShellSearchProvider, gr_shell_search_provider, GR, SHELL_SEARCH_PROVIDER, GObject)
 
+GrShellSearchProvider   *gr_shell_search_provider_new           (void);
+
 gboolean                 gr_shell_search_provider_register      (GrShellSearchProvider  *self,
                                                                  GDBusConnection        *connection,
                                                                  GError                **error);
 void                     gr_shell_search_provider_unregister    (GrShellSearchProvider  *self);
-GrShellSearchProvider   *gr_shell_search_provider_new           (void);
-void                     gr_shell_search_provider_setup         (GrShellSearchProvider  *self,
-                                                                 GrRecipeStore          *store);
 
 G_END_DECLS


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