[libadwaita/wip/exalm/new-glib: 7/16] carousel: Clean up scroll timer
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/wip/exalm/new-glib: 7/16] carousel: Clean up scroll timer
- Date: Wed, 3 Nov 2021 00:41:29 +0000 (UTC)
commit c41391701ae3b3ce7a52290efee52e11f0b785ae
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Tue Nov 2 18:16:59 2021 +0500
carousel: Clean up scroll timer
I wanted to replace the construction in dispose() with g_clear_handle_id(),
but turns out it was also unused and had a wrong type.
src/adw-carousel.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/src/adw-carousel.c b/src/adw-carousel.c
index 087daac0..6a017cdc 100644
--- a/src/adw-carousel.c
+++ b/src/adw-carousel.c
@@ -72,7 +72,7 @@ struct _AdwCarousel
double position_shift;
- gulong scroll_timeout_id;
+ guint scroll_timeout_id;
gboolean can_scroll;
};
@@ -541,7 +541,8 @@ scroll_cb (AdwCarousel *self,
duration = MIN (self->animation_duration, DEFAULT_DURATION);
self->can_scroll = FALSE;
- g_timeout_add (duration, (GSourceFunc) scroll_timeout_cb, self);
+ self->scroll_timeout_id =
+ g_timeout_add (duration, (GSourceFunc) scroll_timeout_cb, self);
return GDK_EVENT_STOP;
}
@@ -735,11 +736,7 @@ adw_carousel_dispose (GObject *object)
AdwCarousel *self = ADW_CAROUSEL (object);
g_clear_object (&self->tracker);
-
- if (self->scroll_timeout_id != 0) {
- g_source_remove (self->scroll_timeout_id);
- self->scroll_timeout_id = 0;
- }
+ g_clear_handle_id (&self->scroll_timeout_id, g_source_remove);
G_OBJECT_CLASS (adw_carousel_parent_class)->dispose (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]