[gnome-games/wip/exalm/views: 98/109] collection-view: Handle empty collection
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/views: 98/109] collection-view: Handle empty collection
- Date: Sun, 24 Feb 2019 18:39:58 +0000 (UTC)
commit ee3fe85d4e5fc71e003a08774ba50e052a3a035b
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 | 13 -------------
src/ui/collection-view.vala | 21 ++++++++++++++++++++-
2 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index c3e6187e..93f1f647 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -70,8 +70,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;
@@ -113,10 +109,6 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
Object(application: application);
collection_view.collection = collection;
- collection.items_changed.connect (() => {
- is_collection_empty = collection.get_n_items () == 0;
- });
- is_collection_empty = collection.get_n_items () == 0;
}
construct {
@@ -155,11 +147,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 d3e51da3..280bd4f5 100644
--- a/src/ui/collection-view.vala
+++ b/src/ui/collection-view.vala
@@ -29,14 +29,33 @@ private class Games.CollectionView: Gtk.Bin, ApplicationView {
private ListModel _collection;
public ListModel collection {
get { return _collection; }
- construct set {
+ 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 {
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 (ListModel collection) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]