[evolution-mapi] Adapt to CamelService API changes.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-mapi] Adapt to CamelService API changes.
- Date: Sat, 19 May 2012 18:53:37 +0000 (UTC)
commit 8244040c005277a4b436c6990fd7e770f187bc39
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat May 19 14:52:51 2012 -0400
Adapt to CamelService API changes.
src/camel/camel-mapi-folder.c | 40 +--------------------------------
src/camel/camel-mapi-store.c | 48 +++++-----------------------------------
2 files changed, 8 insertions(+), 80 deletions(-)
---
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index d6ff88e..d6cd452 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -764,14 +764,11 @@ camel_mapi_folder_fetch_summary (CamelFolder *folder, GCancellable *cancellable,
camel_operation_push_message (cancellable, _("Refreshing folder '%s'"), camel_folder_get_display_name (folder));
- camel_service_lock (CAMEL_SERVICE (mapi_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
si = camel_mapi_store_summary_get_folder_id (mapi_store->summary, mapi_folder->folder_id);
msi = (CamelMapiStoreInfo *) si;
if (!msi) {
camel_operation_pop_message (cancellable);
- camel_service_unlock (CAMEL_SERVICE (mapi_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
camel_folder_thaw (folder);
g_return_val_if_fail (msi != NULL, FALSE);
@@ -863,8 +860,6 @@ camel_mapi_folder_fetch_summary (CamelFolder *folder, GCancellable *cancellable,
if (gco.removed_uids)
g_hash_table_destroy (gco.removed_uids);
- camel_service_unlock (CAMEL_SERVICE (mapi_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
camel_operation_pop_message (cancellable);
if (status) {
@@ -885,9 +880,7 @@ mapi_refresh_folder (CamelFolder *folder, GCancellable *cancellable, GError **er
CamelMapiStore *mapi_store;
CamelMapiFolder *mapi_folder;
- CamelService *service;
CamelStore *parent_store;
- gboolean is_locked = FALSE;
gboolean status;
gboolean success = TRUE;
GError *mapi_error = NULL;
@@ -896,7 +889,6 @@ mapi_refresh_folder (CamelFolder *folder, GCancellable *cancellable, GError **er
mapi_folder = CAMEL_MAPI_FOLDER (folder);
mapi_store = CAMEL_MAPI_STORE (parent_store);
- service = CAMEL_SERVICE (parent_store);
if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (mapi_store)))
goto end1;
@@ -914,9 +906,6 @@ mapi_refresh_folder (CamelFolder *folder, GCancellable *cancellable, GError **er
mapi_folder->need_refresh = TRUE;
}
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
- is_locked = TRUE;
-
if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (mapi_store))) {
/*BUG : Fix exception string.*/
g_set_error (
@@ -963,13 +952,7 @@ mapi_refresh_folder (CamelFolder *folder, GCancellable *cancellable, GError **er
camel_folder_summary_touch (folder->summary);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
- is_locked = FALSE;
-
- end1:
- if (is_locked)
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
+end1:
return success;
}
@@ -1297,13 +1280,11 @@ mapi_folder_expunge_sync (CamelFolder *folder,
}
g_ptr_array_free (folders, TRUE);
- camel_service_lock (CAMEL_SERVICE (mapi_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
status = cmf_open_folder (mapi_folder, conn, &obj_folder, cancellable, &mapi_error);
if (status) {
status = e_mapi_connection_empty_folder (conn, &obj_folder, cancellable, &mapi_error);
e_mapi_connection_close_folder (conn, &obj_folder, cancellable, &mapi_error);
}
- camel_service_unlock (CAMEL_SERVICE (mapi_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
if (status) {
camel_folder_freeze (folder);
@@ -1357,16 +1338,12 @@ mapi_folder_expunge_sync (CamelFolder *folder,
if (deleted_items) {
mapi_object_t obj_folder;
- camel_service_lock (CAMEL_SERVICE (mapi_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
status = cmf_open_folder (mapi_folder, conn, &obj_folder, cancellable, NULL);
if (status) {
status = e_mapi_connection_remove_items (conn, &obj_folder, deleted_items, cancellable, NULL);
e_mapi_connection_close_folder (conn, &obj_folder, cancellable, NULL);
}
- camel_service_unlock (CAMEL_SERVICE (mapi_store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (status) {
while (deleted_items_uid) {
const gchar *uid = (gchar *)deleted_items_uid->data;
@@ -1608,12 +1585,8 @@ mapi_folder_synchronize_sync (CamelFolder *folder,
folder_id = camel_mapi_store_folder_id_lookup (mapi_store, full_name);
e_mapi_util_mapi_id_from_string (folder_id, &fid);
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
- if (!camel_mapi_store_connected (mapi_store, error)) {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
+ if (!camel_mapi_store_connected (mapi_store, error))
return FALSE;
- }
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
is_junk_folder = (mapi_folder->camel_folder_flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_JUNK;
@@ -1693,22 +1666,17 @@ mapi_folder_synchronize_sync (CamelFolder *folder,
has_obj_folder = cmf_open_folder (mapi_folder, conn, &obj_folder, cancellable, NULL);
if (read_items && has_obj_folder) {
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
if (read_with_receipt)
e_mapi_connection_set_flags (conn, &obj_folder, read_with_receipt, CLEAR_RN_PENDING, cancellable, NULL);
e_mapi_connection_set_flags (conn, &obj_folder, read_items, 0, cancellable, NULL);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
}
if (unread_items && has_obj_folder) {
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
e_mapi_connection_set_flags (conn, &obj_folder, unread_items, CLEAR_READ_FLAG, cancellable, NULL);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
}
/* Remove messages from server*/
if (deleted_items && has_obj_folder) {
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
if ((mapi_folder->camel_folder_flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_TRASH) {
e_mapi_connection_remove_items (conn, &obj_folder, deleted_items, cancellable, NULL);
} else {
@@ -1727,8 +1695,6 @@ mapi_folder_synchronize_sync (CamelFolder *folder,
g_error_free (err);
}
}
-
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
}
if (junk_items && has_obj_folder) {
@@ -1737,13 +1703,11 @@ mapi_folder_synchronize_sync (CamelFolder *folder,
GError *err = NULL;
if (has_obj_folder) {
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
e_mapi_util_mapi_id_from_string (camel_mapi_store_system_folder_fid (mapi_store, olFolderJunk), &junk_fid);
if (e_mapi_connection_open_personal_folder (conn, junk_fid, &junk_obj_folder, cancellable, &err)) {
e_mapi_connection_copymove_items (conn, &obj_folder, &junk_obj_folder, FALSE, junk_items, cancellable, &err);
e_mapi_connection_close_folder (conn, &junk_obj_folder, cancellable, &err);
}
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
}
/* in junk_items are only emails which are not deleted */
diff --git a/src/camel/camel-mapi-store.c b/src/camel/camel-mapi-store.c
index 9568e9f..b9ae493 100644
--- a/src/camel/camel-mapi-store.c
+++ b/src/camel/camel-mapi-store.c
@@ -1154,8 +1154,6 @@ mapi_store_get_folder_info_sync (CamelStore *store,
service = CAMEL_SERVICE (store);
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))) {
CamelServiceConnectionStatus status;
@@ -1173,7 +1171,7 @@ mapi_store_get_folder_info_sync (CamelStore *store,
gchar *name = camel_service_get_name (service, TRUE);
camel_operation_push_message (cancellable, _("Connecting to '%s'"), name);
- camel_service_connect_sync (service, NULL);
+ camel_service_connect_sync (service, cancellable, NULL);
camel_operation_pop_message (cancellable);
g_free (name);
@@ -1182,10 +1180,8 @@ mapi_store_get_folder_info_sync (CamelStore *store,
if (check_for_connection (service, NULL) || status == CAMEL_SERVICE_CONNECTING) {
gboolean first_check = !mapi_store->priv->folders_synced;
- if (!mapi_folders_sync (mapi_store, flags, cancellable, error)) {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
+ if (!mapi_folders_sync (mapi_store, flags, cancellable, error))
return NULL;
- }
if (first_check) {
camel_store_summary_touch (mapi_store->summary);
@@ -1195,8 +1191,6 @@ mapi_store_get_folder_info_sync (CamelStore *store,
}
}
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return mapi_get_folder_info_offline (store, top, flags, error);
}
@@ -1265,15 +1259,12 @@ mapi_store_create_folder_sync (CamelStore *store,
return NULL;
}
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (parent_name && *parent_name)
parent_id = g_strdup (g_hash_table_lookup (priv->name_hash, parent_name));
else
parent_id = NULL;
if (!parent_id) {
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
g_set_error (
error, CAMEL_SERVICE_ERROR,
CAMEL_SERVICE_ERROR_UNAVAILABLE,
@@ -1284,10 +1275,8 @@ mapi_store_create_folder_sync (CamelStore *store,
new_folder_id = 0;
conn = priv->conn;
- if (!cms_open_folder (mapi_store, conn, parent_fid, &obj_folder, cancellable, error)) {
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
+ if (!cms_open_folder (mapi_store, conn, parent_fid, &obj_folder, cancellable, error))
return NULL;
- }
if (!e_mapi_connection_create_folder (conn, &obj_folder, folder_name, IPF_NOTE, &new_folder_id, cancellable, &mapi_error))
new_folder_id = 0;
@@ -1338,7 +1327,6 @@ mapi_store_create_folder_sync (CamelStore *store,
}
}
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
return root;
}
@@ -1366,11 +1354,7 @@ mapi_store_delete_folder_sync (CamelStore *store,
return FALSE;
}
- camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (!camel_mapi_store_connected ((CamelMapiStore *)store, &local_error)) {
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (local_error != NULL) {
g_propagate_error (error, local_error);
return FALSE;
@@ -1385,7 +1369,6 @@ mapi_store_delete_folder_sync (CamelStore *store,
folder_id = g_hash_table_lookup (priv->name_hash, folder_name);
if (!folder_id) {
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
g_set_error (
error, CAMEL_SERVICE_ERROR,
CAMEL_SERVICE_ERROR_UNAVAILABLE,
@@ -1436,8 +1419,6 @@ mapi_store_delete_folder_sync (CamelStore *store,
}
}
- camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return success;
}
@@ -1469,11 +1450,7 @@ mapi_store_rename_folder_sync (CamelStore *store,
service = CAMEL_SERVICE (store);
user_cache_dir = camel_service_get_user_cache_dir (service);
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (!camel_mapi_store_connected ((CamelMapiStore *)store, &local_error)) {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
if (local_error != NULL) {
g_propagate_error (error, local_error);
return FALSE;
@@ -1494,7 +1471,6 @@ mapi_store_rename_folder_sync (CamelStore *store,
error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
_("Cannot rename MAPI folder '%s'. Folder does not exist"),
old_name);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
return FALSE;
}
@@ -1506,7 +1482,6 @@ mapi_store_rename_folder_sync (CamelStore *store,
error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
_("Cannot rename MAPI default folder '%s' to '%s'"),
old_name, new_name);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
return FALSE;
}
@@ -1533,7 +1508,6 @@ mapi_store_rename_folder_sync (CamelStore *store,
error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
_("Cannot rename MAPI folder '%s' to '%s'"),
old_name, new_name);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
g_free (old_parent);
g_free (new_parent);
return FALSE;
@@ -1568,7 +1542,6 @@ mapi_store_rename_folder_sync (CamelStore *store,
old_name, new_name);
}
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
g_free (old_parent);
g_free (new_parent);
return FALSE;
@@ -1632,7 +1605,6 @@ mapi_store_rename_folder_sync (CamelStore *store,
}
if (!status) {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
if (local_error) {
if (!e_mapi_utils_propagate_cancelled_error (local_error, error))
g_set_error (
@@ -1668,8 +1640,6 @@ mapi_store_rename_folder_sync (CamelStore *store,
g_free (folder_id);
}
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
si = camel_store_summary_path (mapi_store->summary, old_name);
if (si) {
mapi_id_t new_parent_fid;
@@ -2123,19 +2093,15 @@ mapi_connect_sync (CamelService *service,
return FALSE;
}
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
- if (check_for_connection (service, NULL)) {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
+ if (check_for_connection (service, NULL))
return TRUE;
- }
name = camel_service_get_name (service, TRUE);
camel_operation_push_message (cancellable, _("Connecting to '%s'"), name);
if (!camel_session_authenticate_sync (session, service, NULL, cancellable, error)) {
camel_operation_pop_message (cancellable);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
- camel_service_disconnect_sync (service, TRUE, NULL);
+ camel_service_disconnect_sync (service, TRUE, cancellable, NULL);
g_free (name);
return FALSE;
}
@@ -2179,8 +2145,6 @@ mapi_connect_sync (CamelService *service,
g_free (name);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return TRUE;
}
@@ -2679,7 +2643,7 @@ gboolean
camel_mapi_store_connected (CamelMapiStore *store, GError **error)
{
return camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))
- && camel_service_connect_sync ((CamelService *)store, error);
+ && camel_service_connect_sync ((CamelService *)store, NULL, error);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]