enum
{
+ STARTED,
COMPLETED,
LAST_SIGNAL
guint loop : 1;
guint duration;
+
ClutterTimeline *timeline;
+ guint timeline_started_id;
guint timeline_completed_id;
ClutterAlpha *alpha;
if (priv->timeline)
{
+ if (priv->timeline_started_id)
+ {
+ g_signal_handler_disconnect (priv->timeline,
+ priv->timeline_started_id);
+ priv->timeline_started_id = 0;
+ }
+
if (priv->timeline_completed_id)
{
g_signal_handler_disconnect (priv->timeline,
g_object_class_install_property (gobject_class, PROP_ALPHA, pspec);
/**
+ * ClutterAnimation::started:
+ * @animation: the animation that emitted the signal
+ *
+ * The ::started signal is emitted once the animation has been
+ * started
+ *
+ * Since: 1.0
+ */
+ animation_signals[STARTED] =
+ g_signal_new (I_("started"),
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ClutterAnimationClass, started),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ /**
* ClutterAniamtion::completed:
* @animation: the animation that emitted the signal
*
}
static void
+on_timeline_started (ClutterTimeline *timeline,
+ ClutterAnimation *animation)
+{
+ g_signal_emit (animation, animation_signals[STARTED], 0);
+}
+
+static void
on_timeline_completed (ClutterTimeline *timeline,
ClutterAnimation *animation)
{
if (priv->timeline)
{
+ if (priv->timeline_started_id)
+ g_signal_handler_disconnect (priv->timeline,
+ priv->timeline_started_id);
+
if (priv->timeline_completed_id)
g_signal_handler_disconnect (priv->timeline,
priv->timeline_completed_id);
g_object_unref (priv->timeline);
+ priv->timeline_started_id = 0;
priv->timeline_completed_id = 0;
priv->timeline = 0;
}
priv->timeline = g_object_ref (timeline);
g_object_notify (G_OBJECT (animation), "timeline");
+ priv->timeline_started_id =
+ g_signal_connect (timeline, "started",
+ G_CALLBACK (on_timeline_started),
+ animation);
priv->timeline_completed_id =
g_signal_connect (timeline, "completed",
G_CALLBACK (on_timeline_completed),
GValue final = { 0, };
gchar *error = NULL;
- if (G_UNLIKELY (g_str_equal (property_name, "signal::completed")))
+ if (g_str_has_prefix (property_name, "signal::"))
{
+ const gchar *signal_name = property_name + 8;
GCallback callback = va_arg (var_args, GCallback);
gpointer userdata = va_arg (var_args, gpointer);
- g_signal_connect (animation, "completed", callback, userdata);
+ g_signal_connect (animation, signal_name, callback, userdata);
}
else
{
*
* If a name argument starts with "signal::" the two following arguments
* are used as callback function and userdata for a signal handler installed
- * on the #ClutterAnimation object, for instance:
+ * on the #ClutterAnimation object for the specified signal name, for
+ * instance:
*
* |[
*
* This is the vector-based variant of clutter_actor_animate(), useful
* for language bindings.
*
+ * <warning>Unlike clutter_actor_animate(), this function will not
+ * allow you to specify "signal::" names and callbacks.</warning>
+ *
* Return value: (transfer none): a #ClutterAnimation object. The object is
* owned by the #ClutterActor and should not be unreferenced with
* g_object_unref()
* This is the vector-based variant of clutter_actor_animate_with_timeline(),
* useful for language bindings.
*
+ * <warning>Unlike clutter_actor_animate_with_timeline(), this function
+ * will not allow you to specify "signal::" names and callbacks.</warning>
+ *
* Return value: (transfer none): a #ClutterAnimation object. The object is
* owned by the #ClutterActor and should not be unreferenced with
* g_object_unref()
* This is the vector-based variant of clutter_actor_animate_with_alpha(),
* useful for language bindings.
*
+ * <warning>Unlike clutter_actor_animate_with_alpha(), this function will
+ * not allow you to specify "signal::" names and callbacks.</warning>
+ *
* Return value: (transfer none): a #ClutterAnimation object. The object is owned by the
* #ClutterActor and should not be unreferenced with g_object_unref()
*