From 16f43e0a4d7bd7597694bca7f9f48ef2a20da5a5 Mon Sep 17 00:00:00 2001 From: Arnaud Maillet Date: Mon, 20 Jul 2009 16:41:15 +0200 Subject: [PATCH] Instantiate ShareMyDesktop feature in the contact menu of Empathy --- libempathy-gtk/empathy-contact-menu.c | 31 +++++++++++++++++++++++++++ libempathy-gtk/empathy-contact-menu.h | 1 + 2 files changed, 32 insertions(+) diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c index 0de7c1ca..070d9126 100644 --- a/libempathy-gtk/empathy-contact-menu.c +++ b/libempathy-gtk/empathy-contact-menu.c @@ -39,6 +39,7 @@ #include "empathy-log-window.h" #include "empathy-contact-dialogs.h" #include "empathy-ui-utils.h" +#include "empathy-share-my-desktop.h" GtkWidget * empathy_contact_menu_new (EmpathyContact *contact, @@ -100,6 +101,13 @@ empathy_contact_menu_new (EmpathyContact *contact, gtk_menu_shell_append (shell, item); gtk_widget_show (item); + /* Share my desktop */ + /* FIXME we should add the "Share my desktop" menu item if Vino is + a registered handler in MC5 */ + item = empathy_contact_share_my_desktop_menu_item_new (contact); + gtk_menu_shell_append (shell, item); + gtk_widget_show (item); + /* Separator */ if (features & (EMPATHY_CONTACT_FEATURE_EDIT | EMPATHY_CONTACT_FEATURE_INFO)) { @@ -349,6 +357,29 @@ empathy_contact_file_transfer_menu_item_new (EmpathyContact *contact) return item; } +/* FIXME we should check if the contact supports vnc stream tube */ +GtkWidget * +empathy_contact_share_my_desktop_menu_item_new (EmpathyContact *contact) +{ + GtkWidget *item; + GtkWidget *image; + + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); + + item = gtk_image_menu_item_new_with_mnemonic (_("Share my desktop")); + image = gtk_image_new_from_icon_name (GTK_STOCK_NETWORK, + GTK_ICON_SIZE_MENU); + gtk_widget_set_sensitive (item, empathy_contact_can_use_stream_tube (contact)); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image); + gtk_widget_show (image); + + g_signal_connect_swapped (item, "activate", + G_CALLBACK (empathy_share_my_desktop_share_with_contact), + contact); + + return item; +} + static void contact_info_menu_item_activate_cb (EmpathyContact *contact) { diff --git a/libempathy-gtk/empathy-contact-menu.h b/libempathy-gtk/empathy-contact-menu.h index 1c40d0e2..2c623e6b 100644 --- a/libempathy-gtk/empathy-contact-menu.h +++ b/libempathy-gtk/empathy-contact-menu.h @@ -49,6 +49,7 @@ GtkWidget * empathy_contact_info_menu_item_new (EmpathyContact *cont GtkWidget * empathy_contact_edit_menu_item_new (EmpathyContact *contact); GtkWidget * empathy_contact_invite_menu_item_new (EmpathyContact *contact); GtkWidget * empathy_contact_file_transfer_menu_item_new (EmpathyContact *contact); +GtkWidget * empathy_contact_share_my_desktop_menu_item_new (EmpathyContact *contact); G_END_DECLS -- 2.39.2