static void account_manager_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { EmpathyIdle *idle = user_data; TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object); EmpathyIdlePriv *priv; TpConnectionPresenceType state; gchar *status, *status_message; GList *accounts, *l; GError *error = NULL; /* In case we've been finalized before reading this callback */ if (idle_singleton == NULL) return; priv = GET_PRIV (idle); 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); return; } state = tp_account_manager_get_most_available_presence (priv->manager, &status, &status_message); idle_presence_changed_cb (account_manager, state, status, status_message, idle); accounts = tp_account_manager_get_valid_accounts (priv->manager); for (l = accounts; l != NULL; l = l->next) { empathy_signal_connect_weak (l->data, "status-changed", G_CALLBACK (account_status_changed_cb), G_OBJECT (idle)); } g_list_free (accounts); g_free (status); g_free (status_message); }
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); }