[gnome-games/wip/exalm/libhandy2: 1/8] preferences-page: Add 'title' property



commit 45fc1284107bb724268fefd45e45f92f80d81a38
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Wed Sep 19 01:32:29 2018 +0500

    preferences-page: Add 'title' property
    
    This will be used in subsequent commits to allow creating pages
    dynamically.

 src/ui/preferences-page-controllers.vala | 4 ++++
 src/ui/preferences-page-plugins.vala     | 4 ++++
 src/ui/preferences-page-video.vala       | 4 ++++
 src/ui/preferences-page.vala             | 1 +
 src/ui/preferences-window.vala           | 4 +---
 5 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/ui/preferences-page-controllers.vala b/src/ui/preferences-page-controllers.vala
index 902d1420..30cfe95f 100644
--- a/src/ui/preferences-page-controllers.vala
+++ b/src/ui/preferences-page-controllers.vala
@@ -4,6 +4,10 @@
 private class Games.PreferencesPageControllers: Gtk.Bin, PreferencesPage {
        public PreferencesSubpage subpage { get; protected set; }
 
+       public string title {
+               get { return _("Controllers"); }
+       }
+
        [GtkChild]
        private Gtk.Label gamepads_label;
        [GtkChild]
diff --git a/src/ui/preferences-page-plugins.vala b/src/ui/preferences-page-plugins.vala
index 091b4021..28880efb 100644
--- a/src/ui/preferences-page-plugins.vala
+++ b/src/ui/preferences-page-plugins.vala
@@ -4,6 +4,10 @@
 private class Games.PreferencesPagePlugins: Gtk.Bin, PreferencesPage {
        public PreferencesSubpage subpage { get; protected set; }
 
+       public string title {
+               get { return _("Extensions"); }
+       }
+
        [GtkChild]
        private Gtk.ListBox list_box;
 
diff --git a/src/ui/preferences-page-video.vala b/src/ui/preferences-page-video.vala
index 0077428b..804a43a3 100644
--- a/src/ui/preferences-page-video.vala
+++ b/src/ui/preferences-page-video.vala
@@ -4,6 +4,10 @@
 private class Games.PreferencesPageVideo: Gtk.Bin, PreferencesPage {
        public PreferencesSubpage subpage { get; protected set; }
 
+       public string title {
+               get { return _("Video"); }
+       }
+
        private string _filter_active;
        public string filter_active {
                set {
diff --git a/src/ui/preferences-page.vala b/src/ui/preferences-page.vala
index de44674e..508adea4 100644
--- a/src/ui/preferences-page.vala
+++ b/src/ui/preferences-page.vala
@@ -2,4 +2,5 @@
 
 private interface Games.PreferencesPage: Gtk.Widget {
        public abstract PreferencesSubpage subpage { get; protected set; }
+       public abstract string title { get; }
 }
diff --git a/src/ui/preferences-window.vala b/src/ui/preferences-window.vala
index 54d86c48..46695cf7 100644
--- a/src/ui/preferences-window.vala
+++ b/src/ui/preferences-window.vala
@@ -69,9 +69,7 @@ private class Games.PreferencesWindow : Gtk.Window {
                        return;
                }
 
-               var title = "";
-               stack.child_get (page, "title", out title, null);
-               right_header_bar.title = title;
+               right_header_bar.title = page.title;
 
                subpage_binding = page.bind_property ("subpage", this, "subpage",
                                                      BindingFlags.SYNC_CREATE);


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