[gnome-games/wip/exalm/libhandy2: 2/7] ui: Add PreferencesSidebarItem



commit ca25fef6d5206645e424361f346b6c1b2dc7f020
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Mon Sep 24 22:08:49 2018 +0500

    ui: Add PreferencesSidebarItem
    
    This will be used in the next commit to implement a sidebar that works
    with PreferencePage objects.

 data/org.gnome.Games.gresource.xml   |  1 +
 data/ui/preferences-sidebar-item.ui  | 13 +++++++++++++
 src/meson.build                      |  1 +
 src/ui/preferences-sidebar-item.vala | 18 ++++++++++++++++++
 4 files changed, 33 insertions(+)
---
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index b9f080cb..b5d366ea 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -34,6 +34,7 @@
     <file preprocess="xml-stripblanks">ui/preferences-page-plugins.ui</file>
     <file preprocess="xml-stripblanks">ui/preferences-page-plugins-item.ui</file>
     <file preprocess="xml-stripblanks">ui/preferences-page-video.ui</file>
+    <file preprocess="xml-stripblanks">ui/preferences-sidebar-item.ui</file>
     <file preprocess="xml-stripblanks">ui/preferences-subpage-gamepad.ui</file>
     <file preprocess="xml-stripblanks">ui/preferences-subpage-keyboard.ui</file>
     <file preprocess="xml-stripblanks">ui/preferences-window.ui</file>
diff --git a/data/ui/preferences-sidebar-item.ui b/data/ui/preferences-sidebar-item.ui
new file mode 100644
index 00000000..3339f51b
--- /dev/null
+++ b/data/ui/preferences-sidebar-item.ui
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="GamesPreferencesSidebarItem" parent="GtkListBoxRow">
+    <property name="visible">true</property>
+    <child>
+      <object class="GtkLabel" id="label">
+        <property name="visible">true</property>
+        <property name="wrap">true</property>
+        <property name="xalign">0</property>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/meson.build b/src/meson.build
index 9a886051..ee7952ba 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -157,6 +157,7 @@ vala_sources = [
   'ui/preferences-page-plugins.vala',
   'ui/preferences-page-plugins-item.vala',
   'ui/preferences-page-video.vala',
+  'ui/preferences-sidebar-item.vala',
   'ui/preferences-subpage.vala',
   'ui/preferences-subpage-gamepad.vala',
   'ui/preferences-subpage-keyboard.vala',
diff --git a/src/ui/preferences-sidebar-item.vala b/src/ui/preferences-sidebar-item.vala
new file mode 100644
index 00000000..6a551d4b
--- /dev/null
+++ b/src/ui/preferences-sidebar-item.vala
@@ -0,0 +1,18 @@
+[GtkTemplate (ui = "/org/gnome/Games/ui/preferences-sidebar-item.ui")]
+private class Games.PreferencesSidebarItem: Gtk.ListBoxRow {
+       [GtkChild]
+       private Gtk.Label label;
+
+       private PreferencesPage _preferences_page;
+       public PreferencesPage preferences_page {
+               get { return _preferences_page; }
+               set {
+                       _preferences_page = value;
+                       label.label = value.title;
+               }
+       }
+
+       public PreferencesSidebarItem (PreferencesPage preferences_page) {
+               Object (preferences_page : preferences_page);
+       }
+}


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