From 7ebb69efa28ff4274bf1f0b3aeba8d271c6c1d09 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 6 Aug 2001 16:48:42 +0000 Subject: Yuck. Special case whether or not we want to expunge all the trash folders 2001-08-06 Jeffrey Stedfast * mail-callbacks.c (empty_trash): Yuck. Special case whether or not we want to expunge all the trash folders syncronously or asyncronously based on whether or not we are doing Empty-On-Exit or emptying trash by user request respectively. svn path=/trunk/; revision=11701 --- mail/ChangeLog | 7 +++++++ mail/component-factory.c | 2 +- mail/mail-callbacks.c | 35 +++++++++++++++++++++++++---------- 3 files changed, 33 insertions(+), 11 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index c502ff40f9..96af73c18a 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2001-08-06 Jeffrey Stedfast + + * mail-callbacks.c (empty_trash): Yuck. Special case whether or + not we want to expunge all the trash folders syncronously or + asyncronously based on whether or not we are doing Empty-On-Exit + or emptying trash by user request respectively. + 2001-08-06 Jason Leach * mail-folder-cache.c (make_folder_name): Removed this function, diff --git a/mail/component-factory.c b/mail/component-factory.c index 4c947c1fa1..4275079894 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -682,7 +682,7 @@ static void debug_cb (EvolutionShellComponent *shell_component, gpointer user_data) { extern gboolean camel_verbose_debug; - + camel_verbose_debug = 1; } diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index ccb9977bbc..e1bb896ba5 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -2019,9 +2019,13 @@ empty_trash (BonoboUIComponent *uih, void *user_data, const char *path) CamelProvider *provider; CamelFolder *vtrash; const GSList *accounts; - CamelException *ex; + CamelException ex; + gboolean async; - ex = camel_exception_new (); + /* the only time all three args are NULL is for empty-on-exit */ + async = !(uih == NULL && user_data == NULL && path == NULL); + + camel_exception_init (&ex); /* expunge all remote stores */ accounts = mail_config_get_accounts (); @@ -2030,27 +2034,38 @@ empty_trash (BonoboUIComponent *uih, void *user_data, const char *path) /* make sure this is a valid source */ if (account->source && account->source->url) { - provider = camel_session_get_provider (session, account->source->url, NULL); + provider = camel_session_get_provider (session, account->source->url, &ex); if (provider) { /* make sure this store is a remote store */ if (provider->flags & CAMEL_PROVIDER_IS_STORAGE && provider->flags & CAMEL_PROVIDER_IS_REMOTE) { - vtrash = mail_tool_get_trash (account->source->url, NULL); + vtrash = mail_tool_get_trash (account->source->url, &ex); - if (vtrash) - mail_expunge_folder (vtrash, empty_trash_expunged_cb, NULL); + if (vtrash) { + if (async) + mail_expunge_folder (vtrash, empty_trash_expunged_cb, NULL); + else + camel_folder_sync (vtrash, TRUE, NULL); + } } } + + /* clear the exception for the next round */ + camel_exception_clear (&ex); } accounts = accounts->next; } /* Now empty the local trash folder */ - vtrash = mail_tool_get_trash ("file:/", ex); - if (vtrash) - mail_expunge_folder (vtrash, empty_trash_expunged_cb, NULL); + vtrash = mail_tool_get_trash ("file:/", &ex); + if (vtrash) { + if (async) + mail_expunge_folder (vtrash, empty_trash_expunged_cb, NULL); + else + camel_folder_sync (vtrash, TRUE, NULL); + } - camel_exception_free (ex); + camel_exception_clear (&ex); } static void -- cgit v1.2.3