[recipes] Use the default-image field for recipe tiles



commit 70e567d641c6a434109b13605b996a71ab54ad81
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jan 28 10:03:52 2017 +0100

    Use the default-image field for recipe tiles

 src/gr-recipe-tile.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-recipe-tile.c b/src/gr-recipe-tile.c
index 55836bf..a4b4aa4 100644
--- a/src/gr-recipe-tile.c
+++ b/src/gr-recipe-tile.c
@@ -72,8 +72,15 @@ add_recipe_css (GrRecipe *recipe,
         g_object_get (recipe, "images", &images, NULL);
 
         if (images->len > 0) {
-                GrRotatedImage *ri = &g_array_index (images, GrRotatedImage, 0);
+                GrRotatedImage *ri;
                 g_autofree char *path = NULL;
+                int index;
+
+                index = gr_recipe_get_default_image (recipe);
+                if (index < 0 || index >= images->len)
+                        index = 0;
+
+                ri = &g_array_index (images, GrRotatedImage, index);
 
                 path = ensure_rotated_image (ri->path, ri->angle);
                 g_string_append_printf (css, "image.recipe.small.%s,\nbox.recipe.%s {\n", id, id);


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