transition: Check the repeat count to remove on complete

We can now ask the timeline for the current repeat, and if it's the last
one, then we can safely detach the transition from the animatable
instance.
This commit is contained in:
Emmanuele Bassi 2012-03-15 13:52:09 +00:00
parent 388f818f41
commit 514466601e

View File

@ -126,14 +126,21 @@ clutter_transition_completed (ClutterTimeline *timeline)
{
ClutterTransitionPrivate *priv = CLUTTER_TRANSITION (timeline)->priv;
if (priv->remove_on_complete &&
clutter_timeline_get_repeat_count (timeline) != 0)
if (priv->remove_on_complete)
{
int n_repeats, cur_repeat;
n_repeats = clutter_timeline_get_repeat_count (timeline);
cur_repeat = clutter_timeline_get_current_repeat (timeline);
if (n_repeats == 0 || cur_repeat == n_repeats)
{
clutter_transition_detach (CLUTTER_TRANSITION (timeline),
priv->animatable);
g_object_unref (timeline);
}
}
}
static void
clutter_transition_set_property (GObject *gobject,