diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-07-09 02:16:27 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-07-09 20:44:22 +0800 |
commit | 84cfc5b80c4d3845b41358d68e33383c2c66a566 (patch) | |
tree | a202540db1065e73ecc97fa3ee3e57b07d83767c /mail/e-mail-reader-utils.c | |
parent | 9c797884816c948ead7eb93070d639498f321bd4 (diff) | |
download | gsoc2013-evolution-84cfc5b80c4d3845b41358d68e33383c2c66a566.tar.gz gsoc2013-evolution-84cfc5b80c4d3845b41358d68e33383c2c66a566.tar.zst gsoc2013-evolution-84cfc5b80c4d3845b41358d68e33383c2c66a566.zip |
Add e_mail_reader_refresh_folder().
To replace mail_refresh_folder().
Diffstat (limited to 'mail/e-mail-reader-utils.c')
-rw-r--r-- | mail/e-mail-reader-utils.c | 57 |
1 files changed, 57 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, |