diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-12-23 20:09:45 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-01-07 01:54:05 +0800 |
commit | 6ebf46cb5048e90de75dceead5df6052e776a3a3 (patch) | |
tree | 41245988daaaad647465c2c0cbf880dcb4f9c0d9 | |
parent | 63c518d5469107144ad3c6ba8cc8c4c7f066747e (diff) | |
download | gsoc2013-empathy-6ebf46cb5048e90de75dceead5df6052e776a3a3.tar.gz gsoc2013-empathy-6ebf46cb5048e90de75dceead5df6052e776a3a3.tar.zst gsoc2013-empathy-6ebf46cb5048e90de75dceead5df6052e776a3a3.zip |
Display a context menu when clicking on audio/video icons (#590051)
-rw-r--r-- | libempathy-gtk/empathy-contact-list-view.c | 69 |
1 files changed, 32 insertions, 37 deletions
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index e11a2e93f..fe4be30df 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -752,54 +752,49 @@ contact_list_view_row_activated (GtkTreeView *view, } static void -contact_list_start_voip_call (EmpathyCellRendererActivatable *cell, +contact_list_view_call_activated_cb ( + EmpathyCellRendererActivatable *cell, const gchar *path_string, - EmpathyContactListView *view, - gboolean with_video) + EmpathyContactListView *view) { - EmpathyContactListViewPriv *priv = GET_PRIV (view); - GtkTreeModel *model; - GtkTreeIter iter; - EmpathyContact *contact; - - if (!(priv->contact_features & EMPATHY_CONTACT_FEATURE_CALL)) { - return; - } + GtkWidget *menu; + GtkTreeModel *model; + GtkTreeIter iter; + EmpathyContact *contact; + GdkEventButton *event; + GtkMenuShell *shell; + GtkWidget *item; model = gtk_tree_view_get_model (GTK_TREE_VIEW (view)); - if (!gtk_tree_model_get_iter_from_string (model, &iter, path_string)) { + if (!gtk_tree_model_get_iter_from_string (model, &iter, path_string)) return; - } gtk_tree_model_get (model, &iter, EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, &contact, -1); + if (contact == NULL) + return; - if (contact) { - EmpathyCallFactory *factory; - factory = empathy_call_factory_get (); - empathy_call_factory_new_call_with_streams (factory, contact, - TRUE, with_video); - g_object_unref (contact); - } -} + event = (GdkEventButton *) gtk_get_current_event (); -static void -contact_list_view_video_call_activated_cb ( - EmpathyCellRendererActivatable *cell, - const gchar *path_string, - EmpathyContactListView *view) -{ - contact_list_start_voip_call (cell, path_string, view, TRUE); -} + menu = gtk_menu_new (); + shell = GTK_MENU_SHELL (menu); + /* audio */ + item = empathy_contact_audio_call_menu_item_new (contact); + gtk_menu_shell_append (shell, item); + gtk_widget_show (item); -static void -contact_list_view_audio_call_activated_cb (EmpathyCellRendererActivatable *cell, - const gchar *path_string, - EmpathyContactListView *view) -{ - contact_list_start_voip_call (cell, path_string, view, FALSE); + /* video */ + item = empathy_contact_video_call_menu_item_new (contact); + gtk_menu_shell_append (shell, item); + gtk_widget_show (item); + + gtk_widget_show (menu); + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, + event->button, event->time); + + g_object_unref (contact); } static void @@ -1155,7 +1150,7 @@ contact_list_view_setup (EmpathyContactListView *view) NULL); g_signal_connect (cell, "path-activated", - G_CALLBACK (contact_list_view_audio_call_activated_cb), + G_CALLBACK (contact_list_view_call_activated_cb), view); /* Video Call Icon */ @@ -1171,7 +1166,7 @@ contact_list_view_setup (EmpathyContactListView *view) NULL); g_signal_connect (cell, "path-activated", - G_CALLBACK (contact_list_view_video_call_activated_cb), + G_CALLBACK (contact_list_view_call_activated_cb), view); /* Avatar */ |