aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2009-09-18 18:52:23 +0800
committerJonny Lamb <jonny.lamb@collabora.co.uk>2009-09-18 18:52:23 +0800
commitf06b2c8323486f70643218e13b6ae9bc4206019e (patch)
treee88ab379c7cf382e45b53dbed35bc402640ab3df
parent5694ed583c63202600812a0f19dc2a250e7ef2ae (diff)
parentea8355c99dc527d7602ce7b0c5bf3a83b2a8adaa (diff)
downloadgsoc2013-empathy-f06b2c8323486f70643218e13b6ae9bc4206019e.tar
gsoc2013-empathy-f06b2c8323486f70643218e13b6ae9bc4206019e.tar.gz
gsoc2013-empathy-f06b2c8323486f70643218e13b6ae9bc4206019e.tar.bz2
gsoc2013-empathy-f06b2c8323486f70643218e13b6ae9bc4206019e.tar.lz
gsoc2013-empathy-f06b2c8323486f70643218e13b6ae9bc4206019e.tar.xz
gsoc2013-empathy-f06b2c8323486f70643218e13b6ae9bc4206019e.tar.zst
gsoc2013-empathy-f06b2c8323486f70643218e13b6ae9bc4206019e.zip
Merge branch 'idle-state'
-rw-r--r--libempathy-gtk/empathy-presence-chooser.c2
-rw-r--r--libempathy/empathy-idle.c31
2 files changed, 30 insertions, 3 deletions
diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c
index ba36e091c..373b851d5 100644
--- a/libempathy-gtk/empathy-presence-chooser.c
+++ b/libempathy-gtk/empathy-presence-chooser.c
@@ -785,7 +785,7 @@ empathy_presence_chooser_init (EmpathyPresenceChooser *chooser)
priv->idle = empathy_idle_dup_singleton ();
presence_chooser_presence_changed_cb (chooser);
- g_signal_connect_swapped (priv->idle, "notify",
+ g_signal_connect_swapped (priv->idle, "notify::state",
G_CALLBACK (presence_chooser_presence_changed_cb),
chooser);
diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c
index b8c7784d7..64ec37001 100644
--- a/libempathy/empathy-idle.c
+++ b/libempathy/empathy-idle.c
@@ -410,6 +410,27 @@ empathy_idle_class_init (EmpathyIdleClass *klass)
}
static void
+account_manager_ready_cb (EmpathyAccountManager *account_manager,
+ GParamSpec *pspec,
+ EmpathyIdle *idle)
+{
+ EmpathyIdlePriv *priv;
+ TpConnectionPresenceType state;
+ gchar *status, *status_message;
+
+ priv = GET_PRIV (idle);
+
+ state = empathy_account_manager_get_global_presence (priv->manager,
+ &status, &status_message);
+
+ idle_presence_changed_cb (account_manager, state, status,
+ status_message, idle);
+
+ g_free (status);
+ g_free (status_message);
+}
+
+static void
empathy_idle_init (EmpathyIdle *idle)
{
EmpathyIdlePriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (idle,
@@ -419,8 +440,14 @@ empathy_idle_init (EmpathyIdle *idle)
priv->is_idle = FALSE;
priv->manager = empathy_account_manager_dup_singleton ();
- priv->state = empathy_account_manager_get_global_presence (priv->manager,
- NULL, &priv->status);
+
+ if (empathy_account_manager_is_ready (priv->manager)) {
+ priv->state = empathy_account_manager_get_global_presence (priv->manager,
+ NULL, &priv->status);
+ } else {
+ g_signal_connect (priv->manager, "notify::ready",
+ G_CALLBACK (account_manager_ready_cb), idle);
+ }
g_signal_connect (priv->manager, "global-presence-changed",