X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-tny-account-store.c;h=3b82d2fb0f30ced0f6128bcad9518b46d6ff2996;hp=1464f9e7d1f59ef2915718d734fa4011e307f82b;hb=537dbe16313dc2a78d83d772d5d81bcbd0432722;hpb=14a46f61ed269fe8155b0c21f532bde4d9db06f3 diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index 1464f9e..3b82d2f 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -459,11 +459,29 @@ on_account_changed (ModestAccountMgr *acc_mgr, } static void -show_wrong_password_dialog (TnyAccount *account, +show_wrong_password_dialog (TnyAccountStore *self, + TnyAccount *account, gboolean show_banner) { + TnyDevice *device; + gboolean is_online; + g_debug ("%s: %s", __FUNCTION__, tny_account_get_id (account)); + device = tny_account_store_get_device (self); + is_online = tny_device_is_online (device); + g_object_unref (device); + + if (!is_online) { + g_debug ("%s: not showing the acc settings dialog. Device OFFLINE", __FUNCTION__); + return; + } + + if (modest_window_mgr_get_num_windows (modest_runtime_get_window_mgr ()) == 0) { + g_debug ("%s: not showing the account settings dialog. NO windows", __FUNCTION__); + return; + } + if (g_object_get_data (G_OBJECT (account), "connection_specific") != NULL) { modest_ui_actions_on_smtp_servers (NULL, NULL); } else { @@ -653,16 +671,11 @@ get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *canc if (settings_have_password) { if (pwd) { - - /* Never show it if the UI is not launched */ - if (modest_window_mgr_get_num_windows (modest_runtime_get_window_mgr ())) { - g_debug ("%s: going to show the dialog (%d windows)", __FUNCTION__, - modest_window_mgr_get_num_windows (modest_runtime_get_window_mgr ())); - /* The password must be wrong, so show the account settings dialog so it can be corrected: */ - show_wrong_password_dialog (account, TRUE); - } else { - g_debug ("%s: not showing the dialog (no windows)", __FUNCTION__); - } + /* The password must be wrong, so show + the account settings dialog so it + can be corrected: */ + g_debug ("%s: going to show the settings dialog", __FUNCTION__); + show_wrong_password_dialog ((TnyAccountStore *) self, account, TRUE); if (cancel) *cancel = TRUE; @@ -670,7 +683,8 @@ get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *canc return NULL; } else { /* Get the password from the account settings */ - return modest_account_mgr_get_server_account_password (priv->account_mgr, server_account_name); + return modest_account_mgr_get_server_account_password (priv->account_mgr, + server_account_name); } } @@ -870,10 +884,11 @@ volume_path_is_mounted (const gchar* path) static void _bodies_filter (TnyMsg *msg, TnyList *list) { - TnyMimePart *html_part, *text_part; + TnyMimePart *html_part, *text_part, *calendar_part; html_part = modest_tny_msg_find_body_part (msg, TRUE); text_part = modest_tny_msg_find_body_part (msg, FALSE); + calendar_part = modest_tny_msg_find_calendar (msg); if (text_part && TNY_IS_MIME_PART (text_part) && html_part == text_part) { g_object_unref (text_part); @@ -889,6 +904,11 @@ static void _bodies_filter (TnyMsg *msg, TnyList *list) tny_list_prepend (list, G_OBJECT (text_part)); g_object_unref (text_part); } + + if (calendar_part && TNY_IS_MIME_PART (calendar_part)) { + tny_list_prepend (list, G_OBJECT (calendar_part)); + g_object_unref (calendar_part); + } } @@ -1161,27 +1181,20 @@ modest_tny_account_store_alert (TnyAccountStore *self, tny_account_get_id (account)); if (!success) { + gboolean show_banner; + g_debug ("%s: %s alert received (%s)", __FUNCTION__, (error->code == TNY_SERVICE_ERROR_CONNECT) ? "connect" : "aunthenticate", error->message); - modest_platform_run_information_dialog (NULL, prompt, TRUE); - - /* Show the account dialog. Checking the - online status allows us to minimize the - number of times that we incorrectly show - the dialog. Also do not show it if the UI - is not launched */ if (tny_device_is_online (device) && - modest_window_mgr_get_num_windows (modest_runtime_get_window_mgr ())) { - show_wrong_password_dialog (account, - (error->code == TNY_SERVICE_ERROR_CONNECT) ? FALSE : TRUE); - } else { - if (tny_device_is_online (device)) - g_debug ("%s: not showing the dialog (no windows)", __FUNCTION__); - else - g_debug ("%s: not showing the dialog (no connection)", __FUNCTION__); - } + modest_window_mgr_get_num_windows (modest_runtime_get_window_mgr ())) + modest_platform_run_information_dialog (NULL, prompt, TRUE); + + /* Show the account dialog */ + show_banner = (error->code == TNY_SERVICE_ERROR_CONNECT) ? FALSE : TRUE; + g_debug ("%s: going to show settings dialog", __FUNCTION__); + show_wrong_password_dialog (self, account, show_banner); retval = TRUE; } }