[empathy] hook the camera radio buttons



commit 8d1e30bfa8cacadaf2411c03396bd01ad41332c3
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Wed Nov 25 11:22:46 2009 +0000

    hook the camera radio buttons

 src/empathy-call-window.c |   35 ++++++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 1ecfd95..b94f679 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -96,7 +96,7 @@ typedef enum {
 } CallState;
 
 typedef enum {
-  CAMERA_STATE_OFF,
+  CAMERA_STATE_OFF = 0,
   CAMERA_STATE_PREVIEW,
   CAMERA_STATE_ON,
 } CameraState;
@@ -879,6 +879,34 @@ tool_button_camera_on_toggled_cb (GtkToggleToolButton *toggle,
 }
 
 static void
+action_camera_change_cb (GtkRadioAction *action,
+    GtkRadioAction *current,
+    EmpathyCallWindow *self)
+{
+  CameraState state;
+
+  state = gtk_radio_action_get_current_value (current);
+
+  switch (state)
+    {
+      case CAMERA_STATE_OFF:
+        disable_camera (self);
+        break;
+
+      case CAMERA_STATE_PREVIEW:
+        enable_preview (self);
+        break;
+
+      case CAMERA_STATE_ON:
+        enable_camera (self);
+        break;
+
+      default:
+        g_assert_not_reached ();
+    }
+}
+
+static void
 empathy_call_window_init (EmpathyCallWindow *self)
 {
   EmpathyCallWindowPriv *priv = GET_PRIV (self);
@@ -921,6 +949,7 @@ empathy_call_window_init (EmpathyCallWindow *self)
     "camera_off", "toggled", tool_button_camera_off_toggled_cb,
     "camera_preview", "toggled", tool_button_camera_preview_toggled_cb,
     "camera_on", "toggled", tool_button_camera_on_toggled_cb,
+    "action_camera_off", "changed", action_camera_change_cb,
     NULL);
 
   priv->lock = g_mutex_new ();
@@ -2563,6 +2592,8 @@ block_camera_control_signals (EmpathyCallWindow *self)
       tool_button_camera_preview_toggled_cb, self);
   g_signal_handlers_block_by_func (priv->tool_button_camera_on,
       tool_button_camera_on_toggled_cb, self);
+  g_signal_handlers_block_by_func (priv->action_camera,
+      tool_button_camera_on_toggled_cb, self);
 }
 
 static void
@@ -2576,4 +2607,6 @@ unblock_camera_control_signals (EmpathyCallWindow *self)
       tool_button_camera_preview_toggled_cb, self);
   g_signal_handlers_unblock_by_func (priv->tool_button_camera_on,
       tool_button_camera_on_toggled_cb, self);
+  g_signal_handlers_unblock_by_func (priv->action_camera,
+      tool_button_camera_on_toggled_cb, self);
 }



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