[recipes] Some updates to the shopping list UI



commit 200f7405be43f807c10aaff75cfafaf767355227
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jan 28 18:40:24 2017 +0100

    Some updates to the shopping list UI
    
    Follow the latest mockups: Rename from "Cook it later" to
    "Buy ingredients", move the button closer to hte ingredients
    list.

 src/gr-details-page.c   |   11 +----------
 src/gr-details-page.ui  |   23 +++++++++++------------
 src/gr-recipes-page.c   |    8 ++++----
 src/gr-recipes-page.ui  |    1 +
 src/gr-shopping-page.ui |    2 +-
 src/gr-window.c         |    2 +-
 6 files changed, 19 insertions(+), 28 deletions(-)
---
diff --git a/src/gr-details-page.c b/src/gr-details-page.c
index 2443b3f..0cda500 100644
--- a/src/gr-details-page.c
+++ b/src/gr-details-page.c
@@ -140,7 +140,6 @@ struct _GrDetailsPage
         GtkWidget *time_spin;
         GtkWidget *start_button;
         GtkWidget *favorite_button;
-        GtkWidget *shop_button;
         GtkWidget *duration_stack;
         GtkWidget *remaining_time_label;
         GtkWidget *chef_label;
@@ -520,10 +519,7 @@ shop_it (GrDetailsPage *page)
         GrRecipeStore *store;
 
         store = gr_app_get_recipe_store (GR_APP (g_application_get_default ()));
-        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->shop_button)))
-                gr_recipe_store_add_to_shopping (store, page->recipe);
-        else
-                gr_recipe_store_remove_from_shopping (store, page->recipe);
+        gr_recipe_store_add_to_shopping (store, page->recipe);
 }
 
 static gboolean save_notes (gpointer data);
@@ -761,7 +757,6 @@ gr_details_page_class_init (GrDetailsPageClass *klass)
         gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, time_spin);
         gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, start_button);
         gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, favorite_button);
-        gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, shop_button);
         gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, duration_stack);
         gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, remaining_time_label);
         gtk_widget_class_bind_template_child (widget_class, GrDetailsPage, chef_label);
@@ -925,7 +920,6 @@ gr_details_page_set_recipe (GrDetailsPage *page,
         g_autoptr(GArray) images = NULL;
         gboolean cooking;
         gboolean favorite;
-        gboolean shopping;
         gboolean same_recipe;
         int index;
 
@@ -983,9 +977,6 @@ gr_details_page_set_recipe (GrDetailsPage *page,
         favorite = gr_recipe_store_is_favorite (store, recipe);
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->favorite_button), favorite);
 
-        shopping = gr_recipe_store_is_in_shopping (store, recipe);
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->shop_button), shopping);
-
         chef = gr_recipe_store_get_chef (store, author);
         g_set_object (&page->chef, chef);
 
diff --git a/src/gr-details-page.ui b/src/gr-details-page.ui
index 07302d3..5dd2379 100644
--- a/src/gr-details-page.ui
+++ b/src/gr-details-page.ui
@@ -222,6 +222,17 @@ followed</property>
                                 <property name="margin-top">30</property>
                               </object>
                             </child>
+                            <child>
+                              <object class="GtkButton">
+                                <property name="visible">1</property>
+                                <property name="use-underline">1</property>
+                                <property name="halign">start</property>
+                                <property name="margin-top">20</property>
+                                <property name="focus-on-click">0</property>
+                                <property name="label" translatable="yes">_Buy ingredients</property>
+                                <signal name="clicked" handler="shop_it" swapped="yes"/>
+                              </object>
+                            </child>
                           </object>
                         </child>
                       </object>
@@ -476,18 +487,6 @@ followed</property>
           </object>
         </child>
         <child>
-          <object class="GtkToggleButton" id="shop_button">
-            <property name="visible">1</property>
-            <property name="use-underline">1</property>
-            <property name="focus-on-click">0</property>
-            <property name="label" translatable="yes">_Cook it later</property>
-            <signal name="toggled" handler="shop_it" swapped="yes"/>
-          </object>
-          <packing>
-            <property name="pack-type">end</property>
-          </packing>
-        </child>
-        <child>
           <object class="GtkToggleButton" id="favorite_button">
             <property name="visible">1</property>
             <property name="focus-on-click">0</property>
diff --git a/src/gr-recipes-page.c b/src/gr-recipes-page.c
index ffddb71..a586433 100644
--- a/src/gr-recipes-page.c
+++ b/src/gr-recipes-page.c
@@ -345,12 +345,12 @@ populate_recipes_from_store (GrRecipesPage *self)
         }
 
         if (shopping == 1)
-                tmp = g_strdup_printf (_("Cook later: <b>%s</b>"), shop1);
+                tmp = g_strdup_printf (_("Buy ingredients: <b>%s</b>"), shop1);
         else if (shopping == 2)
-                tmp = g_strdup_printf (_("Cook later: <b>%s and %s</b>"), shop1, shop2);
+                tmp = g_strdup_printf (_("Buy ingredients: <b>%s and %s</b>"), shop1, shop2);
         else
-                tmp = g_strdup_printf (ngettext ("Cook later: <b>%s, %s and %d other</b>",
-                                                 "Cook later: <b>%s, %s and %d others</b>", shopping - 2), 
shop1, shop2, shopping - 2);
+                tmp = g_strdup_printf (ngettext ("Buy ingredients: <b>%s, %s and %d other</b>",
+                                                 "Buy ingredients: <b>%s, %s and %d others</b>", shopping - 
2), shop1, shop2, shopping - 2);
         gtk_label_set_label (GTK_LABEL (self->shopping_list), tmp);
         g_free (tmp);
 
diff --git a/src/gr-recipes-page.ui b/src/gr-recipes-page.ui
index fe82557..abfa3d0 100644
--- a/src/gr-recipes-page.ui
+++ b/src/gr-recipes-page.ui
@@ -78,6 +78,7 @@
                         <property name="visible">1</property>
                         <property name="margin">10</property>
                         <property name="xalign">0</property>
+                        <property name="ellipsize">end</property>
                         <property name="use-markup">1</property>
                       </object>
                       <packing>
diff --git a/src/gr-shopping-page.ui b/src/gr-shopping-page.ui
index 1c22e2f..1663537 100644
--- a/src/gr-shopping-page.ui
+++ b/src/gr-shopping-page.ui
@@ -39,7 +39,7 @@
                     <property name="visible">1</property>
                     <property name="xalign">0</property>
                     <property name="valign">end</property>
-                    <property name="label" translatable="yes">Cook it Later</property>
+                    <property name="label" translatable="yes">Buy ingredients</property>
                     <style>
                       <class name="heading"/>
                     </style>
diff --git a/src/gr-window.c b/src/gr-window.c
index 0dc267f..9309c6a 100644
--- a/src/gr-window.c
+++ b/src/gr-window.c
@@ -696,7 +696,7 @@ gr_window_show_shopping (GrWindow *window)
 {
         save_back_entry (window);
 
-        gtk_header_bar_set_title (GTK_HEADER_BAR (window->header), _("Cook it later"));
+        gtk_header_bar_set_title (GTK_HEADER_BAR (window->header), _("Buy ingredients"));
 
         gtk_stack_set_visible_child_name (GTK_STACK (window->header_start_stack), "back");
         gtk_stack_set_visible_child_name (GTK_STACK (window->header_title_stack), "title");


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