[libhandy] preferences-window: Fix subpage removal with disabled animations
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy] preferences-window: Fix subpage removal with disabled animations
- Date: Wed, 29 Jul 2020 15:14:11 +0000 (UTC)
commit 085a8c8f5b7f8c8b26a526a560fcb730a559cde4
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Wed Jul 29 14:02:09 2020 +0500
preferences-window: Fix subpage removal with disabled animations
The current HdyDeck API is weird and confusing and it's very easy to get it
wrong. In particular, the transition-running property doesn't change its
values if animations are disabled, so you need to also track visible-child
changes.
Signed-off-by: Alexander Mikhaylenko <alexm gnome org>
src/hdy-preferences-window.c | 15 ++++++++++++++-
src/hdy-preferences-window.ui | 1 +
2 files changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/src/hdy-preferences-window.c b/src/hdy-preferences-window.c
index c5d73774..81bb7ba0 100644
--- a/src/hdy-preferences-window.c
+++ b/src/hdy-preferences-window.c
@@ -232,7 +232,7 @@ key_press_event_cb (GtkWidget *sender,
}
static void
-subpages_deck_transition_running_cb (HdyPreferencesWindow *self)
+try_remove_subpages (HdyPreferencesWindow *self)
{
HdyPreferencesWindowPrivate *priv = hdy_preferences_window_get_instance_private (self);
@@ -249,6 +249,18 @@ subpages_deck_transition_running_cb (HdyPreferencesWindow *self)
priv->subpage = NULL;
}
+static void
+subpages_deck_transition_running_cb (HdyPreferencesWindow *self)
+{
+ try_remove_subpages (self);
+}
+
+static void
+subpages_deck_visible_child_cb (HdyPreferencesWindow *self)
+{
+ try_remove_subpages (self);
+}
+
static void
header_bar_size_allocate_cb (HdyPreferencesWindow *self,
GdkRectangle *allocation)
@@ -500,6 +512,7 @@ hdy_preferences_window_class_init (HdyPreferencesWindowClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, HdyPreferencesWindow, view_switcher_bar);
gtk_widget_class_bind_template_child_private (widget_class, HdyPreferencesWindow, view_switcher_title);
gtk_widget_class_bind_template_callback (widget_class, subpages_deck_transition_running_cb);
+ gtk_widget_class_bind_template_callback (widget_class, subpages_deck_visible_child_cb);
gtk_widget_class_bind_template_callback (widget_class, header_bar_size_allocate_cb);
gtk_widget_class_bind_template_callback (widget_class, title_stack_notify_transition_running_cb);
gtk_widget_class_bind_template_callback (widget_class, title_stack_notify_visible_child_cb);
diff --git a/src/hdy-preferences-window.ui b/src/hdy-preferences-window.ui
index 600ebbbe..ccc96fa0 100644
--- a/src/hdy-preferences-window.ui
+++ b/src/hdy-preferences-window.ui
@@ -14,6 +14,7 @@
<property name="can-swipe-back" bind-source="HdyPreferencesWindow" bind-property="can-swipe-back"
bind-flags="sync-create"/>
<property name="visible">True</property>
<signal name="notify::transition-running" handler="subpages_deck_transition_running_cb"
swapped="yes"/>
+ <signal name="notify::visible-child" handler="subpages_deck_visible_child_cb" swapped="yes"/>
<child>
<object class="GtkBox" id="preferences">
<property name="visible">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]