[gnome-games/wip/exalm/spinner: 7/8] sidebar-view: Add existing items when changing model



commit 6ecac66d332f321ccf130163cc280c69f41f3818
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Sat Sep 22 15:43:42 2018 +0500

    sidebar-view: Add existing items when changing model
    
    Prevents sidebar from being empty initially after changing list model.

 src/ui/sidebar-view.vala | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/ui/sidebar-view.vala b/src/ui/sidebar-view.vala
index f3f5996e..4aa1c5ed 100644
--- a/src/ui/sidebar-view.vala
+++ b/src/ui/sidebar-view.vala
@@ -22,6 +22,12 @@ private abstract class Games.SidebarView : Gtk.Box {
                        _model = value;
                        collection_view.model = _model;
 
+                       uint n_items = model.get_n_items ();
+                       for (uint i = 0; i < n_items; i++) {
+                               var game = model.get_item (i) as Game;
+                               game_added (game);
+                       }
+
                        if (model != null)
                                model_items_changed_id = model.items_changed.connect (on_model_changed);
                }


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