From: Pierre-Luc Beaudoin Date: Mon, 13 Oct 2008 18:15:41 +0000 (-0400) Subject: Fix compile warnings and add click X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eada76ce7a0484b5dc80887f10eebd2ff63af77d;p=libchamplain Fix compile warnings and add click --- diff --git a/champlain/launcher.c b/champlain/launcher.c index dbc1696..2ad6ba5 100644 --- a/champlain/launcher.c +++ b/champlain/launcher.c @@ -20,6 +20,14 @@ #include +static gboolean +montreal_click (ClutterActor *actor, + ClutterEvent *event, + gpointer user_data) +{ g_print("Montreal was clicked!\n"); + return TRUE; +} + static ClutterActor* create_marker_layer () { @@ -32,6 +40,11 @@ create_marker_layer () marker = champlain_marker_new_with_label("Montréal", "Airmole 14", NULL, NULL); champlain_marker_set_position(CHAMPLAIN_MARKER(marker), 45.528178, -73.563788); clutter_container_add(CLUTTER_CONTAINER(layer), marker, NULL); + clutter_actor_set_reactive(marker, TRUE); + g_signal_connect_after (marker, + "button-release-event", + G_CALLBACK (montreal_click), + NULL); marker = champlain_marker_new_with_label("New York", "Sans 25", &white, NULL); champlain_marker_set_position(CHAMPLAIN_MARKER(marker), 40.77, -73.98); @@ -58,11 +71,11 @@ main (int argc, char *argv[]) actor = champlain_view_new (CHAMPLAIN_VIEW_MODE_KINETIC); - champlain_view_set_size (actor, 800, 600); + champlain_view_set_size (CHAMPLAIN_VIEW (actor), 800, 600); g_object_set(G_OBJECT(actor), "zoom-level", 5, NULL); layer = create_marker_layer(); - champlain_view_add_layer(actor, layer); + champlain_view_add_layer(CHAMPLAIN_VIEW (actor), layer); clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor); champlain_view_center_on(CHAMPLAIN_VIEW(actor), 45.466, -73.75);