[gnome-games] ui: Add DisplayHeaderBar



commit 052e18be5f0258c1c9e5cb3b76ebbb00c44c84b2
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue Jul 19 08:58:56 2016 +0200

    ui: Add DisplayHeaderBar
    
    This will be used in a subsequent commit to replace ContentBox.
    
    This is needed to better distribute the concerns of the different parts
    of the UI.

 data/org.gnome.Games.gresource.xml |    1 +
 data/ui/display-header-bar.ui      |   32 ++++++++++++++++++++++++++++++++
 src/Makefile.am                    |    1 +
 src/ui/display-header-bar.vala     |   15 +++++++++++++++
 4 files changed, 49 insertions(+), 0 deletions(-)
---
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index 63baadb..aebe861 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -8,6 +8,7 @@
     <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/content-box.ui</file>
+    <file preprocess="xml-stripblanks">ui/display-header-bar.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-info-bar.ui</file>
diff --git a/data/ui/display-header-bar.ui b/data/ui/display-header-bar.ui
new file mode 100644
index 0000000..b3824d7
--- /dev/null
+++ b/data/ui/display-header-bar.ui
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="3.16"/>
+  <template class="GamesDisplayHeaderBar" parent="GtkHeaderBar">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">Games</property>
+    <child>
+      <object class="GtkButton" id="back">
+        <property name="visible">True</property>
+        <property name="valign">center</property>
+        <property name="use-underline">True</property>
+        <signal name="clicked" handler="on_back_clicked"/>
+        <style>
+          <class name="image-button"/>
+        </style>
+        <child internal-child="accessible">
+          <object class="AtkObject" id="a11y-back">
+            <property name="accessible-name" translatable="yes">Back</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkImage" id="back_image">
+            <property name="visible">True</property>
+            <property name="icon-name">go-previous-symbolic</property>
+            <property name="icon-size">1</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/Makefile.am b/src/Makefile.am
index e431610..f3fa6d1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -87,6 +87,7 @@ gnome_games_SOURCES = \
        ui/collection-icon-view.vala \
        ui/collection-header-bar.vala \
        ui/content-box.vala \
+       ui/display-header-bar.vala \
        ui/dummy-display.vala \
        ui/empty-collection.vala \
        ui/error-info-bar.vala \
diff --git a/src/ui/display-header-bar.vala b/src/ui/display-header-bar.vala
new file mode 100644
index 0000000..69b4bdd
--- /dev/null
+++ b/src/ui/display-header-bar.vala
@@ -0,0 +1,15 @@
+// This file is part of GNOME Games. License: GPLv3
+
+[GtkTemplate (ui = "/org/gnome/Games/ui/display-header-bar.ui")]
+private class Games.DisplayHeaderBar : Gtk.HeaderBar {
+       public signal void back ();
+
+       public string game_title {
+               set { title = value; }
+       }
+
+       [GtkCallback]
+       private void on_back_clicked () {
+               back ();
+       }
+}


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