test-easing: Do not reconnect signals multiple times

The test should keep track of the last animation and avoid reconnecting
signals to the same instance in case the -r argument has been passed.
This commit is contained in:
Emmanuele Bassi 2010-01-22 21:44:28 +00:00
parent 7073e69b4e
commit d0f7debfba

View File

@ -48,6 +48,8 @@ static gboolean recenter = FALSE;
static ClutterActor *main_stage = NULL; static ClutterActor *main_stage = NULL;
static ClutterActor *easing_mode_label = NULL; static ClutterActor *easing_mode_label = NULL;
static ClutterAnimation *last_animation = NULL;
static void static void
on_animation_completed (ClutterAnimation *animation, on_animation_completed (ClutterAnimation *animation,
ClutterActor *rectangle) ClutterActor *rectangle)
@ -113,10 +115,12 @@ on_button_press (ClutterActor *actor,
"y", event->y, "y", event->y,
NULL); NULL);
if (recenter) if (recenter && last_animation != animation)
g_signal_connect_after (animation, "completed", g_signal_connect_after (animation, "completed",
G_CALLBACK (on_animation_completed), G_CALLBACK (on_animation_completed),
rectangle); rectangle);
last_animation = animation;
} }
return TRUE; return TRUE;