[recipes/shopping-list: 8/10] list page: Support showing the shopping list
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes/shopping-list: 8/10] list page: Support showing the shopping list
- Date: Sun, 8 Jan 2017 14:26:58 +0000 (UTC)
commit 5e2722cc3f4e4dc2f17d11a3fa74c3c9e7f82aaa
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jan 8 09:21:01 2017 -0500
list page: Support showing the shopping list
This is somewhat temporary. Eventually, we want a decidated
page that shows the shopping list that is derived from the
recipes, not just the recipes themselves.
src/gr-list-page.c | 23 +++++++++++++++++++++++
src/gr-list-page.h | 1 +
2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/gr-list-page.c b/src/gr-list-page.c
index 07045d6..4380b46 100644
--- a/src/gr-list-page.c
+++ b/src/gr-list-page.c
@@ -39,6 +39,7 @@ struct _GrListPage
GrChef *chef;
GrDiets diet;
gboolean favorites;
+ gboolean shopping;
char *season;
GtkWidget *top_box;
@@ -73,6 +74,7 @@ clear_data (GrListPage *self)
g_clear_object (&self->chef);
self->diet = 0;
self->favorites = FALSE;
+ self->shopping = FALSE;
g_clear_pointer (&self->season, g_free);
}
@@ -382,6 +384,25 @@ gr_list_page_populate_from_favorites (GrListPage *self)
}
void
+gr_list_page_populate_from_shopping (GrListPage *self)
+{
+ clear_data (self);
+ self->shopping = TRUE;
+
+ gtk_widget_hide (self->chef_grid);
+ gtk_widget_hide (self->heading);
+ gtk_widget_hide (self->diet_description);
+
+ container_remove_all (GTK_CONTAINER (self->flow_box));
+ gtk_label_set_label (GTK_LABEL (self->empty_title), _("The shopping list is empty"));
+ gtk_label_set_label (GTK_LABEL (self->empty_subtitle), _("Use the “Shopping” button to add recipes
to it."));
+
+ gr_recipe_search_stop (self->search);
+ gtk_stack_set_visible_child_name (GTK_STACK (self->list_stack), "list");
+ gr_recipe_search_set_query (self->search, "is:shopping");
+}
+
+void
gr_list_page_repopulate (GrListPage *page)
{
if (page->chef)
@@ -390,6 +411,8 @@ gr_list_page_repopulate (GrListPage *page)
gr_list_page_populate_from_diet (page, page->diet);
else if (page->favorites)
gr_list_page_populate_from_favorites (page);
+ else if (page->shopping)
+ gr_list_page_populate_from_shopping (page);
else if (page->season)
gr_list_page_populate_from_season (page, page->season);
}
diff --git a/src/gr-list-page.h b/src/gr-list-page.h
index ef5dfc4..c09298d 100644
--- a/src/gr-list-page.h
+++ b/src/gr-list-page.h
@@ -39,6 +39,7 @@ void gr_list_page_populate_from_chef (GrListPage *self,
void gr_list_page_populate_from_season (GrListPage *self,
const char *season);
void gr_list_page_populate_from_favorites (GrListPage *self);
+void gr_list_page_populate_from_shopping (GrListPage *self);
void gr_list_page_clear (GrListPage *self);
void gr_list_page_repopulate (GrListPage *self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]