[empathy: 67/99] Add Answer with video to the default dialogs



commit 6b6213702cba10ca28494e44990f750569856217
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Tue Mar 22 16:40:33 2011 +0000

    Add Answer with video to the default dialogs
    
    We should be able to answer calls with or without video. This patch only
    implements that for Call type channels, but for clarity have ``Answer
    with video'' as the only button on SM channels for video calls to be
    sure it's clear to the user what to expect

 src/empathy-event-manager.c |   38 +++++++++++++++++++++++++++++---------
 1 files changed, 29 insertions(+), 9 deletions(-)
---
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index 6d58a4a..5c17d7e 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -58,6 +58,8 @@
 
 #define NOTIFICATION_TIMEOUT 2 /* seconds */
 
+#define ACCEPT_WITHOUT_VIDEO 1
+
 /* The time interval in milliseconds between 2 incoming rings */
 #define MS_BETWEEN_RING 500
 
@@ -484,14 +486,20 @@ event_manager_call_window_confirmation_dialog_response_cb (GtkDialog *dialog,
   gtk_widget_destroy (approval->dialog);
   approval->dialog = NULL;
 
-  if (response != GTK_RESPONSE_ACCEPT)
+  if (response == GTK_RESPONSE_ACCEPT)
     {
-      reject_approval (approval);
+      event_manager_approval_approve (approval);
     }
-  else
+  else if (response == ACCEPT_WITHOUT_VIDEO)
     {
+      tpy_call_channel_send_video (TPY_CALL_CHANNEL (approval->main_channel),
+        FALSE);
       event_manager_approval_approve (approval);
     }
+  else
+    {
+      reject_approval (approval);
+    }
 }
 
 static void
@@ -502,6 +510,7 @@ event_channel_process_voip_func (EventPriv *event)
   GtkWidget *image;
   gboolean video;
   gchar *title;
+  EmpathyEventType etype = event->public.type;
 
   if (event->approval->dialog != NULL)
     {
@@ -509,13 +518,13 @@ event_channel_process_voip_func (EventPriv *event)
       return;
     }
 
-  if (event->public.type == EMPATHY_EVENT_TYPE_VOIP)
+  if (etype == EMPATHY_EVENT_TYPE_VOIP)
     {
       EmpathyTpStreamedMedia *call;
       call = EMPATHY_TP_STREAMED_MEDIA (event->approval->handler_instance);
       video = empathy_tp_streamed_media_has_initial_video (call);
     }
-  else if (event->public.type == EMPATHY_EVENT_TYPE_CALL)
+  else if (etype == EMPATHY_EVENT_TYPE_CALL)
     {
       TpyCallChannel *call;
       call = TPY_CALL_CHANNEL (event->approval->handler_instance);
@@ -567,15 +576,26 @@ event_channel_process_voip_func (EventPriv *event)
     GTK_ICON_SIZE_BUTTON);
   gtk_button_set_image (GTK_BUTTON (button), image);
 
+  if (video && etype == EMPATHY_EVENT_TYPE_CALL)
+    {
+      button = gtk_dialog_add_button (GTK_DIALOG (dialog),
+        _("_Answer"), ACCEPT_WITHOUT_VIDEO);
+
+      image = gtk_image_new_from_icon_name ("call-start",
+        GTK_ICON_SIZE_BUTTON);
+      gtk_button_set_image (GTK_BUTTON (button), image);
+    }
+
   button = gtk_dialog_add_button (GTK_DIALOG (dialog),
-      _("_Answer"), GTK_RESPONSE_ACCEPT);
+    video ? _("_Answer with video") : _("_Answer"), GTK_RESPONSE_ACCEPT);
 
-  image = gtk_image_new_from_icon_name ("call-start", GTK_ICON_SIZE_BUTTON);
+  image = gtk_image_new_from_icon_name ("call-start",
+        GTK_ICON_SIZE_BUTTON);
   gtk_button_set_image (GTK_BUTTON (button), image);
 
   g_signal_connect (dialog, "response",
-      G_CALLBACK (event_manager_call_window_confirmation_dialog_response_cb),
-      event->approval);
+    G_CALLBACK (event_manager_call_window_confirmation_dialog_response_cb),
+    event->approval);
 
   gtk_widget_show (dialog);
 



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