[recipes] Add predefined ingredients to the list of all



commit 286065f20507131ffb4cb99d87ae921886d0738c
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed May 3 23:17:09 2017 -0400

    Add predefined ingredients to the list of all
    
    The recipe store has a function to return 'all'
    ingredients. Make it actually return all.

 src/gr-recipe-store.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-recipe-store.c b/src/gr-recipe-store.c
index ec5682a..cc35d70 100644
--- a/src/gr-recipe-store.c
+++ b/src/gr-recipe-store.c
@@ -31,6 +31,7 @@
 #include "gr-settings.h"
 #include "gr-utils.h"
 #include "gr-ingredients-list.h"
+#include "gr-ingredient.h"
 #include "gr-image.h"
 #include "gr-app.h"
 
@@ -1597,8 +1598,14 @@ gr_recipe_store_get_all_ingredients (GrRecipeStore *self,
         GHashTable *ingreds;
         char **result;
         int i, j;
+        const char **names;
+        int len;
 
-        ingreds = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+        ingreds = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
+        names = gr_ingredient_get_names (&len);
+        for (i = 0; i < len; i++) {
+                g_hash_table_add (ingreds, (char *)names[i]);
+        }
 
         g_hash_table_iter_init (&iter, self->recipes);
         while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&recipe)) {


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