aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-05-11 17:37:43 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-07-12 17:11:14 +0800
commitc463ca2f1aa7ba43248b8f07879c4268cb536670 (patch)
treee161277f12eb6c14b1d37a36b9dff0baa5ca50bc /libempathy-gtk
parentfe7e98c6222fae967005ca81042963118953fd43 (diff)
downloadgsoc2013-empathy-c463ca2f1aa7ba43248b8f07879c4268cb536670.tar
gsoc2013-empathy-c463ca2f1aa7ba43248b8f07879c4268cb536670.tar.gz
gsoc2013-empathy-c463ca2f1aa7ba43248b8f07879c4268cb536670.tar.bz2
gsoc2013-empathy-c463ca2f1aa7ba43248b8f07879c4268cb536670.tar.lz
gsoc2013-empathy-c463ca2f1aa7ba43248b8f07879c4268cb536670.tar.xz
gsoc2013-empathy-c463ca2f1aa7ba43248b8f07879c4268cb536670.tar.zst
gsoc2013-empathy-c463ca2f1aa7ba43248b8f07879c4268cb536670.zip
LogWindow: disable Video calls if no camera connected
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-log-window.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index 8d3fcd838..6cff6beb9 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -43,6 +43,7 @@
#include <extensions/extensions.h>
#include <libempathy/action-chain-internal.h>
+#include <libempathy/empathy-camera-monitor.h>
#include <libempathy/empathy-chatroom-manager.h>
#include <libempathy/empathy-chatroom.h>
#include <libempathy/empathy-message.h>
@@ -102,6 +103,9 @@ struct _EmpathyLogWindowPriv
EmpathyContact *selected_contact;
+ EmpathyCameraMonitor *camera_monitor;
+ GBinding *button_video_binding;
+
/* Used to cancel logger calls when no longer needed */
guint count;
@@ -404,6 +408,7 @@ empathy_log_window_dispose (GObject *object)
tp_clear_object (&self->priv->log_manager);
tp_clear_object (&self->priv->selected_account);
tp_clear_object (&self->priv->selected_contact);
+ tp_clear_object (&self->priv->camera_monitor);
G_OBJECT_CLASS (empathy_log_window_parent_class)->dispose (object);
}
@@ -446,6 +451,8 @@ empathy_log_window_init (EmpathyLogWindow *self)
self->priv->chain = _tpl_action_chain_new_async (NULL, NULL, NULL);
+ self->priv->camera_monitor = empathy_camera_monitor_dup_singleton ();
+
self->priv->log_manager = tpl_log_manager_dup_singleton ();
gtk_window_set_title (GTK_WINDOW (self), _("History"));
@@ -1854,6 +1861,7 @@ log_window_update_buttons_sensitivity (EmpathyLogWindow *self)
gboolean profile, chat, call, video;
tp_clear_object (&self->priv->selected_contact);
+ tp_clear_object (&self->priv->button_video_binding);
view = GTK_TREE_VIEW (self->priv->treeview_who);
model = gtk_tree_view_get_model (view);
@@ -1927,11 +1935,20 @@ log_window_update_buttons_sensitivity (EmpathyLogWindow *self)
call = capabilities & EMPATHY_CAPABILITIES_AUDIO;
video = capabilities & EMPATHY_CAPABILITIES_VIDEO;
+ if (video)
+ self->priv->button_video_binding = g_object_bind_property (
+ self->priv->camera_monitor, "available",
+ self->priv->button_video, "sensitive",
+ G_BINDING_SYNC_CREATE);
+
out:
gtk_widget_set_sensitive (self->priv->button_profile, profile);
gtk_widget_set_sensitive (self->priv->button_chat, chat);
gtk_widget_set_sensitive (self->priv->button_call, call);
- gtk_widget_set_sensitive (self->priv->button_video, video);
+
+ /* Don't override the binding */
+ if (!video)
+ gtk_widget_set_sensitive (self->priv->button_video, video);
}
static void