[clutter/wip/apocalypses/apocalypse-6: 13/17] transition: Check the repeat count to remove on complete



commit 514466601e93421fad985975c7a1938452a60188
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Mar 15 13:52:09 2012 +0000

    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.

 clutter/clutter-transition.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/clutter/clutter-transition.c b/clutter/clutter-transition.c
index e2710c2..70d9c51 100644
--- a/clutter/clutter-transition.c
+++ b/clutter/clutter-transition.c
@@ -126,12 +126,19 @@ 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)
     {
-      clutter_transition_detach (CLUTTER_TRANSITION (timeline),
-                                 priv->animatable);
-      g_object_unref (timeline);
+      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);
+        }
     }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]