[gnome-games] preferences-window: Correctly remove subpage with disabled animations
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] preferences-window: Correctly remove subpage with disabled animations
- Date: Sun, 22 Mar 2020 16:47:27 +0000 (UTC)
commit 1ce0734313bd7714fb45ce58189bdbf0a816beef
Author: Neville <nevilleantony98 gmail com>
Date: Wed Mar 18 15:09:49 2020 +0530
preferences-window: Correctly remove subpage with disabled animations
Currently, when animations are disabled, the subpage is not removed, since
HdyDeck's transition-running property value never changes. To mitigate this,
also track visible-child.
data/ui/preferences-window.ui | 1 +
src/ui/preferences-window.vala | 22 +++++++++++++++++-----
2 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/data/ui/preferences-window.ui b/data/ui/preferences-window.ui
index 2a6ca3d1..eee9a4f0 100644
--- a/data/ui/preferences-window.ui
+++ b/data/ui/preferences-window.ui
@@ -108,6 +108,7 @@
<property name="visible">True</property>
<property name="can-swipe-back" bind-source="titlebar" bind-property="selection-mode"
bind-flags="sync-create|invert-boolean"/>
<signal name="notify::transition-running" handler="subpage_transition_finished"/>
+ <signal name="notify::visible-child" handler="on_visible_child_changed"/>
<child>
<object class="HdyLeaflet" id="content_leaflet">
<property name="visible">True</property>
diff --git a/src/ui/preferences-window.vala b/src/ui/preferences-window.vala
index 41edf6f9..ef42144a 100644
--- a/src/ui/preferences-window.vala
+++ b/src/ui/preferences-window.vala
@@ -92,19 +92,31 @@ private class Games.PreferencesWindow : Gtk.Window {
BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
}
+ private void remove_subpage () {
+ foreach (var child in content_subpage_box.get_children ())
+ content_subpage_box.remove (child);
+
+ foreach (var child in titlebar_subpage_box.get_children ())
+ titlebar_subpage_box.remove (child);
+
+ subpage = null;
+ }
+
[GtkCallback]
public void subpage_transition_finished (Object object, ParamSpec param) {
if (content_deck.transition_running ||
content_deck.visible_child != content_leaflet)
return;
- foreach (var child in content_subpage_box.get_children ())
- content_subpage_box.remove (child);
+ remove_subpage ();
+ }
- foreach (var child in titlebar_subpage_box.get_children ())
- titlebar_subpage_box.remove (child);
+ [GtkCallback]
+ private void on_visible_child_changed () {
+ if (content_deck.transition_running || subpage == null)
+ return;
- subpage = null;
+ remove_subpage ();
}
[GtkCallback]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]