[gnome-games/wip/exalm/libhandy2: 9/9] 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/libhandy2: 9/9] ui: Drop custom headerbars from preferences pages
- Date: Wed, 12 Sep 2018 11:54:13 +0000 (UTC)
commit e9b670d8bf3b2517d57b1063bc263915b22792b7
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Wed Sep 12 02:37:57 2018 +0500
ui: Drop custom headerbars from preferences pages
Just set title 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 486d9582..f0fe2fd8 100644
--- a/data/ui/preferences-page-controllers.ui
+++ b/data/ui/preferences-page-controllers.ui
@@ -67,9 +67,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 e135a45e..90c0eb61 100644
--- a/data/ui/preferences-page-plugins.ui
+++ b/data/ui/preferences-page-plugins.ui
@@ -34,9 +34,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 3f0c038e..e3c1dde5 100644
--- a/data/ui/preferences-page-video.ui
+++ b/data/ui/preferences-page-video.ui
@@ -44,9 +44,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 f5becdf0..e5f50fbb 100644
--- a/data/ui/preferences-window.ui
+++ b/data/ui/preferences-window.ui
@@ -28,6 +28,14 @@
<property name="visible">True</property>
</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 12c86f77..0698d2d6 100644
--- a/src/ui/preferences-window.vala
+++ b/src/ui/preferences-window.vala
@@ -7,26 +7,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; }
@@ -56,7 +44,6 @@ private class Games.PreferencesWindow : Gtk.Window {
}
}
- private Binding right_header_bar_binding;
private Binding subpage_binding;
public PreferencesWindow () {
@@ -67,13 +54,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]