[recipes] Rename some store apis



commit 042242440b7204aed5f2437485655f509aa4c4ff
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Dec 14 18:51:06 2016 -0500

    Rename some store apis
    
    Add an explicit recipe to that part of the GrRecipeStore api,
    and update all callers.

 src/gr-app.c                   |    4 ++--
 src/gr-cuisine-page.c          |    2 +-
 src/gr-details-page.c          |    4 ++--
 src/gr-edit-page.c             |    4 ++--
 src/gr-list-page.c             |    8 ++++----
 src/gr-recipe-importer.c       |    6 +++---
 src/gr-recipe-store.c          |   30 +++++++++++++++---------------
 src/gr-recipe-store.h          |   18 +++++++++---------
 src/gr-recipes-page.c          |    6 +++---
 src/gr-shell-search-provider.c |    2 +-
 10 files changed, 42 insertions(+), 42 deletions(-)
---
diff --git a/src/gr-app.c b/src/gr-app.c
index 6d8ec5d..5a9a82e 100644
--- a/src/gr-app.c
+++ b/src/gr-app.c
@@ -134,7 +134,7 @@ timer_expired (GSimpleAction *action,
 
         win = gtk_application_get_active_window (GTK_APPLICATION (app));
         name = g_variant_get_string (parameter, NULL);
-        recipe = gr_recipe_store_get (GR_APP (app)->store, name);
+        recipe = gr_recipe_store_get_recipe (GR_APP (app)->store, name);
         if (recipe)
                 gr_window_show_recipe (GR_WINDOW (win), recipe);
         gtk_window_present (win);
@@ -166,7 +166,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 (app->store, id);
+        recipe = gr_recipe_store_get_recipe (app->store, id);
         gr_window_show_recipe (GR_WINDOW (win), recipe);
 }
 
diff --git a/src/gr-cuisine-page.c b/src/gr-cuisine-page.c
index 1a85091..529cc47 100644
--- a/src/gr-cuisine-page.c
+++ b/src/gr-cuisine-page.c
@@ -250,7 +250,7 @@ gr_cuisine_page_set_cuisine (GrCuisinePage *self,
                 GtkWidget *tile;
                 Category *c;
 
-                recipe = gr_recipe_store_get (store, keys[j]);
+                recipe = gr_recipe_store_get_recipe (store, keys[j]);
                 cuisine2 = gr_recipe_get_cuisine (recipe);
                 category = gr_recipe_get_category (recipe);
 
diff --git a/src/gr-details-page.c b/src/gr-details-page.c
index b4b009a..9b05c45 100644
--- a/src/gr-details-page.c
+++ b/src/gr-details-page.c
@@ -70,7 +70,7 @@ timer_complete (GrTimer *timer)
         g_application_send_notification (app, "timer", notification);
 
         store = gr_app_get_recipe_store (GR_APP (app));
-        recipe = gr_recipe_store_get (store, name);
+        recipe = gr_recipe_store_get_recipe (store, name);
         gr_recipe_store_add_cooked (store, recipe);
 }
 
@@ -228,7 +228,7 @@ delete_recipe (GrDetailsPage *page)
         GtkWidget *window;
 
         store = gr_app_get_recipe_store (GR_APP (g_application_get_default ()));
-        gr_recipe_store_remove (store, page->recipe);
+        gr_recipe_store_remove_recipe (store, page->recipe);
         g_set_object (&page->recipe, NULL);
         g_set_object (&page->chef, NULL);
 
diff --git a/src/gr-edit-page.c b/src/gr-edit-page.c
index 03ff583..4b3300e 100644
--- a/src/gr-edit-page.c
+++ b/src/gr-edit-page.c
@@ -717,7 +717,7 @@ gr_edit_page_save (GrEditPage *page)
                               "diets", diets,
                               "images", images,
                               NULL);
-                ret = gr_recipe_store_update (store, page->recipe, old_name, &error);
+                ret = gr_recipe_store_update_recipe (store, page->recipe, old_name, &error);
         }
         else {
                 g_autoptr(GrRecipe) recipe = NULL;
@@ -742,7 +742,7 @@ gr_edit_page_save (GrEditPage *page)
                                        "diets", diets,
                                        "images", images,
                                        NULL);
-                ret = gr_recipe_store_add (store, recipe, &error);
+                ret = gr_recipe_store_add_recipe (store, recipe, &error);
         }
 
         if (!ret)
diff --git a/src/gr-list-page.c b/src/gr-list-page.c
index 9f7c8bc..a9f7d1c 100644
--- a/src/gr-list-page.c
+++ b/src/gr-list-page.c
@@ -184,7 +184,7 @@ gr_list_page_populate_from_diet (GrListPage *self,
                 GtkWidget *tile;
                 GrDiets diets;
 
-                recipe = gr_recipe_store_get (store, keys[i]);
+                recipe = gr_recipe_store_get_recipe (store, keys[i]);
                 diets = gr_recipe_get_diets (recipe);
                 if ((diets & diet) == 0)
                         continue;
@@ -277,7 +277,7 @@ gr_list_page_populate_from_chef (GrListPage *self,
                 const char *author;
                 GtkWidget *tile;
 
-                recipe = gr_recipe_store_get (store, keys[i]);
+                recipe = gr_recipe_store_get_recipe (store, keys[i]);
                 author = gr_recipe_get_author (recipe);
 
                 if (g_strcmp0 (id, author) != 0)
@@ -328,7 +328,7 @@ gr_list_page_populate_from_season (GrListPage *self,
                 g_autoptr(GrRecipe) recipe = NULL;
                 GtkWidget *tile;
 
-                recipe = gr_recipe_store_get (store, keys[i]);
+                recipe = gr_recipe_store_get_recipe (store, keys[i]);
                 if (g_strcmp0 (self->season, gr_recipe_get_season (recipe)) != 0)
                         continue;
 
@@ -371,7 +371,7 @@ gr_list_page_populate_from_favorites (GrListPage *self)
                 g_autoptr(GrRecipe) recipe = NULL;
                 GtkWidget *tile;
 
-                recipe = gr_recipe_store_get (store, keys[i]);
+                recipe = gr_recipe_store_get_recipe (store, keys[i]);
                 if (!gr_recipe_store_is_favorite (store, recipe))
                         continue;
 
diff --git a/src/gr-recipe-importer.c b/src/gr-recipe-importer.c
index a14baa4..cd4b359 100644
--- a/src/gr-recipe-importer.c
+++ b/src/gr-recipe-importer.c
@@ -280,7 +280,7 @@ do_import_recipe (GrRecipeImporter *importer)
                       "mtime", importer->recipe_mtime,
                       NULL);
 
-        if (!gr_recipe_store_add (store, recipe, &error)) {
+        if (!gr_recipe_store_add_recipe (store, recipe, &error)) {
                 error_cb (importer->extractor, error, importer);
                 return;
         }
@@ -320,7 +320,7 @@ recipe_name_changed (GtkEntry         *entry,
         store = gr_app_get_recipe_store (GR_APP (g_application_get_default ()));
 
         name = gtk_entry_get_text (entry);
-        recipe = gr_recipe_store_get (store, name);
+        recipe = gr_recipe_store_get_recipe (store, name);
 
         dialog = gtk_widget_get_ancestor (GTK_WIDGET (entry), GTK_TYPE_DIALOG);
         g_object_set_data_full (G_OBJECT (dialog), "name", g_strdup (name), g_free);
@@ -450,7 +450,7 @@ import_recipe (GrRecipeImporter *importer)
                 return;
         }
 
-        recipe = gr_recipe_store_get (store, importer->recipe_name);
+        recipe = gr_recipe_store_get_recipe (store, importer->recipe_name);
         if (!recipe) {
                 g_message ("Recipe %s not yet known; importing", importer->recipe_name);
                 do_import_recipe (importer);
diff --git a/src/gr-recipe-store.c b/src/gr-recipe-store.c
index f4535e4..e824822 100644
--- a/src/gr-recipe-store.c
+++ b/src/gr-recipe-store.c
@@ -953,9 +953,9 @@ gr_recipe_store_new (void)
 }
 
 gboolean
-gr_recipe_store_add (GrRecipeStore  *self,
-                     GrRecipe       *recipe,
-                     GError        **error)
+gr_recipe_store_add_recipe (GrRecipeStore  *self,
+                            GrRecipe       *recipe,
+                            GError        **error)
 {
         const char *name;
 
@@ -985,10 +985,10 @@ gr_recipe_store_add (GrRecipeStore  *self,
 }
 
 gboolean
-gr_recipe_store_update (GrRecipeStore  *self,
-                        GrRecipe       *recipe,
-                        const char     *old_name,
-                        GError        **error)
+gr_recipe_store_update_recipe (GrRecipeStore  *self,
+                               GrRecipe       *recipe,
+                               const char     *old_name,
+                               GError        **error)
 {
         const char *name;
         GrRecipe *old;
@@ -1025,8 +1025,8 @@ gr_recipe_store_update (GrRecipeStore  *self,
 }
 
 gboolean
-gr_recipe_store_remove (GrRecipeStore *self,
-                        GrRecipe      *recipe)
+gr_recipe_store_remove_recipe (GrRecipeStore *self,
+                               GrRecipe      *recipe)
 {
         const char *name;
         gboolean ret = FALSE;
@@ -1047,8 +1047,8 @@ gr_recipe_store_remove (GrRecipeStore *self,
 }
 
 GrRecipe *
-gr_recipe_store_get (GrRecipeStore *self,
-                     const char    *name)
+gr_recipe_store_get_recipe (GrRecipeStore *self,
+                            const char    *name)
 {
         GrRecipe *recipe;
 
@@ -1068,8 +1068,8 @@ gr_recipe_store_get_recipe_keys (GrRecipeStore *self,
 }
 
 gboolean
-gr_recipe_store_is_todays (GrRecipeStore *self,
-                           GrRecipe      *recipe)
+gr_recipe_store_recipe_is_todays (GrRecipeStore *self,
+                                  GrRecipe      *recipe)
 {
         const char *name;
 
@@ -1082,8 +1082,8 @@ gr_recipe_store_is_todays (GrRecipeStore *self,
 }
 
 gboolean
-gr_recipe_store_is_pick (GrRecipeStore *self,
-                         GrRecipe      *recipe)
+gr_recipe_store_recipe_is_pick (GrRecipeStore *self,
+                                GrRecipe      *recipe)
 {
         const char *name;
 
diff --git a/src/gr-recipe-store.h b/src/gr-recipe-store.h
index cd1b90b..ccdc6c8 100644
--- a/src/gr-recipe-store.h
+++ b/src/gr-recipe-store.h
@@ -32,28 +32,28 @@ G_DECLARE_FINAL_TYPE (GrRecipeStore, gr_recipe_store, GR, RECIPE_STORE, GObject)
 
 GrRecipeStore  *gr_recipe_store_new                 (void);
 
-gboolean        gr_recipe_store_add                 (GrRecipeStore  *self,
+gboolean        gr_recipe_store_add_recipe          (GrRecipeStore  *self,
                                                      GrRecipe       *recipe,
                                                      GError        **error);
-gboolean        gr_recipe_store_update              (GrRecipeStore  *self,
+gboolean        gr_recipe_store_update_recipe       (GrRecipeStore  *self,
                                                      GrRecipe       *recipe,
-                                                     const char     *old_name,
+                                                     const char     *old_id,
                                                      GError        **error);
-gboolean        gr_recipe_store_remove              (GrRecipeStore  *self,
+gboolean        gr_recipe_store_remove_recipe       (GrRecipeStore  *self,
                                                      GrRecipe       *recipe);
-GrRecipe       *gr_recipe_store_get                 (GrRecipeStore  *self,
-                                                     const char     *name);
+GrRecipe       *gr_recipe_store_get_recipe          (GrRecipeStore  *self,
+                                                     const char     *id);
 char          **gr_recipe_store_get_recipe_keys     (GrRecipeStore  *self,
                                                      guint          *length);
-gboolean        gr_recipe_store_is_todays           (GrRecipeStore  *self,
+gboolean        gr_recipe_store_recipe_is_todays    (GrRecipeStore  *self,
                                                      GrRecipe       *recipe);
-gboolean        gr_recipe_store_is_pick             (GrRecipeStore  *self,
+gboolean        gr_recipe_store_recipe_is_pick      (GrRecipeStore  *self,
                                                      GrRecipe       *recipe);
 gboolean        gr_recipe_store_add_chef            (GrRecipeStore  *self,
                                                      GrChef         *chef,
                                                      GError        **error);
 GrChef         *gr_recipe_store_get_chef            (GrRecipeStore  *self,
-                                                     const char     *name);
+                                                     const char     *id);
 char          **gr_recipe_store_get_chef_keys       (GrRecipeStore  *self,
                                                      guint          *length);
 gboolean        gr_recipe_store_chef_is_featured    (GrRecipeStore  *self,
diff --git a/src/gr-recipes-page.c b/src/gr-recipes-page.c
index 22b5cfa..5c2d12e 100644
--- a/src/gr-recipes-page.c
+++ b/src/gr-recipes-page.c
@@ -241,9 +241,9 @@ populate_recipes_from_store (GrRecipesPage *self)
                 g_autoptr(GrRecipe) recipe = NULL;
                 GtkWidget *tile;
 
-                recipe = gr_recipe_store_get (store, keys[i]);
+                recipe = gr_recipe_store_get_recipe (store, keys[i]);
 
-                if (todays < 3 && gr_recipe_store_is_todays (store, recipe)) {
+                if (todays < 3 && gr_recipe_store_recipe_is_todays (store, recipe)) {
                         tile = gr_recipe_tile_new (recipe);
                         gtk_widget_show (tile);
                         if (todays == 0) {
@@ -255,7 +255,7 @@ populate_recipes_from_store (GrRecipesPage *self)
                                 todays += 1;
                         }
                 }
-                else if (picks < 3 && gr_recipe_store_is_pick (store, recipe)) {
+                else if (picks < 3 && gr_recipe_store_recipe_is_pick (store, recipe)) {
                         tile = gr_recipe_tile_new (recipe);
                         gtk_widget_show (tile);
                         gtk_grid_attach (GTK_GRID (self->pick_box), tile, picks, 0, 1, 1);
diff --git a/src/gr-shell-search-provider.c b/src/gr-shell-search-provider.c
index 14139c0..16c32a7 100644
--- a/src/gr-shell-search-provider.c
+++ b/src/gr-shell-search-provider.c
@@ -202,7 +202,7 @@ handle_get_result_metas (GrShellSearchProvider2 *skeleton,
                 if (g_hash_table_lookup (self->metas_cache, results[i]))
                         continue;
 
-                recipe = gr_recipe_store_get (self->store, results[i]);
+                recipe = gr_recipe_store_get_recipe (self->store, results[i]);
                 if (recipe == NULL) {
                         g_warning ("failed to find %s", results[i]);
                         continue;


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