[recipes] Add spiciness warning to details page



commit cf6990b981e461694511fa8bd0b021cb2be8d3aa
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Dec 14 14:26:32 2016 -0500

    Add spiciness warning to details page
    
    Show a back or red pepper to indicated high levels of spiciness.

 src/gr-details-page.c |   10 ++++++++++
 src/recipes.css       |    3 +++
 2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/gr-details-page.c b/src/gr-details-page.c
index 5e7bb2c..2003da0 100644
--- a/src/gr-details-page.c
+++ b/src/gr-details-page.c
@@ -646,6 +646,16 @@ populate_ingredients (GrDetailsPage *page,
         if (gr_recipe_get_spiciness (page->recipe) > 50) {
                 gtk_widget_show (page->warning_box);
                 gtk_widget_show (page->spicy_warning);
+                if (gr_recipe_get_spiciness (page->recipe) > 75) {
+                        gtk_widget_set_tooltip_text (page->spicy_warning, _("Very spicy"));
+                        gtk_style_context_add_class (gtk_widget_get_style_context (page->spicy_warning),
+                                                     "very-spicy");
+                }
+                else {
+                        gtk_widget_set_tooltip_text (page->spicy_warning, _("Spicy"));
+                        gtk_style_context_remove_class (gtk_widget_get_style_context (page->spicy_warning),
+                                                        "very-spicy");
+                }
         }
 }
 
diff --git a/src/recipes.css b/src/recipes.css
index 8e8c83b..16e420f 100644
--- a/src/recipes.css
+++ b/src/recipes.css
@@ -164,3 +164,6 @@ image.chef.circular {
   color: shade(@ingredient_tag_bg, 2.10);
 }
 
+image.very-spicy {
+        color: red;
+}


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