diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-07-18 23:23:36 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-07-19 20:36:56 +0800 |
commit | dd4d570b628a19e74546fbbbc9ee2c0e6783c9e7 (patch) | |
tree | cc0216fd70ecc6263dd5448b559e16a476432e99 /libemail-engine/e-mail-store-utils.c | |
parent | f1cc9011fb2b986b5da991764387d03e5fa565c5 (diff) | |
download | gsoc2013-evolution-dd4d570b628a19e74546fbbbc9ee2c0e6783c9e7.tar gsoc2013-evolution-dd4d570b628a19e74546fbbbc9ee2c0e6783c9e7.tar.gz gsoc2013-evolution-dd4d570b628a19e74546fbbbc9ee2c0e6783c9e7.tar.bz2 gsoc2013-evolution-dd4d570b628a19e74546fbbbc9ee2c0e6783c9e7.tar.lz gsoc2013-evolution-dd4d570b628a19e74546fbbbc9ee2c0e6783c9e7.tar.xz gsoc2013-evolution-dd4d570b628a19e74546fbbbc9ee2c0e6783c9e7.tar.zst gsoc2013-evolution-dd4d570b628a19e74546fbbbc9ee2c0e6783c9e7.zip |
Add e_mail_store_go_offline_sync().
Mostly for symmetry with e_mail_store_go_online_sync().
Diffstat (limited to 'libemail-engine/e-mail-store-utils.c')
-rw-r--r-- | libemail-engine/e-mail-store-utils.c | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/libemail-engine/e-mail-store-utils.c b/libemail-engine/e-mail-store-utils.c index ac8e8ea07d..cb33af154e 100644 --- a/libemail-engine/e-mail-store-utils.c +++ b/libemail-engine/e-mail-store-utils.c @@ -160,11 +160,27 @@ mail_store_go_offline_thread (GSimpleAsyncResult *simple, GObject *source_object, GCancellable *cancellable) { + GError *local_error = NULL; + + e_mail_store_go_offline_sync ( + CAMEL_STORE (source_object), cancellable, &local_error); + + if (local_error != NULL) + g_simple_async_result_take_error (simple, local_error); +} + +gboolean +e_mail_store_go_offline_sync (CamelStore *store, + GCancellable *cancellable, + GError **error) +{ CamelService *service; const gchar *display_name; - GError *local_error = NULL; + gboolean success = TRUE; - service = CAMEL_SERVICE (source_object); + g_return_val_if_fail (CAMEL_IS_STORE (store), FALSE); + + service = CAMEL_SERVICE (store); display_name = camel_service_get_display_name (service); if (display_name == NULL || *display_name == '\0') @@ -173,36 +189,32 @@ mail_store_go_offline_thread (GSimpleAsyncResult *simple, camel_operation_push_message ( cancellable, _("Disconnecting from '%s'"), display_name); - if (CAMEL_IS_DISCO_STORE (service)) { + if (CAMEL_IS_DISCO_STORE (store)) { CamelDiscoStore *disco_store; - disco_store = CAMEL_DISCO_STORE (service); + disco_store = CAMEL_DISCO_STORE (store); if (camel_disco_store_can_work_offline (disco_store)) - camel_disco_store_set_status ( + success = camel_disco_store_set_status ( disco_store, CAMEL_DISCO_STORE_OFFLINE, - cancellable, &local_error); + cancellable, error); else - camel_service_disconnect_sync ( - service, TRUE, cancellable, &local_error); + success = camel_service_disconnect_sync ( + service, TRUE, cancellable, error); - } else if (CAMEL_IS_OFFLINE_STORE (service)) { - CamelOfflineStore *offline_store; - - offline_store = CAMEL_OFFLINE_STORE (service); - - camel_offline_store_set_online_sync ( - offline_store, FALSE, cancellable, &local_error); + } else if (CAMEL_IS_OFFLINE_STORE (store)) { + success = camel_offline_store_set_online_sync ( + CAMEL_OFFLINE_STORE (store), + FALSE, cancellable, error); } else { - camel_service_disconnect_sync ( - service, TRUE, cancellable, &local_error); + success = camel_service_disconnect_sync ( + service, TRUE, cancellable, error); } - if (local_error != NULL) - g_simple_async_result_take_error (simple, local_error); - camel_operation_pop_message (cancellable); + + return success; } void |