[recipes] window: Deal with 'My Recipes' more gracefully
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] window: Deal with 'My Recipes' more gracefully
- Date: Mon, 13 Feb 2017 00:13:00 +0000 (UTC)
commit 56b0782569206f9a28c451cc06d1010454aa12fd
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Feb 12 19:11:14 2017 -0500
window: Deal with 'My Recipes' more gracefully
Ensure the user chef exist before showing his recipes.
src/gr-window.c | 31 +++++++++++++++++++++++--------
1 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/src/gr-window.c b/src/gr-window.c
index d38f99d..432ae33 100644
--- a/src/gr-window.c
+++ b/src/gr-window.c
@@ -852,6 +852,23 @@ gr_window_show_shopping (GrWindow *window)
gr_shopping_page_populate (GR_SHOPPING_PAGE (window->shopping_page));
}
+static void
+do_show_myself (GrChef *chef,
+ gpointer data)
+{
+ GrWindow *window = data;
+
+ gr_list_page_populate_from_chef (GR_LIST_PAGE (window->chef_page), chef);
+
+ gtk_header_bar_set_title (GTK_HEADER_BAR (window->header ), _("My own recipes"));
+
+ 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");
+ gtk_stack_set_visible_child_name (GTK_STACK (window->header_end_stack), "list");
+
+ gtk_stack_set_visible_child_name (GTK_STACK (window->main_stack), "chef");
+}
+
void
gr_window_show_myself (GrWindow *window)
{
@@ -862,18 +879,16 @@ gr_window_show_myself (GrWindow *window)
save_back_entry (window);
store = gr_app_get_recipe_store (GR_APP (g_application_get_default ()));
+ gr_ensure_user_chef (GTK_WINDOW (window), do_show_myself, window);
name = gr_recipe_store_get_user_key (store);
chef = gr_recipe_store_get_chef (store, name);
- gr_list_page_populate_from_chef (GR_LIST_PAGE (window->chef_page), chef);
-
- gtk_header_bar_set_title (GTK_HEADER_BAR (window->header ), _("My own recipes"));
-
- 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");
- gtk_stack_set_visible_child_name (GTK_STACK (window->header_end_stack), "list");
+ if (chef) {
+ do_show_myself (chef, window);
+ return;
+ }
- gtk_stack_set_visible_child_name (GTK_STACK (window->main_stack), "chef");
+ gr_ensure_user_chef (GTK_WINDOW (window), do_show_myself, window);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]