static void account_manager_prepared_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { GList *accounts, *l; TpAccountManager *manager = TP_ACCOUNT_MANAGER (source_object); EmpathyAccountChooser *self = user_data; GError *error = NULL; if (!tp_proxy_prepare_finish (manager, result, &error)) { DEBUG ("Failed to prepare account manager: %s", error->message); g_error_free (error); return; } accounts = tp_account_manager_dup_valid_accounts (manager); for (l = accounts; l != NULL; l = l->next) { TpAccount *account = l->data; account_chooser_account_add_foreach (account, self); tp_g_signal_connect_object (account, "status-changed", G_CALLBACK (account_chooser_status_changed_cb), self, 0); /* We generally use the TpConnection from the account to filter it so, * just relying on the account status is not enough. In some case we the * status change can be notified while the TpConnection is still * preparing. */ tp_g_signal_connect_object (account, "notify::connection", G_CALLBACK (account_connection_notify_cb), self, 0); } g_list_free_full (accounts, g_object_unref); if (self->priv->select_when_ready != NULL) { select_account (self, self->priv->select_when_ready); g_clear_object (&self->priv->select_when_ready); } self->priv->ready = TRUE; g_signal_emit (self, signals[READY], 0); }
/** * empathy_account_chooser_set_account: * @self: an #EmpathyAccountChooser * @account: a #TpAccount * * Sets the currently selected account to @account, if it exists in the list. * * Return value: whether the chooser was set to @account. */ gboolean empathy_account_chooser_set_account (EmpathyAccountChooser *self, TpAccount *account) { if (self->priv->ready) return select_account (self, account); /* Account chooser is not ready yet, we'll try selecting the account once it * is */ g_clear_object (&self->priv->select_when_ready); if (account != NULL) self->priv->select_when_ready = g_object_ref (account); return FALSE; }
void worker::install() { progress_ = 5; emit progress(progress_); run_async_function(export_from_8x_and_uninstall, [this](const installer::error& _err) { if (!_err.is_ok()) { emit error(_err); return; } run_async_function(terminate_process, [this](const installer::error& _err) { if (!_err.is_ok()) { emit error(_err); return; } run_async_function(copy_files, [this](const installer::error& _err) { if (!_err.is_ok()) { emit error(_err); return; } run_async_function(write_registry, [this](const installer::error& _err) { if (!_err.is_ok()) { emit error(_err); return; } run_async_function(create_links, [this](const installer::error& _err) { if (!_err.is_ok()) { emit error(_err); return; } if (get_exported_data().get_accounts().size()) { if (get_exported_data().get_accounts().size() > 1) { emit select_account(); return; } else { get_exported_data().set_exported_account(*get_exported_data().get_accounts().begin()); } } final_install(); }, 85); }, 60); }, 40); }, 30); }, 20 ); }