]> git.0d.be Git - empathy.git/commitdiff
add 'Video Call' entry to the Contact menu
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 18 May 2009 13:53:01 +0000 (14:53 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 18 May 2009 15:17:28 +0000 (16:17 +0100)
libempathy-gtk/empathy-contact-menu.c
libempathy-gtk/empathy-contact-menu.h

index 740e3827ca3fff5761141431e7ca52217ded17c7..fdd9c34a1b50cb909228adbc48e75d86b94a3982 100644 (file)
@@ -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 */
@@ -172,6 +177,38 @@ empathy_contact_audio_call_menu_item_new (EmpathyContact *contact)
        return item;
 }
 
+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)
 {
@@ -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;
 }
 
index d2b7e5f5e8ee18113b9c3c43ac4124eb0fb23faf..8126a8e5975e36b03d75349d9499a13aa2a9d285 100644 (file)
@@ -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);