[gnome-games/wip/exalm/spinner: 4/10] sidebar-view: Add existing items when changing model
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/spinner: 4/10] sidebar-view: Add existing items when changing model
- Date: Sun, 7 Oct 2018 10:29:28 +0000 (UTC)
commit 299e8996451d1311553263b3e19b10400053835e
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 | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/ui/sidebar-view.vala b/src/ui/sidebar-view.vala
index f3f5996e..621c26df 100644
--- a/src/ui/sidebar-view.vala
+++ b/src/ui/sidebar-view.vala
@@ -22,8 +22,15 @@ private abstract class Games.SidebarView : Gtk.Box {
_model = value;
collection_view.model = _model;
- if (model != null)
+ if (model != null) {
+ 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);
+ }
+
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]