[empathy] add 'Video Call' entry to the Contact menu



commit 84e2c127de4b21c0bbd53fa46ab00bf7d497969b
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon May 18 14:53:01 2009 +0100

    add 'Video Call' entry to the Contact menu
---
 libempathy-gtk/empathy-contact-menu.c |   40 +++++++++++++++++++++++++++++++-
 libempathy-gtk/empathy-contact-menu.h |    1 +
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c
index 740e382..fdd9c34 100644
--- a/libempathy-gtk/empathy-contact-menu.c
+++ b/libempathy-gtk/empathy-contact-menu.c
@@ -62,11 +62,16 @@ empathy_contact_menu_new (EmpathyContact             *contact,
 		gtk_widget_show (item);
 	}
 
-	/* Call */
 	if (features & EMPATHY_CONTACT_FEATURE_CALL) {
+		/* Audio Call */
 		item = empathy_contact_audio_call_menu_item_new (contact);
 		gtk_menu_shell_append (shell, item);
 		gtk_widget_show (item);
+
+		/* Video Call */
+		item = empathy_contact_video_call_menu_item_new (contact);
+		gtk_menu_shell_append (shell, item);
+		gtk_widget_show (item);
 	}
 
 	/* Log */
@@ -173,6 +178,38 @@ empathy_contact_audio_call_menu_item_new (EmpathyContact *contact)
 }
 
 static void
+empathy_contact_video_call_menu_item_activated (GtkMenuItem *item,
+	EmpathyContact *contact)
+{
+	EmpathyCallFactory *factory;
+
+	factory = empathy_call_factory_get ();
+	empathy_call_factory_new_call_with_streams (factory, contact, TRUE, TRUE);
+}
+
+GtkWidget *
+empathy_contact_video_call_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 (C_("menu item", "_Video Call"));
+	image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_VIDEO_CALL,
+					      GTK_ICON_SIZE_MENU);
+	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+	gtk_widget_set_sensitive (item, empathy_contact_can_voip (contact));
+	gtk_widget_show (image);
+
+	g_signal_connect (item, "activate",
+				  G_CALLBACK (empathy_contact_video_call_menu_item_activated),
+				  contact);
+
+	return item;
+}
+
+static void
 contact_log_menu_item_activate_cb (EmpathyContact *contact)
 {
 	empathy_log_window_show (empathy_contact_get_account (contact),
@@ -301,7 +338,6 @@ room_sub_menu_data_new (EmpathyContact *contact,
 	data = g_slice_new (RoomSubMenuData);
 	data->contact = g_object_ref (contact);
 	data->chatroom = g_object_ref (chatroom);
-
 	return data;
 }
 
diff --git a/libempathy-gtk/empathy-contact-menu.h b/libempathy-gtk/empathy-contact-menu.h
index d2b7e5f..8126a8e 100644
--- a/libempathy-gtk/empathy-contact-menu.h
+++ b/libempathy-gtk/empathy-contact-menu.h
@@ -42,6 +42,7 @@ GtkWidget * empathy_contact_menu_new           (EmpathyContact             *cont
 						EmpathyContactFeatureFlags  features);
 GtkWidget * empathy_contact_chat_menu_item_new (EmpathyContact             *contact);
 GtkWidget * empathy_contact_audio_call_menu_item_new (EmpathyContact             *contact);
+GtkWidget * empathy_contact_video_call_menu_item_new (EmpathyContact             *contact);
 GtkWidget * empathy_contact_log_menu_item_new  (EmpathyContact             *contact);
 GtkWidget * empathy_contact_info_menu_item_new (EmpathyContact             *contact);
 GtkWidget * empathy_contact_edit_menu_item_new (EmpathyContact             *contact);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]