[recipes/wip/yield: 5/7] Use the yield language in the shopping page
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes/wip/yield: 5/7] Use the yield language in the shopping page
- Date: Sun, 25 Jun 2017 03:46:46 +0000 (UTC)
commit c0a0ba333b44ed2f2e0d26da0f1eefe17c70818f
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]