[gnome-games/wip/exalm/views: 2/17] ui: Add CollectionView
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/views: 2/17] ui: Add CollectionView
- Date: Thu, 4 Oct 2018 18:47:19 +0000 (UTC)
commit 70c3acdd6d667df4c2b766cd041a34ae200569a6
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Thu Oct 4 13:49:35 2018 +0500
ui: Add CollectionView
data/org.gnome.Games.gresource.xml | 1 +
data/ui/collection-view.ui | 18 ++++++++++
src/meson.build | 1 +
src/ui/collection-view.vala | 71 ++++++++++++++++++++++++++++++++++++++
4 files changed, 91 insertions(+)
---
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index b9f080cb..cf9c30a3 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/developer-list-item.ui</file>
<file preprocess="xml-stripblanks">ui/display-box.ui</file>
<file preprocess="xml-stripblanks">ui/display-header-bar.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 7e5cc74b..85af716e 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -130,6 +130,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..65d6e2a8
--- /dev/null
+++ b/src/ui/collection-view.vala
@@ -0,0 +1,71 @@
+// 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 (name = "header_bar")]
+ public CollectionHeaderBar _header_bar;
+
+ public Gtk.HeaderBar header_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 {
+ _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]