[empathy/gnome-2-34] Follow the sending state of the channel to determine whether we should send video



commit a108a3deab6cf83a39b8f859b25ea7ea86ad90c7
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Tue Mar 22 13:18:37 2011 +0000

    Follow the sending state of the channel to determine whether we should send video

 src/empathy-call-window.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index e5008f1..22db187 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -2335,12 +2335,6 @@ empathy_call_window_state_changed_cb (EmpathyCallHandler *handler,
   if (priv->video_input == NULL)
     empathy_call_window_set_send_video (self, CAMERA_STATE_OFF);
 
-  priv->sending_video = can_send_video &&
-    empathy_call_handler_has_initial_video (priv->handler);
-
-  gtk_toggle_tool_button_set_active (
-      GTK_TOGGLE_TOOL_BUTTON (priv->tool_button_camera_on),
-      priv->sending_video && priv->video_input != NULL);
   gtk_widget_set_sensitive (priv->tool_button_camera_on, can_send_video);
   gtk_action_set_sensitive (priv->action_camera_on, can_send_video);
 
@@ -2553,6 +2547,9 @@ static void
 start_call (EmpathyCallWindow *self)
 {
   EmpathyCallWindowPriv *priv = GET_PRIV (self);
+  TpyCallChannel *call;
+
+  g_object_get (priv->handler, "call-channel", &call, NULL);
 
   priv->call_started = TRUE;
   empathy_call_handler_start_call (priv->handler,
@@ -2560,10 +2557,19 @@ start_call (EmpathyCallWindow *self)
 
   if (empathy_call_handler_has_initial_video (priv->handler))
     {
-      /* Enable 'send video' buttons and display the preview */
-      gtk_toggle_tool_button_set_active (
+      TpySendingState s = tpy_call_channel_get_video_state (call);
+
+      if (s == TPY_SENDING_STATE_PENDING_SEND ||
+          s == TPY_SENDING_STATE_SENDING)
+        /* Enable 'send video' buttons and display the preview */
+        gtk_toggle_tool_button_set_active (
           GTK_TOGGLE_TOOL_BUTTON (priv->tool_button_camera_on), TRUE);
+      else
+        gtk_toggle_tool_button_set_active (
+          GTK_TOGGLE_TOOL_BUTTON (priv->tool_button_camera_off), TRUE);
     }
+
+  g_object_unref (call);
 }
 
 static gboolean



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