]> git.0d.be Git - empathy.git/commitdiff
[EmpathyIdle] track whether the AccountManager is ready, warn if it is not
authorDanielle Madeley <danielle.madeley@collabora.co.uk>
Mon, 9 Nov 2009 09:21:00 +0000 (20:21 +1100)
committerDanielle Madeley <danielle.madeley@collabora.co.uk>
Mon, 9 Nov 2009 09:21:00 +0000 (20:21 +1100)
libempathy/empathy-idle.c

index 8a0fcd88d1bcebc3904cb3fc352eeb4de4632d56..9889f1fdb3f42e20786b4e6c0e97c7b2f14a809a 100644 (file)
@@ -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;
 }