[recipes] Convert GrApp to use the store singleton



commit 8b135a3e01cc884b3880370a36f062f3cf644a01
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Mar 11 15:50:14 2017 -0500

    Convert GrApp to use the store singleton
    
    And drop the gr_app_get_recipe_store API, as nobody is
    using it anymore.

 src/gr-app.c |   18 +++---------------
 src/gr-app.h |    3 +--
 2 files changed, 4 insertions(+), 17 deletions(-)
---
diff --git a/src/gr-app.c b/src/gr-app.c
index 587dd5f..90aedbc 100644
--- a/src/gr-app.c
+++ b/src/gr-app.c
@@ -29,7 +29,6 @@
 #include "gr-app.h"
 #include "gr-window.h"
 #include "gr-chef-dialog.h"
-#include "gr-recipe-store.h"
 #include "gr-cuisine.h"
 #include "gr-shell-search-provider.h"
 #include "gr-utils.h"
@@ -40,7 +39,6 @@ struct _GrApp
 {
         GtkApplication parent_instance;
 
-        GrRecipeStore *store;
         GrShellSearchProvider *search_provider;
         GrRecipeExporter *exporter;
 
@@ -55,7 +53,6 @@ gr_app_finalize (GObject *object)
 {
         GrApp *self = GR_APP (object);
 
-        g_clear_object (&self->store);
         g_clear_object (&self->search_provider);
         g_clear_object (&self->css_provider);
 
@@ -88,7 +85,7 @@ timer_expired (GSimpleAction *action,
 
         gr_app_activate (G_APPLICATION (app));
         win = gtk_application_get_active_window (GTK_APPLICATION (app));
-        recipe = gr_recipe_store_get_recipe (app->store, id);
+        recipe = gr_recipe_store_get_recipe (gr_recipe_store_get (), id);
         gr_window_timer_expired (GR_WINDOW (win), recipe, step);
 }
 
@@ -182,7 +179,7 @@ details_activated (GSimpleAction *action,
 
         gr_app_activate (G_APPLICATION (app));
         win = gtk_application_get_active_window (GTK_APPLICATION (app));
-        recipe = gr_recipe_store_get_recipe (app->store, id);
+        recipe = gr_recipe_store_get_recipe (gr_recipe_store_get (), id);
         gr_window_show_recipe (GR_WINDOW (win), recipe);
 }
 
@@ -413,7 +410,7 @@ gr_app_dbus_register (GApplication    *application,
         GrApp *app = GR_APP (application);
 
         app->search_provider = gr_shell_search_provider_new ();
-        gr_shell_search_provider_setup (app->search_provider, app->store);
+        gr_shell_search_provider_setup (app->search_provider, gr_recipe_store_get ());
 
         return gr_shell_search_provider_register (app->search_provider, connection, error);
 }
@@ -444,9 +441,6 @@ gr_app_init (GrApp *self)
                                        _("Turn on verbose logging"), NULL);
 
         g_log_set_writer_func (log_writer, NULL, NULL);
-
-        self->store = gr_recipe_store_new ();
-
 }
 
 static int
@@ -500,9 +494,3 @@ gr_app_new (void)
                              "flags", G_APPLICATION_HANDLES_OPEN | G_APPLICATION_CAN_OVERRIDE_APP_ID,
                              NULL);
 }
-
-GrRecipeStore *
-gr_app_get_recipe_store (GrApp *app)
-{
-        return app->store;
-}
diff --git a/src/gr-app.h b/src/gr-app.h
index 6db6956..b0c1134 100644
--- a/src/gr-app.h
+++ b/src/gr-app.h
@@ -15,7 +15,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-   
+
 #pragma once
 
 #include <gtk/gtk.h>
@@ -28,6 +28,5 @@ G_BEGIN_DECLS
 G_DECLARE_FINAL_TYPE (GrApp, gr_app, GR, APP, GtkApplication)
 
 GrApp         *gr_app_new              (void);
-GrRecipeStore *gr_app_get_recipe_store (GrApp *app);
 
 G_END_DECLS


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