[recipes] Improve list page handling



commit 6c69b2c96abd9e3cbe14707caff6de2437e7d75f
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Dec 31 11:38:40 2016 -0500

    Improve list page handling
    
    Add a way to clear the list page, and use it in GrWindow when
    switching away from a list page.

 src/gr-list-page.c |    8 ++++++++
 src/gr-list-page.h |    1 +
 src/gr-window.c    |    3 +++
 3 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/gr-list-page.c b/src/gr-list-page.c
index 5faffe4..678e1a0 100644
--- a/src/gr-list-page.c
+++ b/src/gr-list-page.c
@@ -410,3 +410,11 @@ connect_store_signals (GrListPage *page)
         g_signal_connect_swapped (store, "recipe-removed", G_CALLBACK (list_page_reload), page);
         g_signal_connect_swapped (store, "recipe-changed", G_CALLBACK (list_page_reload), page);
 }
+
+void
+gr_list_page_clear (GrListPage *self)
+{
+        gr_recipe_search_stop (self->search);
+        container_remove_all (GTK_CONTAINER (self->flow_box));
+}
+
diff --git a/src/gr-list-page.h b/src/gr-list-page.h
index b2e12e2..ddff886 100644
--- a/src/gr-list-page.h
+++ b/src/gr-list-page.h
@@ -39,5 +39,6 @@ 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_clear                   (GrListPage *self);
 
 G_END_DECLS
diff --git a/src/gr-window.c b/src/gr-window.c
index 1c3c5f0..f9fa2c7 100644
--- a/src/gr-window.c
+++ b/src/gr-window.c
@@ -207,6 +207,9 @@ visible_page_changed (GrWindow *window)
                 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (window->search_button), FALSE);
                 g_signal_handlers_unblock_by_func (window->search_bar, search_changed, window);
         }
+        if (strcmp (visible, "list") != 0) {
+                gr_list_page_clear (GR_LIST_PAGE (window->list_page));
+        }
 
         if (strcmp (visible, "recipes") == 0) {
                 gr_recipes_page_unexpand (GR_RECIPES_PAGE (window->recipes_page));


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