[gnome-games/wip/exalm/views: 94/109] ui: Add CollectionView
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/views: 94/109] ui: Add CollectionView
- Date: Sun, 24 Feb 2019 18:39:38 +0000 (UTC)
commit a9f09d917428d05d7b101a33af0d84ef34e9c458
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.
data/org.gnome.Games.gresource.xml | 1 +
data/ui/collection-view.ui | 18 ++++++++++
src/meson.build | 1 +
src/ui/collection-view.vala | 70 ++++++++++++++++++++++++++++++++++++++
4 files changed, 90 insertions(+)
---
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index 789498a1..d7a43e26 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -15,6 +15,7 @@
<file preprocess="xml-stripblanks">ui/collection-box.ui</file>
<file preprocess="xml-stripblanks">ui/collection-header-bar.ui</file>
<file preprocess="xml-stripblanks">ui/collection-icon-view.ui</file>
+ <file preprocess="xml-stripblanks">ui/collection-view.ui</file>
<file preprocess="xml-stripblanks">ui/display-box.ui</file>
<file preprocess="xml-stripblanks">ui/display-header-bar.ui</file>
<file preprocess="xml-stripblanks">ui/dummy-display.ui</file>
diff --git a/data/ui/collection-view.ui b/data/ui/collection-view.ui
new file mode 100644
index 00000000..14810906
--- /dev/null
+++ b/data/ui/collection-view.ui
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.1 -->
+<interface>
+ <requires lib="gtk+" version="3.16"/>
+ <template class="GamesCollectionView" parent="GtkBin">
+ <property name="visible">True</property>
+ <child>
+ <object class="GamesCollectionBox" id="box">
+ <property name="visible">True</property>
+ <signal name="game-activated" handler="on_game_activated"/>
+ </object>
+ </child>
+ </template>
+ <object class="GamesCollectionHeaderBar" id="header_bar">
+ <property name="visible">True</property>
+ <property name="show_close_button">True</property>
+ </object>
+</interface>
diff --git a/src/meson.build b/src/meson.build
index dddc47df..ee39829f 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -132,6 +132,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..d3e51da3
--- /dev/null
+++ b/src/ui/collection-view.vala
@@ -0,0 +1,70 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+[GtkTemplate (ui = "/org/gnome/Games/ui/collection-view.ui")]
+private class Games.CollectionView: Gtk.Bin, ApplicationView {
+ public signal void game_activated (Game game);
+
+ [GtkChild]
+ public CollectionBox box;
+ [GtkChild]
+ public CollectionHeaderBar header_bar;
+
+ public Gtk.Widget titlebar {
+ 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 {
+ header_bar.viewstack = box.viewstack;
+ }
+
+ public CollectionView (ListModel collection) {
+ box.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;
+ }
+
+ [GtkCallback]
+ private void on_game_activated (Game game) {
+ game_activated (game);
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]