X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-tny-account-store.c;h=f2c597c6c997409ad231691bd4ce36ce4964dcd2;hp=f216937887c4cef12ec339224dcac2dbb4553858;hb=77565d3812bffa7fa25c44a394d696e477a7fdc0;hpb=02102b8b1899e7a60565e6f2f0f7373b408ce99f diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index f216937..f2c597c 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -689,13 +689,18 @@ get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *canc } if (settings_have_password) { - /* The password must be wrong, so show the account settings dialog so it can be corrected: */ - show_wrong_password_dialog (account, TRUE); + if (pwd) { + /* The password must be wrong, so show the account settings dialog so it can be corrected: */ + show_wrong_password_dialog (account, TRUE); - if (cancel) - *cancel = TRUE; + if (cancel) + *cancel = TRUE; - return NULL; + return NULL; + } else { + /* Get the password from the account settings */ + return modest_account_mgr_get_server_account_password (priv->account_mgr, server_account_name); + } } /* we don't have it yet. Get the password from the user */ @@ -2150,8 +2155,6 @@ account_shutdown_callback (TnyCamelAccount *account, gboolean canceled, GError * op_data->callback (op_data->account_store, op_data->userdata); g_object_unref (op_data->account_store); g_free (op_data); - } else { - g_object_unref (op_data->account_store); } } @@ -2161,19 +2164,15 @@ account_shutdown (TnyAccount *account, ShutdownOpData *op_data) g_return_if_fail (account && TNY_IS_ACCOUNT(account)); if (TNY_IS_STORE_ACCOUNT (account) && - !modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (account))) - goto frees; - - /* Disconnect account */ - if (tny_account_get_connection_status (account) == TNY_CONNECTION_STATUS_CONNECTED) { - tny_camel_account_set_online (TNY_CAMEL_ACCOUNT(account), FALSE, - account_shutdown_callback, op_data); + !modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (account))) { + op_data->pending--; return; } - frees: - op_data->pending--; - g_object_unref (op_data->account_store); + /* Disconnect account */ + tny_camel_account_set_online (TNY_CAMEL_ACCOUNT(account), FALSE, + account_shutdown_callback, op_data); + } @@ -2182,7 +2181,7 @@ modest_tny_account_store_shutdown (ModestTnyAccountStore *self, ModestTnyAccountStoreShutdownCallback callback, gpointer userdata) { - gint i, num_accounts; + gint num_accounts; ShutdownOpData *op_data; ModestTnyAccountStorePrivate *priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE (self); @@ -2193,15 +2192,16 @@ modest_tny_account_store_shutdown (ModestTnyAccountStore *self, if (priv->transport_accounts) num_accounts += tny_list_get_length (priv->transport_accounts); - for (i = 0 ; i < num_accounts ; i++) - g_object_ref (self); - /* Create the helper object */ op_data = g_new0 (ShutdownOpData, 1); op_data->callback = callback; op_data->userdata = userdata; op_data->pending = num_accounts; - op_data->account_store = self; + op_data->account_store = g_object_ref (self); + + /* Force the TnyDevice to be offline. This way new + undesired connections won't be initiated */ + tny_device_force_offline (priv->device); /* Destroy all accounts. Disconnect all accounts before they are destroyed */ if (priv->store_accounts) { @@ -2215,6 +2215,7 @@ modest_tny_account_store_shutdown (ModestTnyAccountStore *self, if (op_data->pending == 0) { if (op_data->callback) op_data->callback (op_data->account_store, op_data->userdata); + g_object_unref (op_data->account_store); g_free (op_data); } }