aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-07-09 02:16:27 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-07-09 20:44:22 +0800
commit84cfc5b80c4d3845b41358d68e33383c2c66a566 (patch)
treea202540db1065e73ecc97fa3ee3e57b07d83767c /mail
parent9c797884816c948ead7eb93070d639498f321bd4 (diff)
downloadgsoc2013-evolution-84cfc5b80c4d3845b41358d68e33383c2c66a566.tar
gsoc2013-evolution-84cfc5b80c4d3845b41358d68e33383c2c66a566.tar.gz
gsoc2013-evolution-84cfc5b80c4d3845b41358d68e33383c2c66a566.tar.bz2
gsoc2013-evolution-84cfc5b80c4d3845b41358d68e33383c2c66a566.tar.lz
gsoc2013-evolution-84cfc5b80c4d3845b41358d68e33383c2c66a566.tar.xz
gsoc2013-evolution-84cfc5b80c4d3845b41358d68e33383c2c66a566.tar.zst
gsoc2013-evolution-84cfc5b80c4d3845b41358d68e33383c2c66a566.zip
Add e_mail_reader_refresh_folder().
To replace mail_refresh_folder().
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-reader-utils.c57
-rw-r--r--mail/e-mail-reader-utils.h2
-rw-r--r--mail/mail.error.xml5
3 files changed, 64 insertions, 0 deletions
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.</_secondary>
</error>
+ <error id="no-refresh-folder" type="warning">
+ <_primary>Failed to refresh folder &quot;{0}&quot;.</_primary>
+ <_secondary>The reported error was &quot;{1}&quot;.</_secondary>
+ </error>
+
<error id="no-rename-special-folder" type="error">
<_primary>Cannot rename or move system folder "{0}".</_primary>
<_secondary xml:space="preserve">System folders are required for Evolution to function correctly and cannot be renamed, moved, or deleted.</_secondary>