[gnome-games/wip/exalm/libhandy2: 43/50] ui: Add PreferencesSidebarItem



commit 29c9ac81acd62f2c338ec8646760a3d94a293da6
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 53d30df2..a9692308 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -36,6 +36,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 7d57fcb0..ab3ef027 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -158,6 +158,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]