[recipes/wip/yield: 6/8] Use the yield language in the shopping page



commit ef1456fa30efc976e69d9aa3f7c4d0db45ac6b28
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jun 23 19:33:30 2017 -0400

    Use the yield language in the shopping page
    
    The popover in the recipe tiles here should use the
    same terminology we use in the edit page.

 src/gr-recipe-small-tile.c  |    5 +++++
 src/gr-recipe-small-tile.ui |   16 +++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/src/gr-recipe-small-tile.c b/src/gr-recipe-small-tile.c
index 127d2e7..9d76600 100644
--- a/src/gr-recipe-small-tile.c
+++ b/src/gr-recipe-small-tile.c
@@ -44,6 +44,7 @@ struct _GrRecipeSmallTile
         GtkWidget *serves_label;
         GtkWidget *popover;
         GtkWidget *serves_spin;
+        GtkWidget *yield_label;
         GtkWidget *remove_button;
 
         GCancellable *cancellable;
@@ -93,17 +94,20 @@ recipe_small_tile_set_recipe (GrRecipeSmallTile *tile,
         if (tile->recipe) {
                 const char *name;
                 const char *author;
+                const char *yield;
                 g_autoptr(GrChef) chef = NULL;
                 g_autofree char *tmp = NULL;
                 GPtrArray *images;
 
                 name = gr_recipe_get_translated_name (recipe);
                 author = gr_recipe_get_author (recipe);
+                yield = gr_recipe_get_yield (recipe);
                 chef = gr_recipe_store_get_chef (store, author);
 
                 gtk_label_set_label (GTK_LABEL (tile->label), name);
                 tmp = g_strdup_printf (_("by %s"), chef ? gr_chef_get_name (chef) : _("Anonymous"));
                 gtk_label_set_label (GTK_LABEL (tile->author), tmp);
+                gtk_label_set_label (GTK_LABEL (tile->yield_label), yield && yield[0] ? yield : 
_("servings"));
 
                 images = gr_recipe_get_images (recipe);
                 if (images->len > 0) {
@@ -227,6 +231,7 @@ gr_recipe_small_tile_class_init (GrRecipeSmallTileClass *klass)
         gtk_widget_class_bind_template_child (widget_class, GrRecipeSmallTile, serves_label);
         gtk_widget_class_bind_template_child (widget_class, GrRecipeSmallTile, popover);
         gtk_widget_class_bind_template_child (widget_class, GrRecipeSmallTile, serves_spin);
+        gtk_widget_class_bind_template_child (widget_class, GrRecipeSmallTile, yield_label);
         gtk_widget_class_bind_template_child (widget_class, GrRecipeSmallTile, remove_button);
 
         gtk_widget_class_bind_template_callback (widget_class, tile_clicked);
diff --git a/src/gr-recipe-small-tile.ui b/src/gr-recipe-small-tile.ui
index 63cebb1..b489e86 100644
--- a/src/gr-recipe-small-tile.ui
+++ b/src/gr-recipe-small-tile.ui
@@ -93,12 +93,12 @@
         <property name="visible">1</property>
         <property name="margin">10</property>
         <property name="row-spacing">10</property>
-        <property name="column-spacing">20</property>
+        <property name="column-spacing">10</property>
         <child>
           <object class="GtkLabel">
             <property name="visible">1</property>
             <property name="xalign">0</property>
-            <property name="label" translatable="yes">Serves</property>
+            <property name="label" translatable="yes">Yield</property>
             <property name="valign">baseline</property>
           </object>
           <packing>
@@ -120,6 +120,16 @@
           </packing>
         </child>
         <child>
+          <object class="GtkLabel" id="yield_label">
+            <property name="visible">1</property>
+            <property name="valign">baseline</property>
+          </object>
+          <packing>
+            <property name="left-attach">2</property>
+            <property name="top-attach">0</property>
+          </packing>
+        </child>
+        <child>
           <object class="GtkButton" id="remove_button">
             <property name="visible">1</property>
             <property name="label" translatable="yes">Remove</property>
@@ -132,7 +142,7 @@
           <packing>
             <property name="left-attach">0</property>
             <property name="top-attach">1</property>
-            <property name="width">2</property>
+            <property name="width">3</property>
           </packing>
         </child>
       </object>


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