mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
[animation] Allow swapped/after signal variants
Continuing in the tradition on making clutter_actor_animate() the next g_object_connect(), here's the addition of the signal-after:: and signal-swapped:: modifiers for the automagic signal connection arguments. Fixes bug: http://bugzilla.openedhand.com/show_bug.cgi?id=1646
This commit is contained in:
parent
0415d62d40
commit
612d1cded7
@ -1584,6 +1584,38 @@ clutter_animation_setup_valist (ClutterAnimation *animation,
|
||||
|
||||
g_signal_connect (animation, signal_name, callback, userdata);
|
||||
}
|
||||
else if (g_str_has_prefix (property_name, "signal-"))
|
||||
{
|
||||
GCallback callback = va_arg (var_args, GCallback);
|
||||
gpointer userdata = va_arg (var_args, gpointer);
|
||||
const gchar *signal_name;
|
||||
GConnectFlags flags;
|
||||
|
||||
if (g_str_has_prefix (property_name, "signal-after::"))
|
||||
{
|
||||
signal_name = property_name + 14;
|
||||
flags = G_CONNECT_AFTER;
|
||||
}
|
||||
else if (g_str_has_prefix (property_name, "signal-swapped::"))
|
||||
{
|
||||
signal_name = property_name + 16;
|
||||
flags = G_CONNECT_SWAPPED;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Unable to connect to '%s': the valid signal "
|
||||
"modifiers are 'signal-swapped::' and "
|
||||
"'signal-swapped::'",
|
||||
property_name);
|
||||
break;
|
||||
}
|
||||
|
||||
g_signal_connect_data (animation, signal_name,
|
||||
callback,
|
||||
userdata,
|
||||
NULL,
|
||||
flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_str_has_prefix (property_name, "fixed::"))
|
||||
@ -1805,9 +1837,10 @@ 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 the specified signal name, for
|
||||
* If a name argument starts with "signal::", "signal-after::" or
|
||||
* "signal-swapped::" the two following arguments are used as callback
|
||||
* function and data for a signal handler installed on the
|
||||
* #ClutterAnimation object for the specified signal name, for
|
||||
* instance:
|
||||
*
|
||||
* |[
|
||||
@ -1825,6 +1858,14 @@ clutter_actor_animate_with_timeline (ClutterActor *actor,
|
||||
* NULL);
|
||||
* ]|
|
||||
*
|
||||
* The "signal::" modifier is the equivalent of using g_signal_connect();
|
||||
* the "signal-after::" modifier is the equivalent of using
|
||||
* g_signal_connect_after(); the "signal-swapped::" modifier is the equivalent
|
||||
* of using g_signal_connect_swapped(). The clutter_actor_animate() function
|
||||
* will not keep track of multiple connections to the same signal, so it is
|
||||
* your responsability to avoid them when calling clutter_actor_animate()
|
||||
* multiple times on the same actor.
|
||||
*
|
||||
* 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