-static void
-quit_wait_loop (TnyAccount *account,
- ConnectAndWaitData *data)
-{
- /* Set the has_callback to TRUE (means that the callback was
- executed and wake up every code waiting for cond to be
- TRUE */
- g_mutex_lock (data->mutex);
- data->has_callback = TRUE;
- if (data->wait_loop)
- g_main_loop_quit (data->wait_loop);
- g_mutex_unlock (data->mutex);
-}
-
-static void
-on_connection_status_changed (TnyAccount *account,
- TnyConnectionStatus status,
- gpointer user_data)
-{
- TnyConnectionStatus conn_status;
- ConnectAndWaitData *data;
-
- /* Ignore if reconnecting or disconnected */
- conn_status = tny_account_get_connection_status (account);
- if (conn_status == TNY_CONNECTION_STATUS_RECONNECTING ||
- conn_status == TNY_CONNECTION_STATUS_DISCONNECTED)
- return;
-
- /* Remove the handler */
- data = (ConnectAndWaitData *) user_data;
- g_signal_handler_disconnect (account, data->handler);
-
- /* Quit from wait loop */
- quit_wait_loop (account, (ConnectAndWaitData *) user_data);
-}
-
-static void
-on_tny_camel_account_set_online_cb (TnyCamelAccount *account,
- gboolean canceled,
- GError *err,
- gpointer user_data)
-{
- /* Quit from wait loop */
- quit_wait_loop (TNY_ACCOUNT (account), (ConnectAndWaitData *) user_data);
-}
-