[libhandy] swipe-tracker: Add update-swipe signal
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy] swipe-tracker: Add update-swipe signal
- Date: Fri, 26 Jun 2020 12:11:07 +0000 (UTC)
commit a2cf3709e32f83e0106784d913823af6f286c876
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sat Jun 20 16:51:24 2020 +0500
swipe-tracker: Add update-swipe signal
This will replace HdySwipeable's signal and at the same time allow
swipeables to connect to it instead of overriding update_swipe() there,
making it clear the 2 classes are closely related and are only meant to be
used together.
Signed-off-by: Alexander Mikhaylenko <alexm gnome org>
src/hdy-swipe-tracker-private.h | 2 ++
src/hdy-swipe-tracker.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
---
diff --git a/src/hdy-swipe-tracker-private.h b/src/hdy-swipe-tracker-private.h
index 8d364a0d..9faad4cf 100644
--- a/src/hdy-swipe-tracker-private.h
+++ b/src/hdy-swipe-tracker-private.h
@@ -41,5 +41,7 @@ void hdy_swipe_tracker_shift_position (HdySwipeTracker *self,
void hdy_swipe_tracker_emit_begin_swipe (HdySwipeTracker *self,
HdyNavigationDirection direction,
gboolean direct);
+void hdy_swipe_tracker_emit_update_swipe (HdySwipeTracker *self,
+ gdouble progress);
G_END_DECLS
diff --git a/src/hdy-swipe-tracker.c b/src/hdy-swipe-tracker.c
index f704ac73..7afee98e 100644
--- a/src/hdy-swipe-tracker.c
+++ b/src/hdy-swipe-tracker.c
@@ -92,6 +92,7 @@ static GParamSpec *props[LAST_PROP];
enum {
SIGNAL_BEGIN_SWIPE,
+ SIGNAL_UPDATE_SWIPE,
SIGNAL_LAST_SIGNAL,
};
@@ -175,6 +176,7 @@ gesture_update (HdySwipeTracker *self,
self->progress = progress;
hdy_swipeable_update_swipe (self->swipeable, progress);
+ hdy_swipe_tracker_emit_update_swipe (self, progress);
self->prev_time = time;
}
@@ -771,6 +773,25 @@ hdy_swipe_tracker_class_init (HdySwipeTrackerClass *klass)
G_TYPE_NONE,
2,
HDY_TYPE_NAVIGATION_DIRECTION, G_TYPE_BOOLEAN);
+
+ /**
+ * HdySwipeTracker::update-swipe:
+ * @self: The #HdySwipeTracker instance
+ * @progress: The current animation progress value
+ *
+ * This signal is emitted every time the progress value changes.
+ *
+ * Since: 1.0
+ */
+ signals[SIGNAL_UPDATE_SWIPE] =
+ g_signal_new ("update-swipe",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL, NULL,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_DOUBLE);
}
static void
@@ -986,3 +1007,12 @@ hdy_swipe_tracker_emit_begin_swipe (HdySwipeTracker *self,
g_signal_emit (self, signals[SIGNAL_BEGIN_SWIPE], 0, direction, direct);
}
+
+void
+hdy_swipe_tracker_emit_update_swipe (HdySwipeTracker *self,
+ gdouble progress)
+{
+ g_return_if_fail (HDY_IS_SWIPE_TRACKER (self));
+
+ g_signal_emit (self, signals[SIGNAL_UPDATE_SWIPE], 0, progress);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]