]> git.0d.be Git - empathy.git/commitdiff
CallWindow: disable Video functionality if there's no camera
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Tue, 10 May 2011 12:14:45 +0000 (13:14 +0100)
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Tue, 12 Jul 2011 09:11:14 +0000 (10:11 +0100)
src/empathy-call-window.c

index 8fd10dea0f64d1f8846118f2e8c3971d4302e9d7..85a2f4c5161505a6cd3c4d4f6f1a08b60ea4afe3 100644 (file)
@@ -40,6 +40,7 @@
 #include <gst/farsight/fs-element-added-notifier.h>
 #include <gst/farsight/fs-utils.h>
 
+#include <libempathy/empathy-camera-monitor.h>
 #include <libempathy/empathy-tp-contact-factory.h>
 #include <libempathy/empathy-utils.h>
 #include <libempathy-gtk/empathy-avatar-image.h>
@@ -107,6 +108,8 @@ struct _EmpathyCallWindowPriv
 
   EmpathyContact *contact;
 
+  EmpathyCameraMonitor *camera_monitor;
+
   guint call_state;
   gboolean outgoing;
 
@@ -1057,6 +1060,12 @@ empathy_call_window_init (EmpathyCallWindow *self)
 
   gtk_action_set_sensitive (priv->menu_fullscreen, FALSE);
 
+  priv->camera_monitor = empathy_camera_monitor_dup_singleton ();
+
+  g_object_bind_property (priv->camera_monitor, "available",
+      priv->camera_button, "sensitive",
+      G_BINDING_SYNC_CREATE);
+
   priv->lock = g_mutex_new ();
 
   gtk_container_add (GTK_CONTAINER (self), top_vbox);
@@ -1644,6 +1653,7 @@ empathy_call_window_dispose (GObject *object)
   tp_clear_object (&priv->video_tee);
   tp_clear_object (&priv->ui_manager);
   tp_clear_object (&priv->fullscreen);
+  tp_clear_object (&priv->camera_monitor);
 
   g_list_free_full (priv->notifiers, g_object_unref);
 
@@ -2315,7 +2325,8 @@ empathy_call_window_state_changed_cb (EmpathyCallHandler *handler,
   empathy_sound_manager_stop (priv->sound_mgr, EMPATHY_SOUND_PHONE_OUTGOING);
 
   can_send_video = priv->video_input != NULL &&
-    empathy_contact_can_voip_video (priv->contact);
+    empathy_contact_can_voip_video (priv->contact) &&
+    empathy_camera_monitor_get_available (priv->camera_monitor);
 
   g_object_get (priv->handler, "call-channel", &call, NULL);