[gnome-games/wip/exalm/views: 5/19] ui: Add CollectionView
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/views: 5/19] ui: Add CollectionView
- Date: Mon, 25 Feb 2019 09:23:24 +0000 (UTC)
commit 40622e51e33f202906e0bc77d8a0d6942b62e1e2
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Thu Oct 4 13:49:35 2018 +0500
ui: Add CollectionView
This will be used in the subsequent commits to move collection logic out
of ApplicationWindow.
Make 'box' and 'header_bar' public temporarily, until their references in
ApplicationWindow are removed.
src/meson.build | 1 +
src/ui/collection-view.vala | 72 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 73 insertions(+)
---
diff --git a/src/meson.build b/src/meson.build
index eea378ec..f71f9c8d 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -131,6 +131,7 @@ vala_sources = [
'ui/collection-box.vala',
'ui/collection-icon-view.vala',
'ui/collection-header-bar.vala',
+ 'ui/collection-view.vala',
'ui/developer-list-item.vala',
'ui/developers-view.vala',
'ui/display-box.vala',
diff --git a/src/ui/collection-view.vala b/src/ui/collection-view.vala
new file mode 100644
index 00000000..5f523cad
--- /dev/null
+++ b/src/ui/collection-view.vala
@@ -0,0 +1,72 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+private class Games.CollectionView : Object, UiView {
+ public signal void game_activated (Game game);
+
+ public CollectionBox box;
+ public CollectionHeaderBar header_bar;
+
+ public Gtk.Widget content_box {
+ get { return box; }
+ }
+
+ public Gtk.Widget title_bar {
+ get { return header_bar; }
+ }
+
+ private bool _is_view_active;
+ public bool is_view_active {
+ get { return _is_view_active; }
+ set {
+ if (is_view_active == value)
+ return;
+
+ _is_view_active = value;
+ }
+ }
+
+ public ApplicationWindow window { get; construct set; }
+
+ private ListModel _collection;
+ public ListModel collection {
+ get { return _collection; }
+ construct set {
+ _collection = value;
+ box.collection = _collection;
+ }
+ }
+
+ construct {
+ box = new CollectionBox (collection);
+ header_bar = new CollectionHeaderBar ();
+ box.game_activated.connect (game => {
+ game_activated (game);
+ });
+
+ header_bar.viewstack = box.viewstack;
+ }
+
+ public CollectionView (ApplicationWindow window, ListModel collection) {
+ Object (window: window, collection: collection);
+ }
+
+ public bool on_button_pressed (Gdk.EventButton event) {
+ return false;
+ }
+
+ public bool on_key_pressed (Gdk.EventKey event) {
+ return false;
+ }
+
+ public bool gamepad_button_press_event (Manette.Event event) {
+ return false;
+ }
+
+ public bool gamepad_button_release_event (Manette.Event event) {
+ return false;
+ }
+
+ public bool gamepad_absolute_axis_event (Manette.Event event) {
+ return false;
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]