[gnome-games/wip/exalm/views: 4/18] ui: Add DisplayView



commit fb55cd2fbcbd8f4c47785efb45b329ef700cbfd7
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Thu Oct 4 17:59:26 2018 +0500

    ui: Add DisplayView
    
    This will be used in the subsequent commits to move game display 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/display-view.ui            | 19 ++++++++++++++
 src/meson.build                    |  1 +
 src/ui/display-view.vala           | 53 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 74 insertions(+)
---
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index cf9c30a3..59dc783f 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -19,6 +19,7 @@
     <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>
+    <file preprocess="xml-stripblanks">ui/display-view.ui</file>
     <file preprocess="xml-stripblanks">ui/dummy-display.ui</file>
     <file preprocess="xml-stripblanks">ui/empty-collection.ui</file>
     <file preprocess="xml-stripblanks">ui/error-display.ui</file>
diff --git a/data/ui/display-view.ui b/data/ui/display-view.ui
new file mode 100644
index 00000000..9a8eb6be
--- /dev/null
+++ b/data/ui/display-view.ui
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.1 -->
+<interface>
+  <requires lib="gtk+" version="3.16"/>
+  <template class="GamesDisplayView" parent="GtkBin">
+    <property name="visible">True</property>
+    <child>
+      <object class="GamesDisplayBox" id="box">
+        <property name="visible">True</property>
+        <signal name="back" handler="on_display_back"/>
+      </object>
+    </child>
+  </template>
+  <object class="GamesDisplayHeaderBar" id="header_bar">
+    <property name="visible">True</property>
+    <property name="show_close_button">True</property>
+    <signal name="back" handler="on_display_back"/>
+  </object>
+</interface>
diff --git a/src/meson.build b/src/meson.build
index 85af716e..ddf1314b 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -135,6 +135,7 @@ vala_sources = [
   'ui/developers-view.vala',
   'ui/display-box.vala',
   'ui/display-header-bar.vala',
+  'ui/display-view.vala',
   'ui/dummy-display.vala',
   'ui/empty-collection.vala',
   'ui/error-display.vala',
diff --git a/src/ui/display-view.vala b/src/ui/display-view.vala
new file mode 100644
index 00000000..3d0f8855
--- /dev/null
+++ b/src/ui/display-view.vala
@@ -0,0 +1,53 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+[GtkTemplate (ui = "/org/gnome/Games/ui/display-view.ui")]
+private class Games.DisplayView: Gtk.Bin, ApplicationView {
+       public signal void back ();
+
+       [GtkChild]
+       public DisplayBox box;
+       [GtkChild]
+       public DisplayHeaderBar 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; }
+
+       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_display_back () {
+               back ();
+       }
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]