[gnome-games] ui: Add PreferencesSwitchItem



commit d44c3931834901e5d1e2b389d8ee920929ec6136
Author: theawless <theawless gmail com>
Date:   Thu Feb 23 01:12:49 2017 +0530

    ui: Add PreferencesSwitchItem
    
    This will be used in preferences ui to make options for switches,
    selectables and combo boxes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777987

 data/Makefile.am                    |    1 +
 data/org.gnome.Games.gresource.xml  |    1 +
 data/ui/preferences-switch-item.ui  |   23 +++++++++++++++++++++++
 src/Makefile.am                     |    1 +
 src/ui/preferences-switch-item.vala |   21 +++++++++++++++++++++
 5 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index f81f3eb..9275284 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -33,6 +33,7 @@ EXTRA_DIST = \
        ui/media-selector.ui \
        ui/preferences-page-plugins-item.ui \
        ui/preferences-page-plugins.ui \
+       ui/preferences-switch-item.ui \
        ui/preferences-window.ui \
        ui/quit-dialog.ui \
        ui/remote-display.ui \
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index 8f17469..6745d99 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -19,6 +19,7 @@
     <file preprocess="xml-stripblanks">ui/media-selector.ui</file>
     <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-switch-item.ui</file>
     <file preprocess="xml-stripblanks">ui/preferences-window.ui</file>
     <file preprocess="xml-stripblanks">ui/quit-dialog.ui</file>
     <file preprocess="xml-stripblanks">ui/remote-display.ui</file>
diff --git a/data/ui/preferences-switch-item.ui b/data/ui/preferences-switch-item.ui
new file mode 100644
index 0000000..0039e6f
--- /dev/null
+++ b/data/ui/preferences-switch-item.ui
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="GamesPreferencesSwitchItem" parent="GtkBox">
+    <property name="vexpand">false</property>
+    <property name="orientation">horizontal</property>
+    <property name="margin">6</property>
+    <property name="spacing">12</property>
+    <property name="visible">true</property>
+    <child>
+      <object class="GtkLabel" id="title_label">
+        <property name="visible">true</property>
+        <property name="vexpand">true</property>
+        <property name="wrap">true</property>
+      </object>
+    </child>
+    <child>
+      <object class="GtkImage" id="select_image">
+        <property name="icon-name">object-select-symbolic</property>
+        <property name="valign">center</property>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/Makefile.am b/src/Makefile.am
index c87572d..5aff69f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -117,6 +117,7 @@ gnome_games_SOURCES = \
        ui/preferences-page.vala \
        ui/preferences-page-plugins.vala \
        ui/preferences-page-plugins-item.vala \
+       ui/preferences-switch-item.vala \
        ui/preferences-window.vala \
        ui/quit-dialog.vala \
        ui/remote-display.vala \
diff --git a/src/ui/preferences-switch-item.vala b/src/ui/preferences-switch-item.vala
new file mode 100644
index 0000000..59ffb23
--- /dev/null
+++ b/src/ui/preferences-switch-item.vala
@@ -0,0 +1,21 @@
+// This file is part of GNOME Games. License: GPLv3
+
+[GtkTemplate (ui = "/org/gnome/Games/ui/preferences-switch-item.ui")]
+private class Games.PreferencesSwitchItem: Gtk.Box {
+       [GtkChild]
+       private Gtk.Label title_label;
+       [GtkChild]
+       private Gtk.Image select_image;
+
+       public PreferencesSwitchItem (string name) {
+               title_label.label = name;
+       }
+
+       public void switch_activate () {
+               select_image.show ();
+       }
+
+       public void switch_deactivate () {
+               select_image.hide ();
+       }
+}


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