mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 08:30:42 -05:00
[animation] add varargs support for signal::completed
Added support for registering a handler for the completed signal directly amongst the varargs making it easier to attach code to be executed when animations complete.
This commit is contained in:
parent
a1a8193179
commit
f6d938a0db
@ -1421,6 +1421,15 @@ clutter_animation_setup_valist (ClutterAnimation *animation,
|
||||
GValue final = { 0, };
|
||||
gchar *error = NULL;
|
||||
|
||||
if (G_UNLIKELY (g_str_equal (property_name, "signal::completed")))
|
||||
{
|
||||
GCallback callback = va_arg (var_args, GCallback);
|
||||
gpointer userdata = va_arg (var_args, gpointer);
|
||||
|
||||
g_signal_connect (animation, "completed", callback, userdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_str_has_prefix (property_name, "fixed::"))
|
||||
property_name += 7; /* strlen("fixed::") */
|
||||
|
||||
@ -1446,6 +1455,7 @@ clutter_animation_setup_valist (ClutterAnimation *animation,
|
||||
clutter_animation_setup_property (animation, property_name,
|
||||
&final,
|
||||
pspec);
|
||||
}
|
||||
|
||||
property_name = va_arg (var_args, gchar*);
|
||||
}
|
||||
@ -1627,6 +1637,26 @@ clutter_actor_animate_with_timeline (ClutterActor *actor,
|
||||
* to control the animation or to know when the animation has been
|
||||
* completed.
|
||||
*
|
||||
* 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:
|
||||
*
|
||||
* |[
|
||||
*
|
||||
* static void
|
||||
* on_animation_completed (ClutterAnimation *animation,
|
||||
* ClutterActor *actor)
|
||||
* {
|
||||
* clutter_actor_hide (actor);
|
||||
* }
|
||||
*
|
||||
* clutter_actor_animate (actor, CLUTTER_EASE_IN, 100,
|
||||
* "opacity", 0,
|
||||
* "signal::completed", on_animation_completed, actor,
|
||||
* NULL);
|
||||
* ]|
|
||||
*
|
||||
*
|
||||
* Calling this function on an actor that is already being animated
|
||||
* will cause the current animation to change with the new final values,
|
||||
* the new easing mode and the new duration - that is, this code:
|
||||
|
Loading…
Reference in New Issue
Block a user