diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-05-17 10:43:46 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-05-17 10:43:46 +0800 |
commit | b61d2c08d7f16171e3c6a2ddb4759a2a2803aaf3 (patch) | |
tree | 2d523fb23c6f77f47f430ad9bc2af9e7f9dd9aa5 /mail/e-mail-reader-utils.c | |
parent | 41337195f36e4795d7976df4e07a11ff336cd89c (diff) | |
download | gsoc2013-evolution-b61d2c08d7f16171e3c6a2ddb4759a2a2803aaf3.tar.gz gsoc2013-evolution-b61d2c08d7f16171e3c6a2ddb4759a2a2803aaf3.tar.zst gsoc2013-evolution-b61d2c08d7f16171e3c6a2ddb4759a2a2803aaf3.zip |
Remove mail_remove_attachments().
Use e_mail_folder_remove_attachments() instead.
Diffstat (limited to 'mail/e-mail-reader-utils.c')
-rw-r--r-- | mail/e-mail-reader-utils.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index 6df8ebe71d..281acbbe52 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -422,6 +422,69 @@ e_mail_reader_print (EMailReader *reader, } static void +mail_reader_remove_attachments_cb (CamelFolder *folder, + GAsyncResult *result, + AsyncContext *context) +{ + EAlertSink *alert_sink; + GError *error = NULL; + + alert_sink = e_mail_reader_get_alert_sink (context->reader); + + e_mail_folder_remove_attachments_finish (folder, result, &error); + + if (e_activity_handle_cancellation (context->activity, error)) { + g_error_free (error); + + } else if (error != NULL) { + e_alert_submit ( + alert_sink, + "mail:remove-attachments", + error->message, NULL); + g_error_free (error); + } + + async_context_free (context); +} + +void +e_mail_reader_remove_attachments (EMailReader *reader) +{ + EActivity *activity; + AsyncContext *context; + GCancellable *cancellable; + CamelFolder *folder; + GPtrArray *uids; + + g_return_if_fail (E_IS_MAIL_READER (reader)); + + folder = e_mail_reader_get_folder (reader); + uids = e_mail_reader_get_selected_uids (reader); + g_return_if_fail (uids != NULL); + + /* XXX Either e_mail_reader_get_selected_uids() + * or MessageList should do this itself. */ + g_ptr_array_set_free_func (uids, (GDestroyNotify) g_free); + + /* Remove attachments asynchronously. */ + + activity = e_mail_reader_new_activity (reader); + cancellable = e_activity_get_cancellable (activity); + + context = g_slice_new0 (AsyncContext); + context->activity = activity; + context->reader = g_object_ref (reader); + + e_mail_folder_remove_attachments ( + folder, uids, G_PRIORITY_DEFAULT, + cancellable, (GAsyncReadyCallback) + mail_reader_remove_attachments_cb, + context); + + g_ptr_array_unref (uids); +} + +static void mail_reader_remove_duplicates_cb (CamelFolder *folder, GAsyncResult *result, AsyncContext *context) |