[recipes] Remove no-longer-needed code



commit 185968af3ee52e0469e4670ea330616a55e3fa50
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Feb 26 20:47:07 2017 -0500

    Remove no-longer-needed code
    
    Now that we're no longer using CSS for the background in
    recipe tiles, we don't need to call the function that creates
    this CSS.

 src/gr-edit-page.c       |    1 -
 src/gr-recipe-importer.c |    1 -
 src/gr-recipe-tile.c     |   72 ----------------------------------------------
 src/gr-recipe-tile.h     |    2 -
 src/gr-recipes-page.c    |    3 --
 5 files changed, 0 insertions(+), 79 deletions(-)
---
diff --git a/src/gr-edit-page.c b/src/gr-edit-page.c
index 566f065..8cf87f2 100644
--- a/src/gr-edit-page.c
+++ b/src/gr-edit-page.c
@@ -2139,7 +2139,6 @@ gr_edit_page_save (GrEditPage *page)
 
         if (ret) {
                 gr_image_viewer_persist_changes (GR_IMAGE_VIEWER (page->images));
-                gr_recipe_tile_recreate_css ();
 
                 return TRUE;
         }
diff --git a/src/gr-recipe-importer.c b/src/gr-recipe-importer.c
index 2e4176e..a655c7e 100644
--- a/src/gr-recipe-importer.c
+++ b/src/gr-recipe-importer.c
@@ -440,7 +440,6 @@ next:
 
         if (id == NULL) {
                 // We're done!
-                gr_recipe_tile_recreate_css ();
                 gr_chef_tile_recreate_css ();
 
                 g_signal_emit (importer, done_signal, 0, importer->recipes);
diff --git a/src/gr-recipe-tile.c b/src/gr-recipe-tile.c
index f8863ca..da7b255 100644
--- a/src/gr-recipe-tile.c
+++ b/src/gr-recipe-tile.c
@@ -56,68 +56,6 @@ show_details (GrRecipeTile *tile)
 }
 
 static void
-add_recipe_css (GrRecipe *recipe,
-                GString  *css)
-{
-        const char *id;
-        g_autoptr(GArray) images = NULL;
-
-        id = gr_recipe_get_id (recipe);
-
-        g_object_get (recipe, "images", &images, NULL);
-
-        if (images->len > 0) {
-                GrImage *ri;
-                int index;
-
-                index = gr_recipe_get_default_image (recipe);
-                if (index < 0 || index >= images->len)
-                        index = 0;
-
-                ri = &g_array_index (images, GrImage, index);
-
-                g_string_append_printf (css, "image.recipe.small.%s,\nbox.recipe.%s {\n", id, id);
-                g_string_append_printf (css, "  background: url('%s');\n"
-                                             "  background-size: cover;\n"
-                                             "  background-position: center;\n", ri->path);
-                g_string_append (css, "}\n\n");
-        }
-}
-
-static GtkCssProvider *provider = NULL;
-
-void
-gr_recipe_tile_recreate_css (void)
-{
-        GrRecipeStore *store;
-        g_autofree char **keys = NULL;
-        guint length;
-        g_autoptr(GString) css = NULL;
-        int i;
-
-return;
-        store = gr_app_get_recipe_store (GR_APP (g_application_get_default ()));
-        keys = gr_recipe_store_get_recipe_keys (store, &length);
-
-        css = g_string_new ("");
-
-        for (i = 0; i < length; i++) {
-                g_autoptr (GrRecipe) recipe = NULL;
-                recipe = gr_recipe_store_get_recipe (store, keys[i]);
-                add_recipe_css (recipe, css);
-        }
-
-        if (provider == NULL) {
-                provider = gtk_css_provider_new ();
-                gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
-                                                           GTK_STYLE_PROVIDER (provider),
-                                                           GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-        }
-
-        gtk_css_provider_load_from_data (provider, css->str, css->len, NULL);
-}
-
-static void
 recipe_tile_set_recipe (GrRecipeTile *tile,
                         GrRecipe     *recipe)
 {
@@ -125,25 +63,15 @@ recipe_tile_set_recipe (GrRecipeTile *tile,
 
         store = gr_app_get_recipe_store (GR_APP (g_application_get_default ()));
 
-        if (tile->recipe) {
-                const char *elem;
-                elem = gr_recipe_get_id (tile->recipe);
-                gtk_style_context_remove_class (gtk_widget_get_style_context (tile->box), elem);
-        }
-
         g_set_object (&tile->recipe, recipe);
 
         if (tile->recipe) {
-                const char *elem;
                 const char *name;
                 const char *author;
                 g_autoptr(GrChef) chef = NULL;
                 g_autofree char *tmp = NULL;
                 g_autoptr(GArray) images = NULL;
 
-                elem = gr_recipe_get_id (tile->recipe);
-                gtk_style_context_add_class (gtk_widget_get_style_context (tile->box), elem);
-
                 name = gr_recipe_get_translated_name (recipe);
                 author = gr_recipe_get_author (recipe);
                 chef = gr_recipe_store_get_chef (store, author);
diff --git a/src/gr-recipe-tile.h b/src/gr-recipe-tile.h
index 3a87b75..1278639 100644
--- a/src/gr-recipe-tile.h
+++ b/src/gr-recipe-tile.h
@@ -34,6 +34,4 @@ GtkWidget      *gr_recipe_tile_new        (GrRecipe     *recipe);
 GtkWidget      *gr_recipe_tile_new_wide   (GrRecipe     *recipe);
 GrRecipe       *gr_recipe_tile_get_recipe (GrRecipeTile *tile);
 
-void            gr_recipe_tile_recreate_css (void);
-
 G_END_DECLS
diff --git a/src/gr-recipes-page.c b/src/gr-recipes-page.c
index 0559160..b976af0 100644
--- a/src/gr-recipes-page.c
+++ b/src/gr-recipes-page.c
@@ -144,7 +144,6 @@ gr_recipes_page_init (GrRecipesPage *page)
         populate_shopping_from_store (page);
         populate_categories_from_store (page);
         populate_chefs_from_store (page);
-        gr_recipe_tile_recreate_css ();
         gr_chef_tile_recreate_css ();
         connect_store_signals (page);
 
@@ -420,8 +419,6 @@ populate_chefs_from_store (GrRecipesPage *self)
         int i;
         int count;
 
-        gr_chef_tile_recreate_css ();
-
         container_remove_all (GTK_CONTAINER (self->chefs_box));
 
         store = gr_app_get_recipe_store (GR_APP (g_application_get_default ()));


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