[libhandy/wip/haecker-felix/flap-widget] Switch child
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy/wip/haecker-felix/flap-widget] Switch child
- Date: Tue, 17 Nov 2020 14:53:52 +0000 (UTC)
commit 16af1d1b5be7093833435fcdb531a12e449c2256
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Tue Nov 17 18:07:18 2020 +0500
Switch child
src/hdy-flap.c | 48 +++++++++++++++++++++++++++++-------------------
1 file changed, 29 insertions(+), 19 deletions(-)
---
diff --git a/src/hdy-flap.c b/src/hdy-flap.c
index 5d5702eb..160e805d 100644
--- a/src/hdy-flap.c
+++ b/src/hdy-flap.c
@@ -241,6 +241,29 @@ set_folded (HdyFlap *self,
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_FOLDED]);
}
+static void
+set_reveal_flap (HdyFlap *self,
+ gboolean reveal_flap,
+ guint64 duration,
+ gboolean emit_child_switched)
+{
+ gboolean is_end;
+
+ reveal_flap = !!reveal_flap;
+
+ if (self->reveal_flap == reveal_flap)
+ return;
+
+ self->reveal_flap = reveal_flap;
+
+ animate_reveal (self, reveal_flap ? 1 : 0, duration);
+
+ is_end = self->flap_position == GTK_PACK_END;
+ hdy_swipeable_emit_child_switched (HDY_SWIPEABLE (self), (is_end == reveal_flap) ? 1 : 0, duration);
+
+ g_object_notify_by_pspec (G_OBJECT (self), props[PROP_REVEAL_FLAP]);
+}
+
static gint
get_flap_size (HdyFlap *self,
GtkAllocation *widget_alloc,
@@ -907,8 +930,12 @@ hdy_flap_init (HdyFlap *self)
static void
hdy_flap_switch_child (HdySwipeable *swipeable,
guint index,
- guint64 duration)
+ gint64 duration)
{
+ HdyFlap *self = HDY_FLAP (swipeable);
+ gboolean is_end = self->flap_position == GTK_PACK_END;
+
+ set_reveal_flap (self, is_end == (index > 0), duration, FALSE);
}
static HdySwipeTracker *
@@ -1162,14 +1189,6 @@ hdy_flap_get_reveal_flap (HdyFlap *self)
return self->reveal_flap;
}
-static void
-set_reveal_flap (HdyFlap *self,
- gboolean reveal_flap,
- guint64 duration)
-{
-
-}
-
/**
* hdy_flap_set_reveal_flap:
* @self: a #HdyFlap
@@ -1183,16 +1202,7 @@ hdy_flap_set_reveal_flap (HdyFlap *self,
{
g_return_if_fail (HDY_IS_FLAP (self));
- reveal_flap = !!reveal_flap;
-
- if (self->reveal_flap == reveal_flap)
- return;
-
- self->reveal_flap = reveal_flap;
-
- animate_reveal (self, reveal_flap ? 1 : 0, self->reveal_duration);
-
- g_object_notify_by_pspec (G_OBJECT (self), props[PROP_REVEAL_FLAP]);
+ set_reveal_flap (self, reveal_flap, self->reveal_duration, TRUE);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]