[libhandy] swipeable: Remove default get_snap_points() implementation
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy] swipeable: Remove default get_snap_points() implementation
- Date: Tue, 30 Jun 2020 15:11:17 +0000 (UTC)
commit f0e56fcb9981abb6f7f23bc65f20eef87029f537
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sun Jun 28 20:02:16 2020 +0500
swipeable: Remove default get_snap_points() implementation
Make it mandatory.
Signed-off-by: Alexander Mikhaylenko <alexm gnome org>
src/hdy-swipeable.c | 30 ++----------------------------
1 file changed, 2 insertions(+), 28 deletions(-)
---
diff --git a/src/hdy-swipeable.c b/src/hdy-swipeable.c
index c854365d..d0bd6841 100644
--- a/src/hdy-swipeable.c
+++ b/src/hdy-swipeable.c
@@ -156,27 +156,6 @@ hdy_swipeable_get_range (HdySwipeable *self,
(* iface->get_range) (self, lower, upper);
}
-static gdouble *
-get_snap_points_from_range (HdySwipeable *self,
- gint *n_snap_points)
-{
- gint n;
- gdouble *points, lower, upper;
-
- hdy_swipeable_get_range (self, &lower, &upper);
-
- n = (lower != upper) ? 2 : 1;
-
- points = g_new0 (gdouble, n);
- points[0] = lower;
- points[n - 1] = upper;
-
- if (n_snap_points)
- *n_snap_points = n;
-
- return points;
-}
-
/**
* hdy_swipeable_get_snap_points: (virtual get_snap_points)
* @self: a #HdySwipeable
@@ -185,9 +164,6 @@ get_snap_points_from_range (HdySwipeable *self,
* Gets the snap points of @self. Each snap point represents a progress value
* that is considered acceptable to end the swipe on.
*
- * If not implemented, the default implementation returns one snap point for
- * each end of the range, or just one snap point if they are equal.
- *
* Returns: (array length=n_snap_points) (transfer full): the snap points of
* @self. The array must be freed with g_free().
*
@@ -202,11 +178,9 @@ hdy_swipeable_get_snap_points (HdySwipeable *self,
g_return_val_if_fail (HDY_IS_SWIPEABLE (self), NULL);
iface = HDY_SWIPEABLE_GET_IFACE (self);
+ g_return_val_if_fail (iface->get_snap_points != NULL, NULL);
- if (iface->get_snap_points)
- return (* iface->get_snap_points) (self, n_snap_points);
-
- return get_snap_points_from_range (self, n_snap_points);
+ return (* iface->get_snap_points) (self, n_snap_points);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]