]> git.0d.be Git - empathy.git/commitdiff
disable the others button when 'camera on' is enabled
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 24 Nov 2009 16:26:15 +0000 (16:26 +0000)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 27 Nov 2009 16:33:43 +0000 (16:33 +0000)
src/empathy-call-window.c

index ef10866c62c9099c7130b5b815aa166a080de537..8d4849d8b1c7898fe2c0e2c60ee8a63dd0dae9b4 100644 (file)
@@ -814,22 +814,42 @@ tool_button_camera_preview_toggled_cb (GtkToggleToolButton *toggle,
 }
 
 static void
-tool_button_camera_on_toggled_cb (GtkToggleToolButton *toggle,
-  EmpathyCallWindow *window)
+enable_camera (EmpathyCallWindow *self)
 {
-  EmpathyCallWindowPriv *priv = GET_PRIV (window);
-  gboolean active;
+  EmpathyCallWindowPriv *priv = GET_PRIV (self);
 
-  if (priv->call_state != CONNECTED)
-    return;
+  priv->camera_state = CAMERA_STATE_ON;
+  empathy_call_window_set_send_video (self, TRUE);
 
-  active = (gtk_toggle_tool_button_get_active (toggle));
+  block_camera_control_signals (self);
+  gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (
+      priv->tool_button_camera_off), FALSE);
+  gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (
+        priv->tool_button_camera_preview), FALSE);
+  unblock_camera_control_signals (self);
+}
 
-  if (priv->sending_video == active)
-    return;
+static void
+tool_button_camera_on_toggled_cb (GtkToggleToolButton *toggle,
+  EmpathyCallWindow *self)
+{
+  EmpathyCallWindowPriv *priv = GET_PRIV (self);
 
-  empathy_call_window_set_send_video (window, active);
-  gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->send_video), active);
+  if (!gtk_toggle_tool_button_get_active (toggle))
+    {
+      if (priv->camera_state == CAMERA_STATE_ON)
+        {
+          /* We can't change the state by disabling the button */
+          block_camera_control_signals (self);
+          gtk_toggle_tool_button_set_active (toggle, TRUE);
+          unblock_camera_control_signals (self);
+        }
+
+      return;
+    }
+
+  DEBUG ("enable camera");
+  enable_camera (self);
 }
 
 static void