[gnome-games/wip/exalm/views: 8/19] collection-view: Handle empty collection
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/views: 8/19] collection-view: Handle empty collection
- Date: Mon, 25 Feb 2019 09:23:39 +0000 (UTC)
commit f554070b0e8577e1f1bd91d32821d8de67176659
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Thu Oct 4 23:40:25 2018 +0500
collection-view: Handle empty collection
Move 'is-collection-empty' property out of ApplicationWindow.
src/ui/application-window.vala | 14 --------------
src/ui/collection-view.vala | 19 +++++++++++++++++++
2 files changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index 45c50e4d..0961564a 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -72,8 +72,6 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
set { _search_mode = value && (ui_state == UiState.COLLECTION); }
}
- public bool is_collection_empty { get; set; }
-
public bool loading_notification { get; set; }
[GtkChild]
@@ -88,10 +86,8 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
private Binding box_search_binding;
private Binding box_fullscreen_binding;
- private Binding box_empty_collection_binding;
private Binding header_bar_search_binding;
private Binding header_bar_fullscreen_binding;
- private Binding header_bar_empty_collection_binding;
private Binding loading_notification_binding;
private Cancellable run_game_cancellable;
@@ -114,11 +110,6 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
}
construct {
- collection.items_changed.connect (() => {
- is_collection_empty = collection.get_n_items () == 0;
- });
- is_collection_empty = collection.get_n_items () == 0;
-
collection_view = new CollectionView (this, collection);
display_view = new DisplayView (this);
@@ -158,11 +149,6 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
header_bar_fullscreen_binding = bind_property ("is-fullscreen", display_view.header_bar,
"is-fullscreen",
BindingFlags.BIDIRECTIONAL);
- box_empty_collection_binding = bind_property ("is-collection-empty", collection_view.box,
"is-collection-empty",
- BindingFlags.BIDIRECTIONAL);
- header_bar_empty_collection_binding = bind_property ("is-collection-empty",
collection_view.header_bar, "is-collection-empty",
- BindingFlags.BIDIRECTIONAL);
-
konami_code = new KonamiCode (this);
konami_code.code_performed.connect (on_konami_code_performed);
diff --git a/src/ui/collection-view.vala b/src/ui/collection-view.vala
index 5f523cad..e434c970 100644
--- a/src/ui/collection-view.vala
+++ b/src/ui/collection-view.vala
@@ -33,9 +33,19 @@ private class Games.CollectionView : Object, UiView {
construct set {
_collection = value;
box.collection = _collection;
+
+ collection.items_changed.connect (() => {
+ is_collection_empty = collection.get_n_items () == 0;
+ });
+ is_collection_empty = collection.get_n_items () == 0;
}
}
+ public bool is_collection_empty { get; set; }
+
+ private Binding box_empty_collection_binding;
+ private Binding header_bar_empty_collection_binding;
+
construct {
box = new CollectionBox (collection);
header_bar = new CollectionHeaderBar ();
@@ -44,6 +54,15 @@ private class Games.CollectionView : Object, UiView {
});
header_bar.viewstack = box.viewstack;
+ is_collection_empty = true;
+
+ box_empty_collection_binding = bind_property ("is-collection-empty", box,
+ "is-collection-empty",
+ BindingFlags.BIDIRECTIONAL);
+ header_bar_empty_collection_binding = bind_property ("is-collection-empty",
+ header_bar,
+ "is-collection-empty",
+ BindingFlags.BIDIRECTIONAL);
}
public CollectionView (ApplicationWindow window, ListModel collection) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]