aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-09-16 20:23:13 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-09-16 20:29:39 +0800
commit1ce2aa6b4cf7d049fd3c51784ff447d608cd1084 (patch)
treeaa14df9d28da65d466c60bad97759f6600a5d275
parent49f3411a5c414ec1a6a7cf68de9ef7c8c8cb7938 (diff)
downloadgsoc2013-empathy-1ce2aa6b4cf7d049fd3c51784ff447d608cd1084.tar.gz
gsoc2013-empathy-1ce2aa6b4cf7d049fd3c51784ff447d608cd1084.tar.zst
gsoc2013-empathy-1ce2aa6b4cf7d049fd3c51784ff447d608cd1084.zip
avatar-chooser: disable 'take picture' button if there is no camera connected
https://bugzilla.gnome.org/show_bug.cgi?id=652985
-rw-r--r--libempathy-gtk/empathy-avatar-chooser.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-avatar-chooser.c b/libempathy-gtk/empathy-avatar-chooser.c
index 62ff491ea..0fe972481 100644
--- a/libempathy-gtk/empathy-avatar-chooser.c
+++ b/libempathy-gtk/empathy-avatar-chooser.c
@@ -28,6 +28,7 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
+#include <libempathy/empathy-camera-monitor.h>
#include <libempathy/empathy-gsettings.h>
#include <libempathy/empathy-utils.h>
@@ -923,6 +924,10 @@ avatar_chooser_clicked_cb (GtkWidget *button,
const gchar *default_dir = DEFAULT_DIR;
const gchar *pics_dir;
GtkFileFilter *filter;
+#ifdef HAVE_CHEESE
+ GtkWidget *picture_button;
+ EmpathyCameraMonitor *monitor;
+#endif
if (self->priv->chooser_dialog != NULL)
{
@@ -937,8 +942,18 @@ avatar_chooser_clicked_cb (GtkWidget *button,
NULL, NULL));
#ifdef HAVE_CHEESE
- gtk_dialog_add_button (GTK_DIALOG (self->priv->chooser_dialog),
+ picture_button = gtk_dialog_add_button (
+ GTK_DIALOG (self->priv->chooser_dialog),
_("Take a picture..."), EMPATHY_AVATAR_CHOOSER_RESPONSE_WEBCAM);
+
+ /* Button is sensitive only if there is one camera connected */
+ monitor = empathy_camera_monitor_dup_singleton ();
+
+ g_object_set_data_full (G_OBJECT (picture_button),
+ "monitor", monitor, g_object_unref);
+
+ g_object_bind_property (monitor, "available", picture_button, "sensitive",
+ G_BINDING_SYNC_CREATE);
#endif
gtk_dialog_add_buttons (GTK_DIALOG (self->priv->chooser_dialog),