[recipes] Add more content warning getters



commit e158a4664e85fe590299c48628783d8cd7c7ddc7
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jan 1 09:41:30 2017 -0500

    Add more content warning getters
    
    For now, these just look at the diet flags, but we could maybe
    determine this from the ingredients list, eventually.

 src/gr-recipe.c |   12 ++++++++++++
 src/gr-recipe.h |    2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/gr-recipe.c b/src/gr-recipe.c
index e5279ee..8dd2aeb 100644
--- a/src/gr-recipe.c
+++ b/src/gr-recipe.c
@@ -612,6 +612,18 @@ gr_recipe_contains_garlic (GrRecipe *recipe)
         return recipe->garlic;
 }
 
+gboolean
+gr_recipe_contains_dairy (GrRecipe *recipe)
+{
+        return (recipe->diets & GR_DIET_MILK_FREE) == 0;
+}
+
+gboolean
+gr_recipe_contains_gluten (GrRecipe *recipe)
+{
+        return (recipe->diets & GR_DIET_GLUTEN_FREE) == 0;
+}
+
 int
 gr_recipe_get_spiciness (GrRecipe *recipe)
 {
diff --git a/src/gr-recipe.h b/src/gr-recipe.h
index 56509b2..b07d3d9 100644
--- a/src/gr-recipe.h
+++ b/src/gr-recipe.h
@@ -47,6 +47,8 @@ const char     *gr_recipe_get_ingredients  (GrRecipe   *recipe);
 const char     *gr_recipe_get_instructions (GrRecipe   *recipe);
 const char     *gr_recipe_get_notes        (GrRecipe   *recipe);
 gboolean        gr_recipe_contains_garlic  (GrRecipe   *recipe);
+gboolean        gr_recipe_contains_dairy   (GrRecipe   *recipe);
+gboolean        gr_recipe_contains_gluten  (GrRecipe   *recipe);
 int             gr_recipe_get_spiciness    (GrRecipe   *recipe);
 GDateTime      *gr_recipe_get_ctime        (GrRecipe   *recipe);
 GDateTime      *gr_recipe_get_mtime        (GrRecipe   *recipe);


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