+/* if (info->transport_account) { */
+/* priv->account = g_object_ref (info->transport_account); */
+
+/* send_queue = modest_runtime_get_send_queue (info->transport_account); */
+/* if (send_queue) { */
+/* modest_tny_send_queue_try_to_send (send_queue); */
+/* } else { */
+/* g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR, */
+/* MODEST_MAIL_OPERATION_ERROR_INSTANCE_CREATION_FAILED, */
+/* "cannot create a send queue for %s\n", */
+/* tny_account_get_name (TNY_ACCOUNT (info->transport_account))); */
+/* priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED; */
+/* } */
+/* } */
+
+/* /\* Check if the operation was a success *\/ */
+/* if (!priv->error) { */
+/* priv->status = MODEST_MAIL_OPERATION_STATUS_SUCCESS; */
+
+/* /\* Update the last updated key *\/ */
+/* g_idle_add_full (G_PRIORITY_HIGH_IDLE, */
+/* set_last_updated_idle, */
+/* g_strdup (tny_account_get_id (TNY_ACCOUNT (info->account))), */
+/* (GDestroyNotify) g_free); */
+/* } */
+
+/* out: */
+/* /\* Set the account back to not busy *\/ */
+/* modest_account_mgr_set_account_busy (modest_runtime_get_account_mgr(), */
+/* info->account_name, FALSE); */
+
+/* if (info->callback) { */
+/* UpdateAccountInfo *idle_info; */
+
+/* /\* This thread is not in the main lock *\/ */
+/* idle_info = g_malloc0 (sizeof (UpdateAccountInfo)); */
+/* idle_info->mail_op = g_object_ref (info->mail_op); */
+/* idle_info->new_headers = (new_headers) ? g_object_ref (new_headers) : NULL; */
+/* idle_info->callback = info->callback; */
+/* idle_info->user_data = info->user_data; */
+/* g_idle_add (idle_update_account_cb, idle_info); */
+/* } */
+
+/* /\* Notify about operation end. Note that the info could be */
+/* freed before this idle happens, but the mail operation will */
+/* be still alive *\/ */
+/* g_idle_add (idle_notify_queue, g_object_ref (info->mail_op)); */
+
+/* /\* Frees *\/ */
+/* if (new_headers) */
+/* g_object_unref (new_headers); */
+/* if (all_folders) */
+/* g_object_unref (all_folders); */
+/* g_object_unref (info->account); */
+/* if (info->transport_account) */
+/* g_object_unref (info->transport_account); */
+/* g_free (info->account_name); */
+/* g_free (info->retrieve_type); */
+/* g_slice_free (UpdateAccountInfo, info); */
+
+/* first_time = FALSE; */
+
+/* return NULL; */
+/* } */
+
+/* gboolean */
+/* modest_mail_operation_update_account (ModestMailOperation *self, */
+/* const gchar *account_name, */
+/* UpdateAccountCallback callback, */
+/* gpointer user_data) */
+/* { */
+/* GThread *thread = NULL; */
+/* UpdateAccountInfo *info = NULL; */
+/* ModestMailOperationPrivate *priv = NULL; */
+/* ModestAccountMgr *mgr = NULL; */
+/* TnyStoreAccount *store_account = NULL; */
+/* TnyTransportAccount *transport_account = NULL; */
+
+/* g_return_val_if_fail (MODEST_IS_MAIL_OPERATION (self), FALSE); */
+/* g_return_val_if_fail (account_name, FALSE); */
+
+/* /\* Init mail operation. Set total and done to 0, and do not */
+/* update them, this way the progress objects will know that */
+/* we have no clue about the number of the objects *\/ */
+/* priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self); */
+/* priv->total = 0; */
+/* priv->done = 0; */
+/* priv->status = MODEST_MAIL_OPERATION_STATUS_IN_PROGRESS; */
+/* priv->op_type = MODEST_MAIL_OPERATION_TYPE_RECEIVE; */
+
+/* /\* Get the store account *\/ */
+/* store_account = (TnyStoreAccount *) */
+/* modest_tny_account_store_get_server_account (modest_runtime_get_account_store (), */
+/* account_name, */
+/* TNY_ACCOUNT_TYPE_STORE); */
+
+/* if (!store_account) { */
+/* g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR, */
+/* MODEST_MAIL_OPERATION_ERROR_ITEM_NOT_FOUND, */
+/* "cannot get tny store account for %s\n", account_name); */
+/* goto error; */
+/* } */
+
+/* priv->account = g_object_ref (store_account); */
+
+/* /\* Get the transport account, we can not do it in the thread */
+/* due to some problems with dbus *\/ */
+/* transport_account = (TnyTransportAccount *) */
+/* modest_tny_account_store_get_transport_account_for_open_connection (modest_runtime_get_account_store(), */
+/* account_name); */
+/* if (!transport_account) { */
+/* g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR, */
+/* MODEST_MAIL_OPERATION_ERROR_ITEM_NOT_FOUND, */
+/* "cannot get tny transport account for %s\n", account_name); */
+/* goto error; */
+/* } */
+
+/* /\* Create the helper object *\/ */
+/* info = g_slice_new (UpdateAccountInfo); */
+/* info->mail_op = self; */
+/* info->account = store_account; */
+/* info->transport_account = transport_account; */
+/* info->callback = callback; */
+/* info->account_name = g_strdup (account_name); */
+/* info->user_data = user_data; */
+
+/* /\* Get the message size limit *\/ */
+/* info->max_size = modest_conf_get_int (modest_runtime_get_conf (), */
+/* MODEST_CONF_MSG_SIZE_LIMIT, NULL); */
+/* if (info->max_size == 0) */
+/* info->max_size = G_MAXINT; */
+/* else */
+/* info->max_size = info->max_size * KB; */
+
+/* /\* Get per-account retrieval type *\/ */
+/* mgr = modest_runtime_get_account_mgr (); */
+/* info->retrieve_type = modest_account_mgr_get_retrieve_type (mgr, account_name); */
+
+/* /\* Get per-account message amount retrieval limit *\/ */
+/* info->retrieve_limit = modest_account_mgr_get_retrieve_limit (mgr, account_name); */
+/* if (info->retrieve_limit == 0) */
+/* info->retrieve_limit = G_MAXINT; */
+
+/* /\* printf ("DEBUG: %s: info->retrieve_limit = %d\n", __FUNCTION__, info->retrieve_limit); *\/ */
+
+/* /\* Set account busy *\/ */
+/* modest_account_mgr_set_account_busy(mgr, account_name, TRUE); */
+
+/* modest_mail_operation_notify_start (self); */
+/* thread = g_thread_create (update_account_thread, info, FALSE, NULL); */
+
+/* return TRUE; */
+
+/* error: */
+/* if (store_account) */
+/* g_object_unref (store_account); */
+/* if (transport_account) */
+/* g_object_unref (transport_account); */
+/* priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED; */
+/* if (callback) { */
+/* callback (self, NULL, user_data); */
+/* } */
+/* modest_mail_operation_notify_end (self); */
+/* return FALSE; */
+/* } */