From: Sergio Villar Senin Date: Wed, 2 Apr 2008 17:50:24 +0000 (+0000) Subject: * Fixes NB#82632, show the proper error note when the username is dimmed in the... X-Git-Tag: git_migration_finished~1510 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=c48710f6ec77e4ac1ec76f92a2367839b19adea3 * Fixes NB#82632, show the proper error note when the username is dimmed in the password dialog * Set the username as dimmed properly using the connection policy and do not do it in the send&receive method pmo-trunk-r4364 --- diff --git a/src/modest-default-connection-policy.c b/src/modest-default-connection-policy.c index 214a3e2..e72d478 100644 --- a/src/modest-default-connection-policy.c +++ b/src/modest-default-connection-policy.c @@ -29,10 +29,12 @@ #include #include -#include -#include +#include "modest-default-connection-policy.h" +#include "modest-account-mgr-helpers.h" +#include "modest-runtime.h" #include +#include static GObjectClass *parent_class = NULL; @@ -45,6 +47,12 @@ modest_default_connection_policy_set_current (TnyConnectionPolicy *self, TnyAcco static void modest_default_connection_policy_on_connect (TnyConnectionPolicy *self, TnyAccount *account) { + /* Set the username as succedded */ + if (TNY_IS_STORE_ACCOUNT (account)) + modest_account_mgr_set_server_account_username_has_succeeded (modest_runtime_get_account_mgr (), + tny_account_get_id (account), + TRUE); + return; } diff --git a/src/modest-mail-operation.c b/src/modest-mail-operation.c index 4839f04..ff0b2e3 100644 --- a/src/modest-mail-operation.c +++ b/src/modest-mail-operation.c @@ -1251,7 +1251,7 @@ inbox_refreshed_cb (TnyFolder *inbox, ModestAccountMgr *mgr; ModestAccountRetrieveType retrieve_type; TnyList *new_headers = NULL; - gboolean headers_only, ignore_limit, succeeded; + gboolean headers_only, ignore_limit; TnyTransportAccount *transport_account = NULL; info = (UpdateAccountInfo *) user_data; @@ -1306,8 +1306,6 @@ inbox_refreshed_cb (TnyFolder *inbox, /* Update the last updated key, even if we don't have to get new headers */ modest_account_mgr_set_last_updated (mgr, tny_account_get_id (priv->account), time (NULL)); - if (!canceled && !err) - modest_account_mgr_set_server_account_username_has_succeeded (mgr, tny_account_get_id (priv->account), TRUE); if (new_headers_array->len == 0) goto send_mail; @@ -1377,13 +1375,6 @@ inbox_refreshed_cb (TnyFolder *inbox, g_ptr_array_foreach (new_headers_array, (GFunc) g_object_unref, NULL); g_ptr_array_free (new_headers_array, FALSE); - if (priv->error) - succeeded = FALSE; - else - succeeded = TRUE; - modest_account_mgr_set_server_account_username_has_succeeded (modest_runtime_get_account_mgr (), - tny_account_get_name (priv->account), - succeeded); send_mail: /* Get the transport account */ transport_account = (TnyTransportAccount *) diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index 7a925af..da8e2c4 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -501,17 +501,14 @@ on_account_settings_hide (GtkWidget *widget, gpointer user_data) } static void -show_password_warning_only () +show_password_warning_only (const gchar *msg) { ModestWindow *main_window = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (), FALSE); /* don't create */ /* Show an explanatory temporary banner: */ if (main_window) - modest_platform_information_banner (NULL, NULL, - _("mcen_ib_username_pw_incorrect")); - else - g_warning ("%s: %s", __FUNCTION__, _("mcen_ib_username_pw_incorrect")); + modest_platform_information_banner (NULL, NULL, msg); } static void @@ -662,8 +659,16 @@ get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *canc pwd = NULL; if (already_asked) { - /* Show an info banner, before we show the protected password dialog: */ - show_password_warning_only(); + const gchar *msg; + gboolean username_known = + modest_account_mgr_get_server_account_username_has_succeeded(priv->account_mgr, + server_account_name); + /* If the login has ever succeeded then show a specific message */ + if (username_known) + msg = _("ecdg_ib_set_password_incorrect"); + else + msg = _("mcen_ib_username_pw_incorrect"); + show_password_warning_only (msg); } /* Request password */ @@ -1507,6 +1512,10 @@ connection_status_changed (TnyAccount *account, TnyConnectionStatus status, gpointer data) { + /* We do this here and not in the connection policy because we + don't want to do it for every account, just for the + accounts that are interactively added when modest is + runnning */ if (status == TNY_CONNECTION_STATUS_CONNECTED) { const gchar *account_name; ModestWindow *main_window; @@ -1519,11 +1528,6 @@ connection_status_changed (TnyAccount *account, G_OBJECT (account), "connection_status_changed"); - /* Set the username as succedded */ - modest_account_mgr_set_server_account_username_has_succeeded (modest_runtime_get_account_mgr (), - tny_account_get_id (account), - TRUE); - /* Perform a send receive */ account_name = modest_tny_account_get_parent_modest_account_name_for_server_account (account); main_window = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (), FALSE);