diff options
author | Pierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk> | 2009-06-15 00:30:40 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2009-06-15 22:40:24 +0800 |
commit | ec4b41130b1b9704abf190a470d65a9e41846284 (patch) | |
tree | 2d532cbf920f668b94745528f4a34338c7df1c34 | |
parent | e37fbd376151222f336650f66476c3cdc0957451 (diff) | |
download | gsoc2013-empathy-ec4b41130b1b9704abf190a470d65a9e41846284.tar gsoc2013-empathy-ec4b41130b1b9704abf190a470d65a9e41846284.tar.gz gsoc2013-empathy-ec4b41130b1b9704abf190a470d65a9e41846284.tar.bz2 gsoc2013-empathy-ec4b41130b1b9704abf190a470d65a9e41846284.tar.lz gsoc2013-empathy-ec4b41130b1b9704abf190a470d65a9e41846284.tar.xz gsoc2013-empathy-ec4b41130b1b9704abf190a470d65a9e41846284.tar.zst gsoc2013-empathy-ec4b41130b1b9704abf190a470d65a9e41846284.zip |
Add contextual popup menu in map view
-rw-r--r-- | src/empathy-map-view.c | 30 |
1 files changed, 30 insertions, 0 deletions
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 @@ -235,6 +235,32 @@ map_view_contact_location_notify (EmpathyContact *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, GtkTreeIter *iter, @@ -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", |