clutter/timeline: Use a function to cancel the delay timeout

Avoid repeating the same code for canceling the delay timeout, using a
function for later uses.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/805
This commit is contained in:
Marco Trevisan (Treviño) 2019-09-20 16:13:03 +02:00
parent 031003a5dc
commit 63a0b702c9

View File

@ -424,6 +424,11 @@ clutter_timeline_set_custom_property (ClutterScriptable *scriptable,
g_object_set_property (G_OBJECT (scriptable), name, value); g_object_set_property (G_OBJECT (scriptable), name, value);
} }
static void
clutter_timeline_cancel_delay (ClutterTimeline *timeline)
{
g_clear_handle_id (&timeline->priv->delay_id, g_source_remove);
}
static void static void
clutter_scriptable_iface_init (ClutterScriptableIface *iface) clutter_scriptable_iface_init (ClutterScriptableIface *iface)
@ -550,11 +555,7 @@ clutter_timeline_dispose (GObject *object)
priv = self->priv; priv = self->priv;
if (priv->delay_id) clutter_timeline_cancel_delay (self);
{
g_source_remove (priv->delay_id);
priv->delay_id = 0;
}
if (priv->progress_notify != NULL) if (priv->progress_notify != NULL)
{ {
@ -1216,11 +1217,7 @@ clutter_timeline_pause (ClutterTimeline *timeline)
if (priv->delay_id == 0 && !priv->is_playing) if (priv->delay_id == 0 && !priv->is_playing)
return; return;
if (priv->delay_id) clutter_timeline_cancel_delay (timeline);
{
g_source_remove (priv->delay_id);
priv->delay_id = 0;
}
priv->msecs_delta = 0; priv->msecs_delta = 0;
set_is_playing (timeline, FALSE); set_is_playing (timeline, FALSE);