[gnome-games/wip/exalm/libhandy2: 1/9] ui: Add subpage transition for PreferencesWindow
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/libhandy2: 1/9] ui: Add subpage transition for PreferencesWindow
- Date: Wed, 12 Sep 2018 12:46:34 +0000 (UTC)
commit a09f22066a8e65b1351fd3c8c9d8ddc3d79a43a4
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Wed Sep 12 13:13:59 2018 +0500
ui: Add subpage transition for PreferencesWindow
Also keep previous subpage around during the transition, and only remove
it after it has finished.
data/ui/preferences-window.ui | 3 +++
src/ui/preferences-window.vala | 16 +++++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/data/ui/preferences-window.ui b/data/ui/preferences-window.ui
index e5f50fbb..0b9e4c3e 100644
--- a/data/ui/preferences-window.ui
+++ b/data/ui/preferences-window.ui
@@ -10,6 +10,7 @@
<child type="titlebar">
<object class="GtkStack" id="titlebar_stack">
<property name="visible">True</property>
+ <property name="transition-type">GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT</property>
<child>
<object class="GtkBox" id="titlebar_box">
<property name="visible">True</property>
@@ -43,6 +44,8 @@
<child>
<object class="GtkStack" id="main_stack">
<property name="visible">True</property>
+ <property name="transition-type">GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT</property>
+ <signal name="notify::transition-running" handler="subpage_transition_finished"/>
<child>
<object class="GtkBox" id="content_box">
<property name="visible">True</property>
diff --git a/src/ui/preferences-window.vala b/src/ui/preferences-window.vala
index 0698d2d6..904544a9 100644
--- a/src/ui/preferences-window.vala
+++ b/src/ui/preferences-window.vala
@@ -15,6 +15,8 @@ private class Games.PreferencesWindow : Gtk.Window {
[GtkChild]
private Gtk.Stack stack;
+ private PreferencesSubpage previous_subpage;
+
private PreferencesSubpage _subpage;
public PreferencesSubpage subpage {
get { return _subpage; }
@@ -23,11 +25,9 @@ private class Games.PreferencesWindow : Gtk.Window {
return;
if (subpage != null) {
+ previous_subpage = subpage;
main_stack.visible_child = content_box;
titlebar_stack.visible_child = titlebar_box;
-
- main_stack.remove (subpage);
- titlebar_stack.remove (subpage.header_bar);
}
if (value != null) {
@@ -67,4 +67,14 @@ private class Games.PreferencesWindow : Gtk.Window {
subpage_binding = page.bind_property ("subpage", this, "subpage",
BindingFlags.SYNC_CREATE);
}
+
+ [GtkCallback]
+ public void subpage_transition_finished (Object object, ParamSpec param) {
+ if (main_stack.transition_running || previous_subpage == null)
+ return;
+
+ main_stack.remove (previous_subpage);
+ titlebar_stack.remove (previous_subpage.header_bar);
+ previous_subpage = null;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]