From a74847a856efacde2142507fde3f7278e04a2f7c Mon Sep 17 00:00:00 2001 From: Danielle Madeley Date: Mon, 9 Nov 2009 20:21:00 +1100 Subject: [EmpathyIdle] track whether the AccountManager is ready, warn if it is not --- libempathy/empathy-idle.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'libempathy') diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c index 8a0fcd88d..9889f1fdb 100644 --- a/libempathy/empathy-idle.c +++ b/libempathy/empathy-idle.c @@ -50,6 +50,8 @@ typedef struct { EmpathyConnectivity *connectivity; gulong state_change_signal_id; + gboolean ready; + TpConnectionPresenceType state; gchar *status; TpConnectionPresenceType flash_state; @@ -482,6 +484,8 @@ account_manager_ready_cb (GObject *source_object, GList *accounts, *l; GError *error = NULL; + priv->ready = TRUE; + if (!tp_account_manager_prepare_finish (account_manager, result, &error)) { DEBUG ("Failed to prepare account manager: %s", error->message); g_error_free (error); @@ -557,6 +561,10 @@ empathy_idle_get_state (EmpathyIdle *idle) priv = GET_PRIV (idle); + if (G_UNLIKELY (!priv->ready)) + g_critical (G_STRLOC ": %s called before AccountManager ready", + G_STRFUNC); + return priv->state; } @@ -578,6 +586,10 @@ empathy_idle_get_status (EmpathyIdle *idle) priv = GET_PRIV (idle); + if (G_UNLIKELY (!priv->ready)) + g_critical (G_STRLOC ": %s called before AccountManager ready", + G_STRFUNC); + if (!priv->status) { return empathy_presence_get_default_message (priv->state); } @@ -603,6 +615,10 @@ empathy_idle_get_flash_state (EmpathyIdle *idle) priv = GET_PRIV (idle); + if (G_UNLIKELY (!priv->ready)) + g_critical (G_STRLOC ": %s called before AccountManager ready", + G_STRFUNC); + return priv->flash_state; } -- cgit v1.2.3