diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-07-18 23:09:44 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-07-19 20:36:56 +0800 |
commit | f1cc9011fb2b986b5da991764387d03e5fa565c5 (patch) | |
tree | b171ef7833a383de8122c7e0a30aeb7ed50385f7 | |
parent | 270a0879744c2663b9578835271a1f8b4c9d6932 (diff) | |
download | gsoc2013-evolution-f1cc9011fb2b986b5da991764387d03e5fa565c5.tar.gz gsoc2013-evolution-f1cc9011fb2b986b5da991764387d03e5fa565c5.tar.zst gsoc2013-evolution-f1cc9011fb2b986b5da991764387d03e5fa565c5.zip |
Add e_mail_store_go_online_sync().
Need for new mail_folder_cache_note_store() implementation.
-rw-r--r-- | libemail-engine/e-mail-store-utils.c | 49 | ||||
-rw-r--r-- | libemail-engine/e-mail-store-utils.h | 3 |
2 files changed, 35 insertions, 17 deletions
diff --git a/libemail-engine/e-mail-store-utils.c b/libemail-engine/e-mail-store-utils.c index a92aaaccf4..ac8e8ea07d 100644 --- a/libemail-engine/e-mail-store-utils.c +++ b/libemail-engine/e-mail-store-utils.c @@ -246,17 +246,18 @@ e_mail_store_go_offline_finish (CamelStore *store, return !g_simple_async_result_propagate_error (simple, error); } -/* Helper for e_mail_store_go_online() */ -static void -mail_store_go_online_thread (GSimpleAsyncResult *simple, - GObject *source_object, - GCancellable *cancellable) +gboolean +e_mail_store_go_online_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') @@ -265,21 +266,35 @@ mail_store_go_online_thread (GSimpleAsyncResult *simple, camel_operation_push_message ( cancellable, _("Reconnecting to '%s'"), display_name); - if (CAMEL_IS_DISCO_STORE (service)) - camel_disco_store_set_status ( - CAMEL_DISCO_STORE (service), + if (CAMEL_IS_DISCO_STORE (store)) + success = camel_disco_store_set_status ( + CAMEL_DISCO_STORE (store), CAMEL_DISCO_STORE_ONLINE, - cancellable, &local_error); + cancellable, error); - else if (CAMEL_IS_OFFLINE_STORE (service)) - camel_offline_store_set_online_sync ( - CAMEL_OFFLINE_STORE (service), - TRUE, cancellable, &local_error); + if (CAMEL_IS_OFFLINE_STORE (store)) + success = camel_offline_store_set_online_sync ( + CAMEL_OFFLINE_STORE (store), + TRUE, cancellable, error); + + camel_operation_pop_message (cancellable); + + return success; +} + +/* Helper for e_mail_store_go_online() */ +static void +mail_store_go_online_thread (GSimpleAsyncResult *simple, + GObject *source_object, + GCancellable *cancellable) +{ + GError *local_error = NULL; + + e_mail_store_go_online_sync ( + CAMEL_STORE (source_object), cancellable, &local_error); if (local_error != NULL) g_simple_async_result_take_error (simple, local_error); - - camel_operation_pop_message (cancellable); } void diff --git a/libemail-engine/e-mail-store-utils.h b/libemail-engine/e-mail-store-utils.h index de4484c020..143e0cc24f 100644 --- a/libemail-engine/e-mail-store-utils.h +++ b/libemail-engine/e-mail-store-utils.h @@ -49,6 +49,9 @@ gboolean e_mail_store_go_offline_finish (CamelStore *store, GAsyncResult *result, GError **error); +gboolean e_mail_store_go_online_sync (CamelStore *store, + GCancellable *cancellable, + GError **error); void e_mail_store_go_online (CamelStore *store, gint io_priority, GCancellable *cancellable, |