[recipes] Add a window api to show the list of recipes



commit a1d8448aac782523bd2ba4f432e06bcbd2550333
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jan 9 19:24:37 2017 -0500

    Add a window api to show the list of recipes
    
    This will be used to show the results of import.

 src/gr-window.c |   24 +++++++++++++++++++++---
 src/gr-window.h |    3 +++
 2 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/src/gr-window.c b/src/gr-window.c
index 6bae31a..ab782c6 100644
--- a/src/gr-window.c
+++ b/src/gr-window.c
@@ -447,11 +447,11 @@ gr_window_edit_recipe (GrWindow *window,
 
 static void
 done_cb (GrRecipeImporter *importer,
-         GrRecipe         *recipe,
+         GList            *recipes,
          GrWindow         *window)
 {
-        if (recipe)
-                gr_window_show_recipe (window, recipe);
+        if (recipes)
+                gr_window_show_list (window, _("Imported Recipes"), recipes);
 }
 
 static void
@@ -556,6 +556,24 @@ gr_window_show_favorites (GrWindow *window)
 }
 
 void
+gr_window_show_list (GrWindow   *window,
+                     const char *title,
+                     GList      *recipes)
+{
+        save_back_entry (window);
+
+        gr_list_page_populate_from_list (GR_LIST_PAGE (window->list_page), recipes);
+
+        gtk_header_bar_set_title (GTK_HEADER_BAR (window->header), title);
+
+        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), "list");
+}
+
+void
 gr_window_show_myself (GrWindow *window)
 {
         const char *name;
diff --git a/src/gr-window.h b/src/gr-window.h
index 7bf49db..51ee8ea 100644
--- a/src/gr-window.h
+++ b/src/gr-window.h
@@ -48,6 +48,9 @@ void            gr_window_show_chef                  (GrWindow   *window,
                                                       GrChef     *chef);
 void            gr_window_show_myself                (GrWindow   *window);
 void            gr_window_show_favorites             (GrWindow   *window);
+void            gr_window_show_list                  (GrWindow   *window,
+                                                      const char *title,
+                                                      GList      *recipes);
 void            gr_window_show_cuisine               (GrWindow   *window,
                                                       const char *cuisine,
                                                       const char *title);


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