From 84cfc5b80c4d3845b41358d68e33383c2c66a566 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 8 Jul 2012 14:16:27 -0400 Subject: Add e_mail_reader_refresh_folder(). To replace mail_refresh_folder(). --- mail/e-mail-reader-utils.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++ mail/e-mail-reader-utils.h | 2 ++ mail/mail.error.xml | 5 ++++ 3 files changed, 64 insertions(+) diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index 6d1e1bb177..6d52be1534 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -377,6 +377,63 @@ e_mail_reader_delete_folder_name (EMailReader *reader, context); } +/* Helper for e_mail_reader_refresh_folder() */ +static void +mail_reader_refresh_folder_cb (GObject *source_object, + GAsyncResult *result, + gpointer user_data) +{ + CamelFolder *folder; + AsyncContext *context; + EAlertSink *alert_sink; + GError *error = NULL; + + folder = CAMEL_FOLDER (source_object); + context = (AsyncContext *) user_data; + + alert_sink = e_activity_get_alert_sink (context->activity); + + if (e_activity_handle_cancellation (context->activity, error)) { + g_error_free (error); + + } else if (error != NULL) { + e_alert_submit ( + alert_sink, "mail:no-refresh-folder", + camel_folder_get_display_name (folder), + error->message, NULL); + g_error_free (error); + + } else { + e_activity_set_state ( + context->activity, E_ACTIVITY_COMPLETED); + } + + async_context_free (context); +} + +void +e_mail_reader_refresh_folder (EMailReader *reader, + CamelFolder *folder) +{ + EActivity *activity; + AsyncContext *context; + GCancellable *cancellable; + + g_return_if_fail (E_IS_MAIL_READER (reader)); + g_return_if_fail (CAMEL_IS_FOLDER (folder)); + + 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); + + camel_folder_refresh_info ( + folder, G_PRIORITY_DEFAULT, cancellable, + mail_reader_refresh_folder_cb, context); +} + /* Helper for e_mail_reader_unsubscribe_folder_name() */ static void mail_reader_unsubscribe_folder_name_cb (GObject *source_object, diff --git a/mail/e-mail-reader-utils.h b/mail/e-mail-reader-utils.h index c75d7d760f..21006deacb 100644 --- a/mail/e-mail-reader-utils.h +++ b/mail/e-mail-reader-utils.h @@ -43,6 +43,8 @@ void e_mail_reader_delete_folder_name (EMailReader *reader, CamelStore *store, const gchar *folder_name); +void e_mail_reader_refresh_folder (EMailReader *reader, + CamelFolder *folder); void e_mail_reader_unsubscribe_folder_name (EMailReader *reader, CamelStore *store, diff --git a/mail/mail.error.xml b/mail/mail.error.xml index ed3856e51a..a41d4a4458 100644 --- a/mail/mail.error.xml +++ b/mail/mail.error.xml @@ -195,6 +195,11 @@ Many email systems add an Apparently-To header to messages that only have BCC re <_secondary xml:space="preserve">System folders are required for Evolution to function correctly and cannot be renamed, moved, or deleted. + + <_primary>Failed to refresh folder "{0}". + <_secondary>The reported error was "{1}". + + <_primary>Cannot rename or move system folder "{0}". <_secondary xml:space="preserve">System folders are required for Evolution to function correctly and cannot be renamed, moved, or deleted. -- cgit v1.2.3