aboutsummaryrefslogtreecommitdiffstats
path: root/libemail-engine
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-05-19 23:11:58 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-05-20 01:35:28 +0800
commit98f39d7ee0581aaa28c33564d9d6b27aa23028fa (patch)
treea55d7307795a07022afc53d0a030639bfabab45f /libemail-engine
parent98462b59ec41432fe0334c473b4e4c11a0f3def6 (diff)
downloadgsoc2013-evolution-98f39d7ee0581aaa28c33564d9d6b27aa23028fa.tar
gsoc2013-evolution-98f39d7ee0581aaa28c33564d9d6b27aa23028fa.tar.gz
gsoc2013-evolution-98f39d7ee0581aaa28c33564d9d6b27aa23028fa.tar.bz2
gsoc2013-evolution-98f39d7ee0581aaa28c33564d9d6b27aa23028fa.tar.lz
gsoc2013-evolution-98f39d7ee0581aaa28c33564d9d6b27aa23028fa.tar.xz
gsoc2013-evolution-98f39d7ee0581aaa28c33564d9d6b27aa23028fa.tar.zst
gsoc2013-evolution-98f39d7ee0581aaa28c33564d9d6b27aa23028fa.zip
Adapt to CamelService API changes.
em_utils_connect_service_sync() and em_utils_disconnect_service_sync() are no longer needed. CamelService itself now effectively does what these functions were doing.
Diffstat (limited to 'libemail-engine')
-rw-r--r--libemail-engine/e-mail-session-utils.c8
-rw-r--r--libemail-engine/e-mail-session.c6
-rw-r--r--libemail-engine/e-mail-store-utils.c13
-rw-r--r--libemail-engine/e-mail-utils.c58
-rw-r--r--libemail-engine/e-mail-utils.h8
-rw-r--r--libemail-engine/mail-ops.c12
6 files changed, 18 insertions, 87 deletions
diff --git a/libemail-engine/e-mail-session-utils.c b/libemail-engine/e-mail-session-utils.c
index 403ba57ae9..de1dec1713 100644
--- a/libemail-engine/e-mail-session-utils.c
+++ b/libemail-engine/e-mail-session-utils.c
@@ -426,8 +426,7 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple,
if (status != CAMEL_SERVICE_CONNECTED) {
did_connect = TRUE;
- /* XXX This API does not allow for cancellation. */
- em_utils_connect_service_sync (
+ camel_service_connect_sync (
service, cancellable, &error);
if (error != NULL) {
@@ -447,7 +446,7 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple,
context->recipients, cancellable, &error);
if (did_connect)
- em_utils_disconnect_service_sync (
+ camel_service_disconnect_sync (
service, error == NULL,
cancellable, error ? NULL : &error);
@@ -896,9 +895,8 @@ e_mail_session_unsubscribe_folder_sync (EMailSession *session,
message = _("Unsubscribing from folder '%s'");
camel_operation_push_message (cancellable, message, folder_name);
- /* FIXME This should take our GCancellable. */
success =
- em_utils_connect_service_sync (
+ camel_service_connect_sync (
CAMEL_SERVICE (store), cancellable, error) &&
camel_subscribable_unsubscribe_folder_sync (
CAMEL_SUBSCRIBABLE (store),
diff --git a/libemail-engine/e-mail-session.c b/libemail-engine/e-mail-session.c
index 475f8024aa..bc72e98652 100644
--- a/libemail-engine/e-mail-session.c
+++ b/libemail-engine/e-mail-session.c
@@ -695,7 +695,7 @@ mail_session_add_vfolder_store (EMailSession *session)
g_return_if_fail (CAMEL_IS_SERVICE (service));
camel_service_set_display_name (service, _("Search Folders"));
- em_utils_connect_service_sync (service, NULL, NULL);
+ camel_service_connect_sync (service, NULL, NULL);
/* XXX There's more configuration to do in vfolder_load_storage()
* but it requires an EMailBackend, which we don't have access
@@ -1710,7 +1710,7 @@ e_mail_session_get_inbox_sync (EMailSession *session,
if (!CAMEL_IS_STORE (service))
return NULL;
- if (!em_utils_connect_service_sync (service, cancellable, error))
+ if (!camel_service_connect_sync (service, cancellable, error))
return NULL;
return camel_store_get_inbox_folder_sync (
@@ -1809,7 +1809,7 @@ e_mail_session_get_trash_sync (EMailSession *session,
if (!CAMEL_IS_STORE (service))
return NULL;
- if (!em_utils_connect_service_sync (service, cancellable, error))
+ if (!camel_service_connect_sync (service, cancellable, error))
return NULL;
return camel_store_get_trash_folder_sync (
diff --git a/libemail-engine/e-mail-store-utils.c b/libemail-engine/e-mail-store-utils.c
index 9719c0d353..bfb1ed5af3 100644
--- a/libemail-engine/e-mail-store-utils.c
+++ b/libemail-engine/e-mail-store-utils.c
@@ -180,7 +180,8 @@ mail_store_go_offline_thread (GSimpleAsyncResult *simple,
disco_store, CAMEL_DISCO_STORE_OFFLINE,
cancellable, &error);
else
- em_utils_disconnect_service_sync (service, TRUE, cancellable, &error);
+ camel_service_disconnect_sync (
+ service, TRUE, cancellable, &error);
} else if (CAMEL_IS_OFFLINE_STORE (store)) {
CamelOfflineStore *offline_store;
@@ -190,8 +191,10 @@ mail_store_go_offline_thread (GSimpleAsyncResult *simple,
camel_offline_store_set_online_sync (
offline_store, FALSE, cancellable, &error);
- } else
- em_utils_disconnect_service_sync (service, TRUE, cancellable, &error);
+ } else {
+ camel_service_disconnect_sync (
+ service, TRUE, cancellable, &error);
+ }
if (error != NULL)
g_simple_async_result_take_error (simple, error);
@@ -210,10 +213,6 @@ e_mail_store_go_offline (CamelStore *store,
g_return_if_fail (CAMEL_IS_STORE (store));
- /* Cancel any pending connect first so the set_offline_op
- * thread won't get queued behind a hung connect op. */
- camel_service_cancel_connect (CAMEL_SERVICE (store));
-
simple = g_simple_async_result_new (
G_OBJECT (store), callback,
user_data, e_mail_store_go_offline);
diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c
index d9eee7216c..61ef8d60ae 100644
--- a/libemail-engine/e-mail-utils.c
+++ b/libemail-engine/e-mail-utils.c
@@ -1001,64 +1001,6 @@ exit:
return account;
}
-static void
-cancel_service_connect_cb (GCancellable *cancellable,
- CamelService *service)
-{
- g_return_if_fail (CAMEL_IS_SERVICE (service));
-
- camel_service_cancel_connect (service);
-}
-
-gboolean
-em_utils_connect_service_sync (CamelService *service,
- GCancellable *cancellable,
- GError **error)
-{
- gboolean res;
- gulong handler_id = 0;
-
- g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE);
-
- if (cancellable != NULL)
- handler_id = g_cancellable_connect (
- cancellable,
- G_CALLBACK (cancel_service_connect_cb),
- service, NULL);
-
- res = camel_service_connect_sync (service, error);
-
- if (handler_id)
- g_cancellable_disconnect (cancellable, handler_id);
-
- return res;
-}
-
-gboolean
-em_utils_disconnect_service_sync (CamelService *service,
- gboolean clean,
- GCancellable *cancellable,
- GError **error)
-{
- gboolean res;
- gulong handler_id = 0;
-
- g_return_val_if_fail (CAMEL_IS_SERVICE (service), FALSE);
-
- if (cancellable != NULL)
- handler_id = g_cancellable_connect (
- cancellable,
- G_CALLBACK (cancel_service_connect_cb),
- service, NULL);
-
- res = camel_service_disconnect_sync (service, clean, error);
-
- if (handler_id)
- g_cancellable_disconnect (cancellable, handler_id);
-
- return res;
-}
-
/**
* em_utils_uids_free:
* @uids: array of uids
diff --git a/libemail-engine/e-mail-utils.h b/libemail-engine/e-mail-utils.h
index 144f13dfdd..ca8ed010ca 100644
--- a/libemail-engine/e-mail-utils.h
+++ b/libemail-engine/e-mail-utils.h
@@ -41,14 +41,6 @@ EAccount * em_utils_guess_account_with_recipients
void emu_remove_from_mail_cache (const GSList *addresses);
void emu_remove_from_mail_cache_1 (const gchar *address);
void emu_free_mail_cache (void);
-gboolean em_utils_connect_service_sync (CamelService *service,
- GCancellable *cancellable,
- GError **error);
-gboolean em_utils_disconnect_service_sync
- (CamelService *service,
- gboolean clean,
- GCancellable *cancellable,
- GError **error);
void em_utils_uids_free (GPtrArray *uids);
gboolean em_utils_is_local_delivery_mbox_file
(CamelURL *url);
diff --git a/libemail-engine/mail-ops.c b/libemail-engine/mail-ops.c
index 3374629744..217f75dc90 100644
--- a/libemail-engine/mail-ops.c
+++ b/libemail-engine/mail-ops.c
@@ -380,7 +380,7 @@ exit:
/* also disconnect if not a local delivery mbox;
* there is no need to keep the connection alive forever */
if (!is_local_delivery)
- em_utils_disconnect_service_sync (
+ camel_service_disconnect_sync (
service, TRUE, cancellable, NULL);
}
@@ -606,7 +606,7 @@ mail_send_message (struct _send_queue_msg *m,
}
if (camel_address_length (recipients) > 0) {
- if (!em_utils_connect_service_sync (
+ if (!camel_service_connect_sync (
CAMEL_SERVICE (transport), cancellable, error))
goto exit;
@@ -1624,7 +1624,7 @@ empty_trash_exec (struct _empty_trash_msg *m,
service = CAMEL_SERVICE (m->store);
uid = camel_service_get_uid (service);
- if (!em_utils_connect_service_sync (service, cancellable, error))
+ if (!camel_service_connect_sync (service, cancellable, error))
return;
trash = camel_store_get_trash_folder_sync (
@@ -1712,10 +1712,10 @@ disconnect_service_desc (struct _disconnect_msg *m)
static void
disconnect_service_exec (struct _disconnect_msg *m,
- GCancellable *cancellable,
- GError **error)
+ GCancellable *cancellable,
+ GError **error)
{
- em_utils_disconnect_service_sync (
+ camel_service_disconnect_sync (
CAMEL_SERVICE (m->store), TRUE, cancellable, error);
}