[recipes] Translate notes in the ui



commit f6c5270b60de503afb78b1d0f8f6073064b694c9
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Feb 19 20:53:02 2017 -0500

    Translate notes in the ui

 src/gr-details-page.c |    2 +-
 src/gr-recipe.c       |   10 ++++++++++
 src/gr-recipe.h       |    1 +
 3 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-details-page.c b/src/gr-details-page.c
index ebccf35..de35cc8 100644
--- a/src/gr-details-page.c
+++ b/src/gr-details-page.c
@@ -612,7 +612,7 @@ gr_details_page_set_recipe (GrDetailsPage *page,
         prep_time = gr_recipe_get_prep_time (recipe);
         cook_time = gr_recipe_get_cook_time (recipe);
         ingredients = gr_recipe_get_ingredients (recipe);
-        notes = gr_recipe_get_notes (recipe);
+        notes = gr_recipe_get_translated_notes (recipe);
         instructions = gr_recipe_get_translated_instructions (recipe);
         description = gr_recipe_get_translated_description (recipe);
         if (same_recipe)
diff --git a/src/gr-recipe.c b/src/gr-recipe.c
index 8725ccf..8d27b22 100644
--- a/src/gr-recipe.c
+++ b/src/gr-recipe.c
@@ -67,6 +67,7 @@ struct _GrRecipe
         char *translated_name;
         char *translated_description;
         char *translated_instructions;
+        char *translated_notes;
 };
 
 G_DEFINE_TYPE (GrRecipe, gr_recipe, G_TYPE_OBJECT)
@@ -125,6 +126,7 @@ gr_recipe_finalize (GObject *object)
         g_free (self->translated_name);
         g_free (self->translated_description);
         g_free (self->translated_instructions);
+        g_free (self->translated_notes);
 
         G_OBJECT_CLASS (gr_recipe_parent_class)->finalize (object);
 }
@@ -369,7 +371,9 @@ gr_recipe_set_property (GObject      *object,
 
         case PROP_NOTES:
                 g_free (self->notes);
+                g_free (self->translated_notes);
                 self->notes = g_value_dup_string (value);
+                self->translated_notes = translate_multiline_string (self->notes);
                 update_mtime (self);
                 break;
 
@@ -571,6 +575,12 @@ gr_recipe_get_translated_description (GrRecipe *recipe)
         return recipe->translated_description;
 }
 
+const char *
+gr_recipe_get_translated_notes (GrRecipe *recipe)
+{
+        return recipe->translated_notes;
+}
+
 int
 gr_recipe_get_serves (GrRecipe *recipe)
 {
diff --git a/src/gr-recipe.h b/src/gr-recipe.h
index 1b21538..8ca5709 100644
--- a/src/gr-recipe.h
+++ b/src/gr-recipe.h
@@ -59,6 +59,7 @@ gboolean        gr_recipe_is_contributed   (GrRecipe   *recipe);
 const char     *gr_recipe_get_translated_name         (GrRecipe   *recipe);
 const char     *gr_recipe_get_translated_description  (GrRecipe   *recipe);
 const char     *gr_recipe_get_translated_instructions (GrRecipe   *recipe);
+const char     *gr_recipe_get_translated_notes        (GrRecipe   *recipe);
 
 gboolean        gr_recipe_matches          (GrRecipe    *recipe,
                                             const char **terms);


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