[animation] Add Animation getter
authorEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 16 Mar 2009 11:31:27 +0000 (11:31 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 16 Mar 2009 12:13:55 +0000 (12:13 +0000)
If we are animating an actor using the clutter_actor_animate*() family
of functions we might want to expose a getter for the Animation instance
we are using, to avoid excessing bookkeeping.

clutter/clutter-animation.c
clutter/clutter-animation.h

index c585df3..865e7ad 100644 (file)
@@ -1816,3 +1816,22 @@ clutter_actor_animate_with_alphav (ClutterActor        *actor,
 
   return animation;
 }
+
+/**
+ * clutter_actor_get_animation:
+ * @actor: a #ClutterActor
+ *
+ * Retrieves the #ClutterAnimation used by @actor, if clutter_actor_animate()
+ * has been called on @actor.
+ *
+ * Return value: (transfer none): a #ClutterAnimation, or %NULL
+ *
+ * Since: 1.0
+ */
+ClutterAnimation *
+clutter_actor_get_animation (ClutterActor *actor)
+{
+  g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
+
+  return g_object_get_qdata (G_OBJECT (actor), quark_object_animation);
+}
index 5cfe8e4..1660bfc 100644 (file)
@@ -163,6 +163,8 @@ ClutterAnimation *   clutter_actor_animate_with_alphav    (ClutterActor
                                                            const gchar * const   properties[],
                                                            const GValue         *values);
 
+ClutterAnimation *   clutter_actor_get_animation          (ClutterActor         *actor);
+
 G_END_DECLS
 
 #endif /* __CLUTTER_ANIMATION_H__ */