[gnome-games/wip/exalm/libhandy: 5/8] preferences-window: Use extra boxes for subpage
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/libhandy: 5/8] preferences-window: Use extra boxes for subpage
- Date: Wed, 26 Feb 2020 19:14:30 +0000 (UTC)
commit 39f22245cb4ce9b1052176e1a4d5d6e1f0e11249
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Tue Feb 25 23:14:41 2020 +0500
preferences-window: Use extra boxes for subpage
Instead of modifying stacks on the fly, have placeholder boxes. This will
avoid problems down the line.
data/ui/preferences-window.ui | 11 +++++++++++
src/ui/preferences-window.vala | 16 ++++++++++------
2 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/data/ui/preferences-window.ui b/data/ui/preferences-window.ui
index 6bfefa1f..29068bca 100644
--- a/data/ui/preferences-window.ui
+++ b/data/ui/preferences-window.ui
@@ -96,6 +96,11 @@
</child>
</object>
</child>
+ <child>
+ <object class="GtkBox" id="titlebar_subpage_box">
+ <property name="visible">True</property>
+ </object>
+ </child>
</object>
</child>
</object>
@@ -163,6 +168,12 @@
</child>
</object>
</child>
+ <child>
+ <object class="GtkBox" id="content_subpage_box">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ </object>
+ </child>
</object>
</child>
</template>
diff --git a/src/ui/preferences-window.vala b/src/ui/preferences-window.vala
index ccda289d..26b5b926 100644
--- a/src/ui/preferences-window.vala
+++ b/src/ui/preferences-window.vala
@@ -9,12 +9,16 @@ private class Games.PreferencesWindow : Gtk.Window {
[GtkChild]
private Hdy.Leaflet titlebar_box;
[GtkChild]
+ private Gtk.Box titlebar_subpage_box;
+ [GtkChild]
private Gtk.HeaderBar right_header_bar;
[GtkChild]
private Gtk.Stack main_stack;
[GtkChild]
private Hdy.Leaflet content_box;
[GtkChild]
+ private Gtk.Box content_subpage_box;
+ [GtkChild]
private PreferencesSidebar sidebar;
[GtkChild]
private Gtk.Stack stack;
@@ -42,15 +46,15 @@ private class Games.PreferencesWindow : Gtk.Window {
if (value != null) {
var header_bar = value.header_bar;
- main_stack.add (value);
- main_stack.visible_child = value;
+ content_subpage_box.add (value);
+ main_stack.visible_child = content_subpage_box;
selection_mode_binding = value.bind_property ("request-selection-mode",
titlebar, "selection-mode",
BindingFlags.SYNC_CREATE);
- titlebar_stack.add (header_bar);
- titlebar_stack.visible_child = header_bar;
+ titlebar_subpage_box.add (header_bar);
+ titlebar_stack.visible_child = titlebar_subpage_box;
content_box.navigate (Hdy.NavigationDirection.FORWARD);
}
@@ -96,8 +100,8 @@ private class Games.PreferencesWindow : Gtk.Window {
if (main_stack.transition_running || previous_subpage == null)
return;
- main_stack.remove (previous_subpage);
- titlebar_stack.remove (previous_subpage.header_bar);
+ content_subpage_box.remove (previous_subpage);
+ titlebar_subpage_box.remove (previous_subpage.header_bar);
previous_subpage = null;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]