[recipes] Stop translating cook and prep time in the recipe getters



commit 760d80e1adb643ffd6d3ac03b4332da397df42db
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Dec 31 16:59:23 2016 -0500

    Stop translating cook and prep time in the recipe getters
    
    This turned out to cause problems. Instead, translate the
    text in the details page setup code.

 src/gr-details-page.c |   11 +++++++++--
 src/gr-recipe.c       |    4 ++--
 2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/gr-details-page.c b/src/gr-details-page.c
index 8bd60e2..0b53ef6 100644
--- a/src/gr-details-page.c
+++ b/src/gr-details-page.c
@@ -804,8 +804,15 @@ gr_details_page_set_recipe (GrDetailsPage *page,
 
         populate_ingredients (page, serves, serves);
 
-        gtk_label_set_label (GTK_LABEL (page->prep_time_label), prep_time);
-        gtk_label_set_label (GTK_LABEL (page->cook_time_label), cook_time);
+        if (prep_time[0] == '\0')
+                gtk_label_set_label (GTK_LABEL (page->prep_time_label), "");
+        else
+                gtk_label_set_label (GTK_LABEL (page->prep_time_label), _(prep_time));
+
+        if (cook_time[0] == '\0')
+                gtk_label_set_label (GTK_LABEL (page->cook_time_label), "");
+        else
+                gtk_label_set_label (GTK_LABEL (page->cook_time_label), _(cook_time));
         gtk_label_set_label (GTK_LABEL (page->instructions_label), instructions);
 
         gtk_spin_button_set_value (GTK_SPIN_BUTTON (page->serves_spin), serves);
diff --git a/src/gr-recipe.c b/src/gr-recipe.c
index c1dcaef..73e57df 100644
--- a/src/gr-recipe.c
+++ b/src/gr-recipe.c
@@ -573,13 +573,13 @@ gr_recipe_get_category (GrRecipe *recipe)
 const char *
 gr_recipe_get_prep_time (GrRecipe *recipe)
 {
-        return _(recipe->prep_time);
+        return recipe->prep_time;
 }
 
 const char *
 gr_recipe_get_cook_time (GrRecipe *recipe)
 {
-        return _(recipe->cook_time);
+        return recipe->cook_time;
 }
 
 GrDiets


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