[empathy] [EmpathyIdle] track whether the AccountManager is ready, warn if it is not



commit a74847a856efacde2142507fde3f7278e04a2f7c
Author: Danielle Madeley <danielle madeley collabora co uk>
Date:   Mon Nov 9 20:21:00 2009 +1100

    [EmpathyIdle] track whether the AccountManager is ready, warn if it is not

 libempathy/empathy-idle.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c
index 8a0fcd8..9889f1f 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;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]