X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-tny-account-store.c;h=a2716f9aeb15e95af7118036af0136f595ab32a9;hp=2e6c74868c548d21c2a1bbe9c0c6d938d17d858e;hb=e0a4d6a48b122add4f6fee7e62442b6dd6cc9230;hpb=988eb5d471c36275dbb99a608ae2d54babecdcbd diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index 2e6c748..a2716f9 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -312,9 +312,6 @@ account_verify_last_ref (TnyAccount *account, const gchar *str) g_free (txt); } - - - static void foreach_account_append_to_list (gpointer data, gpointer user_data) @@ -511,16 +508,8 @@ show_wrong_password_dialog (TnyAccount *account) { /* This is easier than using a struct for the user_data: */ ModestTnyAccountStore *self = modest_runtime_get_account_store(); - GtkWidget *main_window; GtkWidget *dialog = NULL; - main_window = (GtkWidget *) modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (), - FALSE); /* don't create */ - if (!main_window) { - g_warning ("%s: password was wrong; ignoring because no main window", __FUNCTION__); - return; - } - if (g_object_get_data (G_OBJECT (account), "connection_specific") != NULL) { modest_ui_actions_on_smtp_servers (NULL, NULL); } else { @@ -844,8 +833,6 @@ modest_tny_account_store_finalize (GObject *obj) priv->session = NULL; } - camel_shutdown (); - G_OBJECT_CLASS(parent_class)->finalize (obj); } @@ -910,7 +897,8 @@ modest_tny_account_store_new (ModestAccountMgr *account_mgr, GObject *obj; ModestTnyAccountStorePrivate *priv; TnyAccount *local_account = NULL; - + TnyLockable *lockable; + g_return_val_if_fail (account_mgr, NULL); g_return_val_if_fail (device, NULL); @@ -926,8 +914,10 @@ modest_tny_account_store_new (ModestAccountMgr *account_mgr, return NULL; } - /* Set the ui locker */ - tny_session_camel_set_ui_locker (priv->session, tny_gtk_lockable_new ()); + /* Set the ui locker */ + lockable = tny_gtk_lockable_new (); + tny_session_camel_set_ui_locker (priv->session, lockable); + g_object_unref (lockable); /* Connect signals */ priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers, @@ -1055,7 +1045,7 @@ modest_tny_account_store_alert (TnyAccountStore *self, MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN; const gchar* server_name = ""; gchar *prompt = NULL; - gboolean retval; + gboolean retval = TRUE; /* NOTE: account may be NULL in some cases */ g_return_val_if_fail (error, FALSE); @@ -1144,7 +1134,7 @@ modest_tny_account_store_alert (TnyAccountStore *self, if (error->code == TNY_SERVICE_ERROR_CERTIFICATE) retval = modest_platform_run_certificate_confirmation_dialog (server_name, error->message); - else { + else if (error->code == TNY_SERVICE_ERROR_AUTHENTICATE) { modest_platform_run_information_dialog (NULL, prompt, TRUE); /* Show the account dialog if it was wrong */ @@ -1155,6 +1145,7 @@ modest_tny_account_store_alert (TnyAccountStore *self, retval = TRUE; } + g_debug ("%s: error code %d (%s", __FUNCTION__, error->code, error->message); if (prompt) g_free (prompt); @@ -1877,6 +1868,25 @@ remove_transport_account (ModestTnyAccountStore *self, on_account_disconnect_when_removing, self); } +static gboolean +images_cache_remove_filter (TnyStreamCache *self, const gchar *id, const gchar *account_name) +{ + gchar *account_name_with_separator; + gboolean result; + if (account_name == NULL || account_name[0] == '\0') + return FALSE; + + if (id == NULL || id[0] == '\0') + return FALSE; + + account_name_with_separator = g_strconcat (account_name, "__", NULL); + + result = (g_str_has_prefix (id, account_name)); + g_free (account_name_with_separator); + + return result; +} + static void on_account_removed (ModestAccountMgr *acc_mgr, const gchar *account, @@ -1885,6 +1895,7 @@ on_account_removed (ModestAccountMgr *acc_mgr, TnyAccount *store_account = NULL, *transport_account = NULL; ModestTnyAccountStore *self; ModestTnyAccountStorePrivate *priv; + TnyStreamCache *stream_cache; self = MODEST_TNY_ACCOUNT_STORE (user_data); priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE (self); @@ -1937,6 +1948,10 @@ on_account_removed (ModestAccountMgr *acc_mgr, __FUNCTION__, account); } + /* Remove cached images */ + stream_cache = modest_runtime_get_images_cache (); + tny_stream_cache_remove (stream_cache, (TnyStreamCacheRemoveFilter) images_cache_remove_filter, (gpointer) account); + /* If there are no more user accounts then delete the transport specific SMTP servers */ if (only_local_accounts (self))