diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-03-12 07:27:46 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-03-12 07:27:46 +0800 |
commit | f385c7c54a991021b0cbdb4dc7f49ac299824071 (patch) | |
tree | 9c8df71ee2035856f9a4e8bcee51d92d92143843 /mail/mail-callbacks.c | |
parent | ef9df95977647014c1b47e01c1e884db7341fc9c (diff) | |
download | gsoc2013-evolution-f385c7c54a991021b0cbdb4dc7f49ac299824071.tar.gz gsoc2013-evolution-f385c7c54a991021b0cbdb4dc7f49ac299824071.tar.zst gsoc2013-evolution-f385c7c54a991021b0cbdb4dc7f49ac299824071.zip |
Added protection.
2001-03-11 Jeffrey Stedfast <fejj@ximian.com>
* mail-ops.h: Added protection.
* folder-browser-factory.c: Add ActionsEmptyTrash. By the way -
should we rename the bonobo verbs now that our menu structure has
changed?
* mail-callbacks.c (empty_trash): New callback to empty ALL of the
trash folders.
svn path=/trunk/; revision=8633
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r-- | mail/mail-callbacks.c | 63 |
1 files changed, 61 insertions, 2 deletions
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 31a3b5513d..2f5292c4b2 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -1397,11 +1397,70 @@ edit_message (BonoboUIComponent *uih, void *user_data, const char *path) } void -stop_threads(BonoboUIComponent *uih, void *user_data, const char *path) +stop_threads (BonoboUIComponent *uih, void *user_data, const char *path) { - camel_operation_cancel(NULL); + camel_operation_cancel (NULL); } +static void +empty_trash_expunged_cb (CamelFolder *folder, void *data) +{ + camel_object_unref (CAMEL_OBJECT (folder)); +} + +void +empty_trash (BonoboUIComponent *uih, void *user_data, const char *path) +{ + MailConfigAccount *account; + CamelProvider *provider; + CamelService *service; + CamelFolder *vtrash; + const GSList *accounts; + CamelException *ex; + + ex = camel_exception_new (); + + /* expunge all remote stores */ + accounts = mail_config_get_accounts (); + while (accounts) { + account = accounts->data; + + /* make sure this is a valid source */ + if (account->source && account->source->url) { + service = camel_session_get_service (session, account->source->url, + CAMEL_PROVIDER_STORE, ex); + + if (service) { + provider = camel_service_get_provider (service); + + /* make sure this store is a remote store */ + if (provider->flags & CAMEL_PROVIDER_IS_STORAGE && + provider->flags & CAMEL_PROVIDER_IS_REMOTE) { + char *url; + + url = g_strdup_printf ("vtrash:%s", account->source->url); + vtrash = mail_tool_uri_to_folder (url, ex); + g_free (url); + + if (vtrash) + mail_expunge_folder (vtrash, empty_trash_expunged_cb, NULL); + } + + camel_object_unref (CAMEL_OBJECT (service)); + } + } + + camel_exception_clear (ex); + accounts = accounts->next; + } + + /* Now empty the local trash folder */ + vtrash = mail_tool_uri_to_folder ("vtrash:file:/", ex); + if (vtrash) + mail_expunge_folder (vtrash, empty_trash_expunged_cb, NULL); + + camel_exception_free (ex); +} static void create_folders (EvolutionStorage *storage, const char *prefix, CamelFolderInfo *fi) |