[gnome-games/wip/exalm/libhandy4: 16/19] ui: Drop custom headerbars from preferences pages
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/libhandy4: 16/19] ui: Drop custom headerbars from preferences pages
- Date: Mon, 17 Sep 2018 17:59:51 +0000 (UTC)
commit 4d8e42bf2911dc722d150c13a9b9564f736d38ee
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Wed Sep 12 02:37:57 2018 +0500
ui: Drop custom headerbars from preferences pages
Since gamepad and keyboard preferences are now subpages, regular pages
don't need to have custom headerbars anymore, so use a single headerbar
and just set title when switching pages instead.
data/ui/preferences-page-controllers.ui | 5 -----
data/ui/preferences-page-plugins.ui | 5 -----
data/ui/preferences-page-video.ui | 5 -----
data/ui/preferences-window.ui | 8 ++++++++
src/ui/preferences-page-controllers.vala | 7 -------
src/ui/preferences-page-plugins.vala | 7 -------
src/ui/preferences-page-video.vala | 7 -------
src/ui/preferences-page.vala | 1 -
src/ui/preferences-window.vala | 26 ++++++++------------------
9 files changed, 16 insertions(+), 55 deletions(-)
---
diff --git a/data/ui/preferences-page-controllers.ui b/data/ui/preferences-page-controllers.ui
index 042ad8b6..c5d18374 100644
--- a/data/ui/preferences-page-controllers.ui
+++ b/data/ui/preferences-page-controllers.ui
@@ -68,9 +68,4 @@
</object>
</child>
</template>
- <object class="GtkHeaderBar" id="header_bar">
- <property name="visible">True</property>
- <property name="expand">True</property>
- <property name="title" translatable="yes">Controllers</property>
- </object>
</interface>
diff --git a/data/ui/preferences-page-plugins.ui b/data/ui/preferences-page-plugins.ui
index 3b6ba438..bda34acc 100644
--- a/data/ui/preferences-page-plugins.ui
+++ b/data/ui/preferences-page-plugins.ui
@@ -35,9 +35,4 @@
</object>
</child>
</template>
- <object class="GtkHeaderBar" id="header_bar">
- <property name="visible">True</property>
- <property name="expand">True</property>
- <property name="title" translatable="yes">Extensions</property>
- </object>
</interface>
diff --git a/data/ui/preferences-page-video.ui b/data/ui/preferences-page-video.ui
index a8d78cae..e700f5be 100644
--- a/data/ui/preferences-page-video.ui
+++ b/data/ui/preferences-page-video.ui
@@ -45,9 +45,4 @@
</object>
</child>
</template>
- <object class="GtkHeaderBar" id="header_bar">
- <property name="visible">True</property>
- <property name="expand">True</property>
- <property name="title" translatable="yes">Video</property>
- </object>
</interface>
diff --git a/data/ui/preferences-window.ui b/data/ui/preferences-window.ui
index c843d35b..3e10d978 100644
--- a/data/ui/preferences-window.ui
+++ b/data/ui/preferences-window.ui
@@ -36,6 +36,14 @@
</style>
</object>
</child>
+ <child>
+ <object class="GtkHeaderBar" id="right_header_bar">
+ <property name="name">right_header_bar</property>
+ <property name="visible">True</property>
+ <property name="hexpand">True</property>
+ <property name="show-close-button">True</property>
+ </object>
+ </child>
</object>
</child>
</object>
diff --git a/src/ui/preferences-page-controllers.vala b/src/ui/preferences-page-controllers.vala
index f5b3d18f..902d1420 100644
--- a/src/ui/preferences-page-controllers.vala
+++ b/src/ui/preferences-page-controllers.vala
@@ -2,13 +2,6 @@
[GtkTemplate (ui = "/org/gnome/Games/ui/preferences-page-controllers.ui")]
private class Games.PreferencesPageControllers: Gtk.Bin, PreferencesPage {
- [GtkChild (name = "header_bar")]
- private Gtk.HeaderBar _header_bar;
- public Gtk.HeaderBar header_bar {
- protected set {}
- get { return _header_bar; }
- }
-
public PreferencesSubpage subpage { get; protected set; }
[GtkChild]
diff --git a/src/ui/preferences-page-plugins.vala b/src/ui/preferences-page-plugins.vala
index f0bb2bbe..091b4021 100644
--- a/src/ui/preferences-page-plugins.vala
+++ b/src/ui/preferences-page-plugins.vala
@@ -2,13 +2,6 @@
[GtkTemplate (ui = "/org/gnome/Games/ui/preferences-page-plugins.ui")]
private class Games.PreferencesPagePlugins: Gtk.Bin, PreferencesPage {
- [GtkChild (name = "header_bar")]
- private Gtk.HeaderBar _header_bar;
- public Gtk.HeaderBar header_bar {
- get { return _header_bar; }
- protected set {}
- }
-
public PreferencesSubpage subpage { get; protected set; }
[GtkChild]
diff --git a/src/ui/preferences-page-video.vala b/src/ui/preferences-page-video.vala
index 11cc7710..0077428b 100644
--- a/src/ui/preferences-page-video.vala
+++ b/src/ui/preferences-page-video.vala
@@ -2,13 +2,6 @@
[GtkTemplate (ui = "/org/gnome/Games/ui/preferences-page-video.ui")]
private class Games.PreferencesPageVideo: Gtk.Bin, PreferencesPage {
- [GtkChild (name = "header_bar")]
- private Gtk.HeaderBar _header_bar;
- public Gtk.HeaderBar header_bar {
- protected set {}
- get { return _header_bar; }
- }
-
public PreferencesSubpage subpage { get; protected set; }
private string _filter_active;
diff --git a/src/ui/preferences-page.vala b/src/ui/preferences-page.vala
index e04e4f54..de44674e 100644
--- a/src/ui/preferences-page.vala
+++ b/src/ui/preferences-page.vala
@@ -1,6 +1,5 @@
// This file is part of GNOME Games. License: GPL-3.0+.
private interface Games.PreferencesPage: Gtk.Widget {
- public abstract Gtk.HeaderBar header_bar { get; protected set; }
public abstract PreferencesSubpage subpage { get; protected set; }
}
diff --git a/src/ui/preferences-window.vala b/src/ui/preferences-window.vala
index a4982f16..54d86c48 100644
--- a/src/ui/preferences-window.vala
+++ b/src/ui/preferences-window.vala
@@ -9,26 +9,14 @@ private class Games.PreferencesWindow : Gtk.Window {
[GtkChild]
private Gtk.Box titlebar_box;
[GtkChild]
+ private Gtk.HeaderBar right_header_bar;
+ [GtkChild]
private Gtk.Stack main_stack;
[GtkChild]
private Gtk.Box content_box;
[GtkChild]
private Gtk.Stack stack;
- private Gtk.HeaderBar _right_header_bar;
- public Gtk.HeaderBar right_header_bar {
- get { return _right_header_bar; }
- set {
- if (_right_header_bar != null)
- titlebar_box.remove (_right_header_bar);
- if (value != null) {
- titlebar_box.pack_end (value);
- value.show_close_button = true;
- }
- _right_header_bar = value;
- }
- }
-
private PreferencesSubpage _subpage;
public PreferencesSubpage subpage {
get { return _subpage; }
@@ -64,7 +52,6 @@ private class Games.PreferencesWindow : Gtk.Window {
// The previous subpage instance must be kept around during the transition
private PreferencesSubpage previous_subpage;
- private Binding right_header_bar_binding;
private Binding subpage_binding;
private Binding selection_mode_binding;
@@ -76,13 +63,16 @@ private class Games.PreferencesWindow : Gtk.Window {
private void visible_child_changed () {
var page = stack.visible_child as PreferencesPage;
if (page == null) {
- right_header_bar = null;
+ right_header_bar.title = "";
subpage = null;
return;
}
- right_header_bar_binding = page.bind_property ("header-bar", this, "right_header_bar",
- BindingFlags.SYNC_CREATE);
+
+ var title = "";
+ stack.child_get (page, "title", out title, null);
+ right_header_bar.title = 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]