[clutter] actor: Add ::transitions-completed signal
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] actor: Add ::transitions-completed signal
- Date: Sun, 18 Mar 2012 08:10:55 +0000 (UTC)
commit 103438cfe2b51f479c6f6ccce4afc1ba1b0406f0
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Sun Mar 18 08:07:56 2012 +0000
actor: Add ::transitions-completed signal
While you can get a per-transition notification of completion, it can be
convenient to also have a way to notify that all the transitions
involving an actor are complete. A simple signal triggered by the
removal of the last transition fits the bill pretty neatly.
clutter/clutter-actor.c | 34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 24c7606..e43cb88 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -791,6 +791,7 @@ enum
ENTER_EVENT,
LEAVE_EVENT,
ALLOCATION_CHANGED,
+ TRANSITIONS_COMPLETED,
LAST_SIGNAL
};
@@ -6958,6 +6959,24 @@ clutter_actor_class_init (ClutterActorClass *klass)
G_TYPE_NONE, 2,
CLUTTER_TYPE_ACTOR_BOX | G_SIGNAL_TYPE_STATIC_SCOPE,
CLUTTER_TYPE_ALLOCATION_FLAGS);
+
+ /**
+ * ClutterActor::transitions-completed:
+ * @actor: a #ClutterActor
+ *
+ * The ::transitions-completed signal is emitted once all transitions
+ * involving @actor are complete.
+ *
+ * Since: 1.10
+ */
+ actor_signals[TRANSITIONS_COMPLETED] =
+ g_signal_new (I_("transitions-completed"),
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _clutter_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
static void
@@ -16954,12 +16973,25 @@ static void
on_transition_completed (ClutterTransition *transition,
TransitionClosure *clos)
{
+ ClutterActor *actor = clos->actor;
ClutterAnimationInfo *info;
- info = _clutter_actor_get_animation_info (clos->actor);
+ info = _clutter_actor_get_animation_info (actor);
/* this will take care of cleaning clos for us */
g_hash_table_remove (info->transitions, clos->name);
+
+ /* if it's the last transition then we clean up */
+ if (g_hash_table_size (info->transitions) == 0)
+ {
+ g_hash_table_unref (info->transitions);
+ info->transitions = NULL;
+
+ CLUTTER_NOTE (ANIMATION, "Transitions for '%s' completed",
+ _clutter_actor_get_debug_name (actor));
+
+ g_signal_emit (actor, actor_signals[TRANSITIONS_COMPLETED], 0);
+ }
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]