static void account_manager_ready_for_accounts_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { TpAccountManager *manager = TP_ACCOUNT_MANAGER (source_object); const gchar *account_id = (const gchar*) user_data; GError *error = NULL; if (!tp_account_manager_prepare_finish (manager, result, &error)) { DEBUG ("Failed to prepare account manager: %s", error->message); g_clear_error (&error); return; } if (account_id != NULL) { gchar *account_path; TpAccount *account = NULL; TpDBusDaemon *bus; /* create and prep the corresponding TpAccount so it's fully ready by the * time we try to select it in the accounts dialog */ account_path = g_strdup_printf ("%s%s", TP_ACCOUNT_OBJECT_PATH_BASE, account_id); bus = tp_dbus_daemon_dup (NULL); if ((account = tp_account_new (bus, account_path, &error))) { tp_account_prepare_async (account, NULL, account_prepare_cb, manager); return; } else { DEBUG ("Failed to find account with path %s: %s", account_path, error->message); g_clear_error (&error); } g_object_unref (bus); g_free (account_path); } else { if (empathy_import_mc4_has_imported ()) { maybe_show_accounts_ui (manager); } else { EmpathyConnectionManagers *cm_mgr = empathy_connection_managers_dup_singleton (); empathy_connection_managers_prepare_async ( cm_mgr, cm_manager_prepared_cb, manager); } } }
static void account_manager_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { TpAccountManager *manager = TP_ACCOUNT_MANAGER (source_object); GError *error = NULL; EmpathyIdle *idle; EmpathyConnectivity *connectivity; gboolean autoconnect = TRUE; if (!tp_account_manager_prepare_finish (manager, result, &error)) { DEBUG ("Failed to prepare account manager: %s", error->message); g_error_free (error); return; } /* Autoconnect */ idle = empathy_idle_dup_singleton (); connectivity = empathy_connectivity_dup_singleton (); empathy_conf_get_bool (empathy_conf_get (), EMPATHY_PREFS_AUTOCONNECT, &autoconnect); if (autoconnect && !no_connect && tp_connection_presence_type_cmp_availability (empathy_idle_get_state (idle), TP_CONNECTION_PRESENCE_TYPE_OFFLINE) <= 0) /* if current state is Offline, then put it online */ empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_AVAILABLE); if (should_create_salut_account (manager) || !empathy_import_mc4_has_imported ()) { EmpathyConnectionManagers *managers; managers = empathy_connection_managers_dup_singleton (); if (!check_connection_managers_ready (managers)) { g_signal_connect (managers, "notify::ready", G_CALLBACK (connection_managers_ready_cb), NULL); } } else if (!start_hidden) { maybe_show_account_assistant (); } g_object_unref (idle); g_object_unref (connectivity); }