Use ClickAction in test-animation

Instead of using ::button-press-event.
This commit is contained in:
Emmanuele Bassi 2010-05-26 14:18:19 +01:00
parent 5677cf671c
commit 823251c159

View File

@ -15,10 +15,10 @@ on_animation_complete (ClutterAnimation *animation,
clutter_actor_set_reactive (actor, TRUE); clutter_actor_set_reactive (actor, TRUE);
} }
static gboolean static void
on_button_press (ClutterActor *actor, on_clicked (ClutterClickAction *action,
ClutterButtonEvent *event, ClutterActor *actor,
gpointer dummy) gpointer dummy G_GNUC_UNUSED)
{ {
ClutterAnimation *animation; ClutterAnimation *animation;
gfloat old_x, old_y, new_x, new_y; gfloat old_x, old_y, new_x, new_y;
@ -78,8 +78,6 @@ on_button_press (ClutterActor *actor,
g_signal_connect (animation, g_signal_connect (animation,
"completed", G_CALLBACK (on_animation_complete), "completed", G_CALLBACK (on_animation_complete),
actor); actor);
return TRUE;
} }
G_MODULE_EXPORT int G_MODULE_EXPORT int
@ -88,6 +86,7 @@ test_animation_main (int argc, char *argv[])
ClutterActor *stage, *rect; ClutterActor *stage, *rect;
ClutterColor stage_color = { 0x66, 0x66, 0xdd, 0xff }; ClutterColor stage_color = { 0x66, 0x66, 0xdd, 0xff };
ClutterColor rect_color = { 0x44, 0xdd, 0x44, 0xff }; ClutterColor rect_color = { 0x44, 0xdd, 0x44, 0xff };
ClutterAction *action;
clutter_init (&argc, &argv); clutter_init (&argc, &argv);
@ -103,9 +102,10 @@ test_animation_main (int argc, char *argv[])
clutter_actor_get_height (stage) / 2); clutter_actor_get_height (stage) / 2);
clutter_actor_set_opacity (rect, 0x88); clutter_actor_set_opacity (rect, 0x88);
clutter_actor_set_reactive (rect, TRUE); clutter_actor_set_reactive (rect, TRUE);
g_signal_connect (rect,
"button-press-event", G_CALLBACK (on_button_press), action = clutter_click_action_new ();
NULL); g_signal_connect (action, "clicked", G_CALLBACK (on_clicked), NULL);
clutter_actor_add_action_with_name (rect, "click", action);
clutter_actor_show (stage); clutter_actor_show (stage);