aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2009-08-19 18:51:47 +0800
committerJonny Lamb <jonny.lamb@collabora.co.uk>2009-08-19 18:51:47 +0800
commit4080b07d140362f0d2888d0baf6a4ecf60e8ea2a (patch)
tree02b33f3ebf369b0f05c0800fd75083137228bb77 /libempathy-gtk
parent394527fe9f0394c41fcf980bba3668d84434040f (diff)
downloadgsoc2013-empathy-4080b07d140362f0d2888d0baf6a4ecf60e8ea2a.tar
gsoc2013-empathy-4080b07d140362f0d2888d0baf6a4ecf60e8ea2a.tar.gz
gsoc2013-empathy-4080b07d140362f0d2888d0baf6a4ecf60e8ea2a.tar.bz2
gsoc2013-empathy-4080b07d140362f0d2888d0baf6a4ecf60e8ea2a.tar.lz
gsoc2013-empathy-4080b07d140362f0d2888d0baf6a4ecf60e8ea2a.tar.xz
gsoc2013-empathy-4080b07d140362f0d2888d0baf6a4ecf60e8ea2a.tar.zst
gsoc2013-empathy-4080b07d140362f0d2888d0baf6a4ecf60e8ea2a.zip
empathy-presence-chooser: make chooser insensitive when there's no connection
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-presence-chooser.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c
index 7c5850af8..b0668196b 100644
--- a/libempathy-gtk/empathy-presence-chooser.c
+++ b/libempathy-gtk/empathy-presence-chooser.c
@@ -35,6 +35,7 @@
#include <telepathy-glib/util.h>
+#include <libempathy/empathy-connectivity.h>
#include <libempathy/empathy-idle.h>
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-status-presets.h>
@@ -98,6 +99,7 @@ typedef enum {
typedef struct {
EmpathyIdle *idle;
+ EmpathyConnectivity *connectivity;
gboolean editing_status;
int block_set_editing;
@@ -710,6 +712,15 @@ presence_chooser_entry_focus_out_cb (EmpathyPresenceChooser *chooser,
}
static void
+presence_chooser_connectivity_state_change (EmpathyConnectivity *connectivity,
+ gboolean old_online,
+ gboolean new_online,
+ EmpathyPresenceChooser *chooser)
+{
+ gtk_widget_set_sensitive (GTK_WIDGET (chooser), new_online);
+}
+
+static void
empathy_presence_chooser_init (EmpathyPresenceChooser *chooser)
{
EmpathyPresenceChooserPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (chooser,
@@ -780,6 +791,13 @@ empathy_presence_chooser_init (EmpathyPresenceChooser *chooser)
/* FIXME: this string sucks */
gtk_widget_set_tooltip_text (GTK_WIDGET (chooser),
_("Set your presence and current status"));
+
+ priv->connectivity = empathy_connectivity_dup_singleton ();
+ g_signal_connect (priv->connectivity, "state-change",
+ G_CALLBACK (presence_chooser_connectivity_state_change),
+ chooser);
+ presence_chooser_connectivity_state_change (priv->connectivity, FALSE,
+ empathy_connectivity_is_online (priv->connectivity), chooser);
}
static void
@@ -802,6 +820,12 @@ presence_chooser_finalize (GObject *object)
object);
g_object_unref (priv->idle);
+ g_signal_handlers_disconnect_by_func (priv->connectivity,
+ presence_chooser_connectivity_state_change,
+ object);
+
+ g_object_unref (priv->connectivity);
+
G_OBJECT_CLASS (empathy_presence_chooser_parent_class)->finalize (object);
}