aboutsummaryrefslogtreecommitdiffstats
path: root/mail/e-mail-store-utils.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-18 00:08:07 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:42:16 +0800
commitdba093c80487fbaeef12b7d34081b70acd844657 (patch)
tree61415e77ce27244e3683e71f4c786a2d64604246 /mail/e-mail-store-utils.c
parentd1777cbb0f2439a64edbbb3ab88b0f1b233e9a05 (diff)
downloadgsoc2013-evolution-dba093c80487fbaeef12b7d34081b70acd844657.tar
gsoc2013-evolution-dba093c80487fbaeef12b7d34081b70acd844657.tar.gz
gsoc2013-evolution-dba093c80487fbaeef12b7d34081b70acd844657.tar.bz2
gsoc2013-evolution-dba093c80487fbaeef12b7d34081b70acd844657.tar.lz
gsoc2013-evolution-dba093c80487fbaeef12b7d34081b70acd844657.tar.xz
gsoc2013-evolution-dba093c80487fbaeef12b7d34081b70acd844657.tar.zst
gsoc2013-evolution-dba093c80487fbaeef12b7d34081b70acd844657.zip
Remove mail_store_prepare_offline().
Use e_mail_store_prepare_for_offline() instead.
Diffstat (limited to 'mail/e-mail-store-utils.c')
-rw-r--r--mail/e-mail-store-utils.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/mail/e-mail-store-utils.c b/mail/e-mail-store-utils.c
index 57304f926d..47c9970c25 100644
--- a/mail/e-mail-store-utils.c
+++ b/mail/e-mail-store-utils.c
@@ -188,3 +188,77 @@ e_mail_store_go_online_finish (CamelStore *store,
/* Assume success unless a GError is set. */
return !g_simple_async_result_propagate_error (simple, error);
}
+
+static void
+mail_store_prepare_for_offline_thread (GSimpleAsyncResult *simple,
+ CamelStore *store,
+ GCancellable *cancellable)
+{
+ CamelService *service;
+ gchar *service_name;
+ GError *error = NULL;
+
+ service = CAMEL_SERVICE (store);
+
+ service_name = camel_service_get_name (service, TRUE);
+ camel_operation_push_message (
+ cancellable, _("Preparing account '%s' for offline"),
+ service_name);
+ g_free (service_name);
+
+ if (CAMEL_IS_DISCO_STORE (store))
+ camel_disco_store_prepare_for_offline (
+ CAMEL_DISCO_STORE (store), cancellable, &error);
+
+ else if (CAMEL_IS_OFFLINE_STORE (store))
+ camel_offline_store_prepare_for_offline_sync (
+ CAMEL_OFFLINE_STORE (store), cancellable, &error);
+
+ if (error != NULL) {
+ g_simple_async_result_set_from_error (simple, error);
+ g_error_free (error);
+ }
+
+ camel_operation_pop_message (cancellable);
+}
+
+void
+e_mail_store_prepare_for_offline (CamelStore *store,
+ gint io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *simple;
+
+ g_return_if_fail (CAMEL_IS_STORE (store));
+
+ simple = g_simple_async_result_new (
+ G_OBJECT (store), callback, user_data,
+ e_mail_store_prepare_for_offline);
+
+ g_simple_async_result_run_in_thread (
+ simple, (GSimpleAsyncThreadFunc)
+ mail_store_prepare_for_offline_thread,
+ io_priority, cancellable);
+
+ g_object_unref (simple);
+}
+
+gboolean
+e_mail_store_prepare_for_offline_finish (CamelStore *store,
+ GAsyncResult *result,
+ GError **error)
+{
+ GSimpleAsyncResult *simple;
+
+ g_return_val_if_fail (
+ g_simple_async_result_is_valid (
+ result, G_OBJECT (store),
+ e_mail_store_prepare_for_offline), FALSE);
+
+ simple = G_SIMPLE_ASYNC_RESULT (result);
+
+ /* Assume success unless a GError is set. */
+ return !g_simple_async_result_propagate_error (simple, error);
+}