[gnome-games] ui: Add CollectionHeaderBar



commit dff42a3afbb86f03224db47eb1a43a1fd6d23a20
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Sun Jul 24 09:44:58 2016 +0200

    ui: Add CollectionHeaderBar
    
    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/collection-header-bar.ui   |   34 ++++++++++++++++++++++++++++++++++
 src/Makefile.am                    |    1 +
 src/ui/collection-header-bar.vala  |   15 +++++++++++++++
 4 files changed, 51 insertions(+), 0 deletions(-)
---
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index 0a19433..63baadb 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -5,6 +5,7 @@
     <file>gamepads/gamecontrollerdb.txt</file>
     <file preprocess="xml-stripblanks">gtk/menus.ui</file>
     <file preprocess="xml-stripblanks">ui/application-window.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/content-box.ui</file>
     <file preprocess="xml-stripblanks">ui/dummy-display.ui</file>
diff --git a/data/ui/collection-header-bar.ui b/data/ui/collection-header-bar.ui
new file mode 100644
index 0000000..ee23719
--- /dev/null
+++ b/data/ui/collection-header-bar.ui
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="3.16"/>
+  <template class="GamesCollectionHeaderBar" parent="GtkHeaderBar">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">Games</property>
+    <child>
+      <object class="GtkToggleButton" id="search">
+        <property name="visible">True</property>
+        <property name="valign">center</property>
+        <property name="use-underline">True</property>
+        <style>
+          <class name="image-button"/>
+        </style>
+        <child internal-child="accessible">
+          <object class="AtkObject" id="a11y-search">
+            <property name="accessible-name" translatable="yes">Search</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkImage" id="search_image">
+            <property name="visible">True</property>
+            <property name="icon-name">edit-find-symbolic</property>
+            <property name="icon-size">1</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="pack-type">end</property>
+      </packing>
+    </child>
+  </template>
+</interface>
diff --git a/src/Makefile.am b/src/Makefile.am
index c49b199..e431610 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -85,6 +85,7 @@ gnome_games_SOURCES = \
        ui/application.vala \
        ui/application-window.vala \
        ui/collection-icon-view.vala \
+       ui/collection-header-bar.vala \
        ui/content-box.vala \
        ui/dummy-display.vala \
        ui/empty-collection.vala \
diff --git a/src/ui/collection-header-bar.vala b/src/ui/collection-header-bar.vala
new file mode 100644
index 0000000..4a5ced2
--- /dev/null
+++ b/src/ui/collection-header-bar.vala
@@ -0,0 +1,15 @@
+// This file is part of GNOME Games. License: GPLv3
+
+[GtkTemplate (ui = "/org/gnome/Games/ui/collection-header-bar.ui")]
+private class Games.CollectionHeaderBar : Gtk.HeaderBar {
+       public bool search_mode { set; get; }
+
+       [GtkChild]
+       private Gtk.ToggleButton search;
+       private Binding search_binding;
+
+       construct {
+               search_binding = bind_property ("search-mode", search, "active",
+                                               BindingFlags.BIDIRECTIONAL);
+       }
+}


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