From ec4b41130b1b9704abf190a470d65a9e41846284 Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Sun, 14 Jun 2009 12:30:40 -0400 Subject: Add contextual popup menu in map view --- src/empathy-map-view.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c index 276b69402..ab64b2adc 100644 --- a/src/empathy-map-view.c +++ b/src/empathy-map-view.c @@ -234,6 +234,32 @@ map_view_contact_location_notify (EmpathyContact *contact, map_view_marker_update_position (marker, contact); } +static gboolean +marker_clicked_cb (ChamplainMarker *marker, + ClutterButtonEvent *event, + EmpathyContact *contact) +{ + GtkWidget *menu; + + if (event->button != 3) + return FALSE; + + menu = empathy_contact_menu_new (contact, + EMPATHY_CONTACT_FEATURE_CHAT | + EMPATHY_CONTACT_FEATURE_CALL | + EMPATHY_CONTACT_FEATURE_LOG | + EMPATHY_CONTACT_FEATURE_INFO); + + if (menu == NULL) + return FALSE; + + gtk_widget_show (menu); + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, + event->button, event->time); + + return FALSE; +} + static gboolean map_view_contacts_foreach (GtkTreeModel *model, GtkTreePath *path, @@ -293,6 +319,10 @@ map_view_contacts_foreach (GtkTreeModel *model, champlain_marker_set_text (CHAMPLAIN_MARKER (marker), label); g_free (label); + clutter_actor_set_reactive (CLUTTER_ACTOR (marker), TRUE); + g_signal_connect (marker, "button-release-event", + G_CALLBACK (marker_clicked_cb), contact); + clutter_container_add (CLUTTER_CONTAINER (window->layer), marker, NULL); g_signal_connect (contact, "notify::location", -- cgit v1.2.3