[evolution-activesync] Update camel back end for Evolution 3.6/3.8
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-activesync] Update camel back end for Evolution 3.6/3.8
- Date: Wed, 8 May 2013 13:19:24 +0000 (UTC)
commit 052c5ca825b87f9f287660dfd29a6db05d9c96a2
Author: David Woodhouse <David Woodhouse intel com>
Date: Wed May 8 14:18:59 2013 +0100
Update camel back end for Evolution 3.6/3.8
We still need to do the eplugin, or whatever replaces it.
camel/camel-eas-compat.c | 4 +-
camel/camel-eas-folder.c | 119 +++++++++++++++++++--------------------
camel/camel-eas-store-summary.c | 9 +--
camel/camel-eas-store.c | 67 ++++++++--------------
camel/camel-eas-store.h | 1 +
camel/camel-eas-transport.c | 6 +-
6 files changed, 93 insertions(+), 113 deletions(-)
---
diff --git a/camel/camel-eas-compat.c b/camel/camel-eas-compat.c
index b5f4780..81b3211 100644
--- a/camel/camel-eas-compat.c
+++ b/camel/camel-eas-compat.c
@@ -48,7 +48,7 @@ camel_session_get_password_compat (CamelSession *session,
#endif
}
-
+#if 0
CamelService *
camel_session_get_service_compat (CamelSession *session, const gchar *url, CamelProviderType type)
{
@@ -63,7 +63,7 @@ camel_session_get_service_compat (CamelSession *session, const gchar *url, Camel
return service;
#endif
}
-
+#endif
#if ! EDS_CHECK_VERSION(3,1,0)
CamelURL *
diff --git a/camel/camel-eas-folder.c b/camel/camel-eas-folder.c
index 6a6d724..45fb53f 100644
--- a/camel/camel-eas-folder.c
+++ b/camel/camel-eas-folder.c
@@ -54,15 +54,15 @@
struct _CamelEasFolderPrivate {
gchar *server_id;
- GMutex *search_lock; /* for locking the search object */
- GStaticRecMutex cache_lock; /* for locking the cache object */
+ GMutex search_lock; /* for locking the search object */
+ GRecMutex cache_lock; /* for locking the cache object */
/* For syncronizing refresh_info/sync_changes */
gboolean refreshing;
gboolean fetch_pending;
- GMutex *state_lock;
- GMutex *server_lock;
- GCond *fetch_cond;
+ GMutex state_lock;
+ GMutex server_lock;
+ GCond fetch_cond;
GHashTable *uid_eflags;
};
@@ -75,7 +75,7 @@ eas_get_filename (CamelFolder *folder, const gchar *uid, GError **error)
{
CamelEasFolder *eas_folder = CAMEL_EAS_FOLDER(folder);
- return camel_data_cache_get_filename (eas_folder->cache, "cache", uid, error);
+ return camel_data_cache_get_filename (eas_folder->cache, "cache", uid);
}
#if ! EDS_CHECK_VERSION(2,33,0)
@@ -100,10 +100,10 @@ camel_eas_folder_get_message_from_cache (CamelEasFolder *eas_folder, const gchar
priv = eas_folder->priv;
- g_static_rec_mutex_lock (&priv->cache_lock);
+ g_rec_mutex_lock (&priv->cache_lock);
stream = camel_data_cache_get (eas_folder->cache, "cur", uid, error);
if (!stream) {
- g_static_rec_mutex_unlock (&priv->cache_lock);
+ g_rec_mutex_unlock (&priv->cache_lock);
return NULL;
}
@@ -115,7 +115,7 @@ camel_eas_folder_get_message_from_cache (CamelEasFolder *eas_folder, const gchar
msg = NULL;
}
- g_static_rec_mutex_unlock (&priv->cache_lock);
+ g_rec_mutex_unlock (&priv->cache_lock);
g_object_unref (stream);
return msg;
@@ -148,10 +148,10 @@ camel_eas_folder_get_message (CamelFolder *folder, const gchar *uid,
eas_folder = (CamelEasFolder *) folder;
priv = eas_folder->priv;
- if (!camel_eas_store_connected (eas_store, error))
+ if (!camel_eas_store_connected (eas_store, cancellable, error))
return NULL;
- g_mutex_lock (priv->state_lock);
+ g_mutex_lock (&priv->state_lock);
/* If another thread is already fetching this message, wait for it */
@@ -162,10 +162,10 @@ camel_eas_folder_get_message (CamelFolder *folder, const gchar *uid,
falls back to this function. */
if (g_hash_table_lookup (priv->uid_eflags, uid)) {
do {
- g_cond_wait (priv->fetch_cond, priv->state_lock);
+ g_cond_wait (&priv->fetch_cond, &priv->state_lock);
} while (g_hash_table_lookup (priv->uid_eflags, uid));
- g_mutex_unlock (priv->state_lock);
+ g_mutex_unlock (&priv->state_lock);
message = camel_eas_folder_get_message_from_cache (eas_folder, uid, cancellable, error);
return message;
@@ -175,7 +175,7 @@ camel_eas_folder_get_message (CamelFolder *folder, const gchar *uid,
we won't be inserting where an entry already exists. So it's
OK to insert uid itself, not g_strdup (uid) */
g_hash_table_insert (priv->uid_eflags, (gchar *)uid, (gchar *)uid);
- g_mutex_unlock (priv->state_lock);
+ g_mutex_unlock (&priv->state_lock);
handler = camel_eas_store_get_handler (eas_store);
@@ -190,10 +190,10 @@ camel_eas_folder_get_message (CamelFolder *folder, const gchar *uid,
goto exit;
}
- g_mutex_lock (priv->server_lock);
+ g_mutex_lock (&priv->server_lock);
res = eas_mail_handler_fetch_email_body (handler, priv->server_id, uid, mime_dir,
(EasProgressFn)camel_operation_progress, progress_data,
NULL, error);
- g_mutex_unlock (priv->server_lock);
+ g_mutex_unlock (&priv->server_lock);
if (!res) {
g_free (mime_dir);
@@ -205,7 +205,7 @@ camel_eas_folder_get_message (CamelFolder *folder, const gchar *uid,
mime_content = g_build_filename (mime_dir, uid, NULL);
g_free (mime_dir);
cache_file = camel_data_cache_get_filename (eas_folder->cache, "cur",
- uid, error);
+ uid);
temp = g_strrstr (cache_file, "/");
dir = g_strndup (cache_file, temp - cache_file);
@@ -232,10 +232,10 @@ camel_eas_folder_get_message (CamelFolder *folder, const gchar *uid,
message = camel_eas_folder_get_message_from_cache (eas_folder, uid, cancellable, error);
exit:
- g_mutex_lock (priv->state_lock);
+ g_mutex_lock (&priv->state_lock);
g_hash_table_remove (priv->uid_eflags, uid);
- g_mutex_unlock (priv->state_lock);
- g_cond_broadcast (priv->fetch_cond);
+ g_mutex_unlock (&priv->state_lock);
+ g_cond_broadcast (&priv->fetch_cond);
if (!message && !error)
g_set_error (
@@ -272,7 +272,7 @@ eas_folder_get_message_sync (CamelFolder *folder, const gchar *uid, EVO3(GCancel
}
static GPtrArray *
-eas_folder_search_by_expression (CamelFolder *folder, const gchar *expression, GError **error)
+eas_folder_search_by_expression (CamelFolder *folder, const gchar *expression, GCancellable *cancellable,
GError **error)
{
CamelEasFolder *eas_folder;
CamelEasFolderPrivate *priv;
@@ -281,18 +281,18 @@ eas_folder_search_by_expression (CamelFolder *folder, const gchar *expression, G
eas_folder = CAMEL_EAS_FOLDER (folder);
priv = eas_folder->priv;
- g_mutex_lock (priv->search_lock);
+ g_mutex_lock (&priv->search_lock);
camel_folder_search_set_folder (eas_folder->search, folder);
- matches = camel_folder_search_search (eas_folder->search, expression, NULL, error);
+ matches = camel_folder_search_search (eas_folder->search, expression, NULL, cancellable, error);
- g_mutex_unlock (priv->search_lock);
+ g_mutex_unlock (&priv->search_lock);
return matches;
}
static guint32
-eas_folder_count_by_expression (CamelFolder *folder, const gchar *expression, GError **error)
+eas_folder_count_by_expression (CamelFolder *folder, const gchar *expression, GCancellable *cancellable,
GError **error)
{
CamelEasFolder *eas_folder;
CamelEasFolderPrivate *priv;
@@ -301,18 +301,19 @@ eas_folder_count_by_expression (CamelFolder *folder, const gchar *expression, GE
eas_folder = CAMEL_EAS_FOLDER (folder);
priv = eas_folder->priv;
- g_mutex_lock (priv->search_lock);
+ g_mutex_lock (&priv->search_lock);
camel_folder_search_set_folder (eas_folder->search, folder);
- matches = camel_folder_search_count (eas_folder->search, expression, error);
+ matches = camel_folder_search_count (eas_folder->search, expression, cancellable, error);
- g_mutex_unlock (priv->search_lock);
+ g_mutex_unlock (&priv->search_lock);
return matches;
}
static GPtrArray *
-eas_folder_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArray *uids, GError **error)
+eas_folder_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArray *uids,
+ GCancellable *cancellable, GError **error)
{
CamelEasFolder *eas_folder;
CamelEasFolderPrivate *priv;
@@ -324,12 +325,12 @@ eas_folder_search_by_uids(CamelFolder *folder, const gchar *expression, GPtrArra
if (uids->len == 0)
return g_ptr_array_new ();
- g_mutex_lock (priv->search_lock);
+ g_mutex_lock (&priv->search_lock);
camel_folder_search_set_folder (eas_folder->search, folder);
- matches = camel_folder_search_search (eas_folder->search, expression, uids, error);
+ matches = camel_folder_search_search (eas_folder->search, expression, uids, cancellable, error);
- g_mutex_unlock (priv->search_lock);
+ g_mutex_unlock (&priv->search_lock);
return matches;
}
@@ -345,11 +346,11 @@ eas_folder_search_free (CamelFolder *folder, GPtrArray *uids)
g_return_if_fail (eas_folder->search);
- g_mutex_lock (priv->search_lock);
+ g_mutex_lock (&priv->search_lock);
camel_folder_search_free_result (eas_folder->search, uids);
- g_mutex_unlock (priv->search_lock);
+ g_mutex_unlock (&priv->search_lock);
return;
}
@@ -367,11 +368,11 @@ eas_delete_messages (CamelFolder *folder, GSList *deleted_uids, gboolean expunge
eas_store = (CamelEasStore *) camel_folder_get_parent_store (folder);
handler = camel_eas_store_get_handler (eas_store);
- g_mutex_lock (priv->server_lock);
+ g_mutex_lock (&priv->server_lock);
success = eas_mail_handler_delete_email (handler,
((CamelEasSummary *) folder->summary)->sync_state,
priv->server_id, deleted_uids, NULL, error);
- g_mutex_unlock (priv->server_lock);
+ g_mutex_unlock (&priv->server_lock);
if (success) {
CamelFolderChangeInfo *changes = camel_folder_change_info_new ();
GSList *l;
@@ -412,7 +413,7 @@ eas_synchronize_sync (CamelFolder *folder, gboolean expunge, EVO3(GCancellable *
eas_store = (CamelEasStore *) camel_folder_get_parent_store (folder);
handler = camel_eas_store_get_handler (eas_store);
- if (!camel_eas_store_connected (eas_store, error))
+ if (!camel_eas_store_connected (eas_store, cancellable, error))
return FALSE;
uids = camel_folder_summary_get_changed (folder->summary);
@@ -461,7 +462,7 @@ eas_synchronize_sync (CamelFolder *folder, gboolean expunge, EVO3(GCancellable *
/* Don't do too many at once */
if (item_list_len) {
- g_mutex_lock (priv->server_lock);
+ g_mutex_lock (&priv->server_lock);
success = eas_mail_handler_update_email (handler,
((CamelEasSummary *) folder->summary)->sync_state,
priv->server_id, item_list, NULL, error);
@@ -476,7 +477,7 @@ eas_synchronize_sync (CamelFolder *folder, gboolean expunge, EVO3(GCancellable *
g_slist_free (changing_mis);
changing_mis = NULL;
- g_mutex_unlock (priv->server_lock);
+ g_mutex_unlock (&priv->server_lock);
g_slist_foreach (item_list, (GFunc) g_object_unref, NULL);
g_slist_free (item_list);
item_list = NULL;
@@ -546,10 +547,11 @@ camel_eas_folder_new (CamelStore *store, const gchar *folder_name, const gchar *
if (!g_ascii_strcasecmp (folder_name, "Inbox")) {
#if EDS_CHECK_VERSION(3,3,90)
- CamelStoreSettings *settings = CAMEL_STORE_SETTINGS (camel_service_get_settings
(CAMEL_SERVICE (store)));
+ CamelStoreSettings *settings = CAMEL_STORE_SETTINGS (camel_service_ref_settings
(CAMEL_SERVICE (store)));
if (camel_store_settings_get_filter_inbox (settings))
folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
+ g_object_unref(settings);
#else
if (camel_url_get_param (camel_service_get_camel_url (CAMEL_SERVICE(store)),
"filter"))
@@ -619,18 +621,18 @@ eas_refresh_info_sync (CamelFolder *folder, EVO3(GCancellable *cancellable,) GEr
eas_folder = (CamelEasFolder *) folder;
priv = eas_folder->priv;
- if (!camel_eas_store_connected (eas_store, error))
+ if (!camel_eas_store_connected (eas_store, cancellable, error))
return FALSE;
- g_mutex_lock (priv->state_lock);
+ g_mutex_lock (&priv->state_lock);
if (priv->refreshing) {
- g_mutex_unlock (priv->state_lock);
+ g_mutex_unlock (&priv->state_lock);
return TRUE;
}
priv->refreshing = TRUE;
- g_mutex_unlock (priv->state_lock);
+ g_mutex_unlock (&priv->state_lock);
handler = camel_eas_store_get_handler (eas_store);
@@ -695,7 +697,7 @@ eas_refresh_info_sync (CamelFolder *folder, EVO3(GCancellable *cancellable,) GEr
items_created = items_updated = items_deleted = NULL;
- g_mutex_lock (priv->server_lock);
+ g_mutex_lock (&priv->server_lock);
res = eas_mail_handler_sync_folder_email (handler, sync_state, 0, priv->server_id,
NULL, NULL, &new_sync_key,
&items_created,
@@ -719,7 +721,7 @@ eas_refresh_info_sync (CamelFolder *folder, EVO3(GCancellable *cancellable,) GEr
strncpy (sync_state, new_sync_key, 64);
g_free (new_sync_key);
}
- g_mutex_unlock (priv->server_lock);
+ g_mutex_unlock (&priv->server_lock);
if (!res)
break;
@@ -738,9 +740,9 @@ eas_refresh_info_sync (CamelFolder *folder, EVO3(GCancellable *cancellable,) GEr
} while (more_available);
out:
- g_mutex_lock (priv->state_lock);
+ g_mutex_lock (&priv->state_lock);
priv->refreshing = FALSE;
- g_mutex_unlock (priv->state_lock);
+ g_mutex_unlock (&priv->state_lock);
g_object_unref (handler);
return res;
@@ -793,7 +795,7 @@ eas_expunge_sync (CamelFolder *folder, EVO3(GCancellable *cancellable,) GError *
parent_store = camel_folder_get_parent_store (folder);
eas_store = CAMEL_EAS_STORE (parent_store);
- if (!camel_eas_store_connected (eas_store, error))
+ if (!camel_eas_store_connected (eas_store, cancellable, error))
return FALSE;
/* On Deleted Items folder, actually delete. On others, move to Deleted Items */
@@ -854,11 +856,7 @@ eas_folder_finalize (GObject *object)
{
CamelEasFolder *eas_folder = CAMEL_EAS_FOLDER (object);
- g_mutex_free (eas_folder->priv->search_lock);
- g_mutex_free (eas_folder->priv->state_lock);
- g_mutex_free (eas_folder->priv->server_lock);
g_hash_table_destroy (eas_folder->priv->uid_eflags);
- g_cond_free (eas_folder->priv->fetch_cond);
g_free (eas_folder->priv->server_id);
eas_folder->priv->server_id = NULL;
@@ -898,7 +896,7 @@ eas_folder_constructed (GObject *object)
#if EDS_CHECK_VERSION(3,3,90)
CamelService *service = CAMEL_SERVICE (parent_store);
- CamelSettings *settings = camel_service_get_settings (service);
+ CamelSettings *settings = camel_service_ref_settings (service);
CamelNetworkSettings *network_settings = CAMEL_NETWORK_SETTINGS (settings);
host = camel_network_settings_get_host (network_settings);
@@ -912,6 +910,7 @@ eas_folder_constructed (GObject *object)
description = g_strdup_printf ("%s %s:%s", user, host, full_name);
camel_folder_set_description (folder, description);
g_free (description);
+ g_object_unref(settings);
}
static void
@@ -954,16 +953,16 @@ camel_eas_folder_init (CamelEasFolder *eas_folder)
CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_SEEN |
CAMEL_MESSAGE_FORWARDED;
- folder->folder_flags = CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY | CAMEL_FOLDER_HAS_SEARCH_CAPABILITY;
+ folder->folder_flags = CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY;
- eas_folder->priv->search_lock = g_mutex_new ();
- eas_folder->priv->state_lock = g_mutex_new ();
- eas_folder->priv->server_lock = g_mutex_new ();
- g_static_rec_mutex_init(&eas_folder->priv->cache_lock);
+ g_mutex_init(&eas_folder->priv->search_lock);
+ g_mutex_init(&eas_folder->priv->state_lock);
+ g_mutex_init(&eas_folder->priv->server_lock);
+ g_rec_mutex_init(&eas_folder->priv->cache_lock);
eas_folder->priv->refreshing = FALSE;
- eas_folder->priv->fetch_cond = g_cond_new ();
+ g_cond_init(&eas_folder->priv->fetch_cond);
eas_folder->priv->uid_eflags = g_hash_table_new (g_str_hash, g_str_equal);
camel_folder_set_lock_async (folder, TRUE);
}
diff --git a/camel/camel-eas-store-summary.c b/camel/camel-eas-store-summary.c
index 8367936..7365b6f 100644
--- a/camel/camel-eas-store-summary.c
+++ b/camel/camel-eas-store-summary.c
@@ -29,8 +29,8 @@
#include <string.h>
#include "camel-eas-store-summary.h"
-#define S_LOCK(x) (g_static_rec_mutex_lock(&(x)->priv->s_lock))
-#define S_UNLOCK(x) (g_static_rec_mutex_unlock(&(x)->priv->s_lock))
+#define S_LOCK(x) (g_rec_mutex_lock(&(x)->priv->s_lock))
+#define S_UNLOCK(x) (g_rec_mutex_unlock(&(x)->priv->s_lock))
#define STORE_GROUP_NAME "##storepriv"
@@ -43,7 +43,7 @@ struct _CamelEasStoreSummaryPrivate {
So entries must always be removed from fname_id_hash *first*. */
GHashTable *id_fname_hash;
GHashTable *fname_id_hash;
- GStaticRecMutex s_lock;
+ GRecMutex s_lock;
};
G_DEFINE_TYPE (CamelEasStoreSummary, camel_eas_store_summary, CAMEL_TYPE_OBJECT)
@@ -58,7 +58,6 @@ eas_store_summary_finalize (GObject *object)
g_free (priv->path);
g_hash_table_destroy (priv->fname_id_hash);
g_hash_table_destroy (priv->id_fname_hash);
- g_static_rec_mutex_free (&priv->s_lock);
g_free (priv);
@@ -89,7 +88,7 @@ camel_eas_store_summary_init (CamelEasStoreSummary *eas_summary)
priv->id_fname_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) g_free);
- g_static_rec_mutex_init (&priv->s_lock);
+ g_rec_mutex_init (&priv->s_lock);
}
static gchar *build_full_name (CamelEasStoreSummary *eas_summary, const gchar *fid)
diff --git a/camel/camel-eas-store.c b/camel/camel-eas-store.c
index bfb7790..ffc5b20 100644
--- a/camel/camel-eas-store.c
+++ b/camel/camel-eas-store.c
@@ -68,7 +68,7 @@
struct _CamelEasStorePrivate {
time_t last_refresh_time;
- GMutex *get_finfo_lock;
+ GMutex get_finfo_lock;
EasEmailHandler *handler;
};
@@ -195,24 +195,11 @@ eas_store_construct (CamelService *service, CamelSession *session,
return TRUE;
}
-static guint
-eas_hash_folder_name (gconstpointer key)
-{
- return g_str_hash (key);
-}
-
-static gint
-eas_compare_folder_name (gconstpointer a, gconstpointer b)
-{
- gconstpointer aname = a, bname = b;
-
- return g_str_equal (aname, bname);
-}
-
static gboolean
eas_connect_sync (CamelService *service, EVO3(GCancellable *cancellable,) GError **error)
{
EVO2(GCancellable *cancellable = NULL;)
+ CamelEasSettings *settings;
CamelEasStore *eas_store;
CamelEasStorePrivate *priv;
const gchar *account_uid;
@@ -223,39 +210,34 @@ eas_connect_sync (CamelService *service, EVO3(GCancellable *cancellable,) GError
if (camel_service_get_connection_status (service) == CAMEL_SERVICE_DISCONNECTED)
return FALSE;
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
- if (priv->handler) {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
+ if (priv->handler)
return TRUE;
- }
#if !EDS_CHECK_VERSION (3,3,90)
account_uid = camel_url_get_param (camel_service_get_camel_url(service), "account_uid");
#else
- account_uid = camel_eas_settings_get_account_uid (CAMEL_EAS_SETTINGS (camel_service_get_settings
(service)));
+ settings = CAMEL_EAS_SETTINGS (camel_service_ref_settings (service));
+
+ account_uid = camel_eas_settings_get_account_uid (settings);
+ g_object_unref(settings);
#endif
if (!account_uid) {
g_set_error (
error, CAMEL_STORE_ERROR,
CAMEL_STORE_ERROR_INVALID,
_("EAS service has no account UID"));
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
return FALSE;
}
priv->handler = eas_mail_handler_new (account_uid, error);
if (!priv->handler) {
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
- EVO3_sync(camel_service_disconnect) (service, TRUE, NULL);
+ EVO3_sync(camel_service_disconnect) (service, TRUE, cancellable, NULL);
return FALSE;
}
camel_offline_store_set_online_sync (
CAMEL_OFFLINE_STORE (eas_store), TRUE, cancellable, NULL);
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return TRUE;
}
@@ -269,14 +251,10 @@ eas_disconnect_sync (CamelService *service, gboolean clean, EVO3(GCancellable *c
if (!service_class->EVO3_sync(disconnect) (service, clean, EVO3(cancellable,) error))
return FALSE;
- camel_service_lock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
/* TODO cancel all operations in the connection */
g_object_unref (eas_store->priv->handler);
eas_store->priv->handler = NULL;
- camel_service_unlock (service, CAMEL_SERVICE_REC_CONNECT_LOCK);
-
return TRUE;
}
@@ -420,10 +398,10 @@ eas_get_folder_info_sync (CamelStore *store, const gchar *top, guint32 flags, EV
eas_store = (CamelEasStore *) store;
priv = eas_store->priv;
- g_mutex_lock (priv->get_finfo_lock);
+ g_mutex_lock (&priv->get_finfo_lock);
if (!(camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))
- && EVO3_sync(camel_service_connect) ((CamelService *)store, error))) {
- g_mutex_unlock (priv->get_finfo_lock);
+ && EVO3_sync(camel_service_connect) ((CamelService *)store, cancellable, error))) {
+ g_mutex_unlock (&priv->get_finfo_lock);
goto offline;
}
@@ -436,11 +414,11 @@ eas_get_folder_info_sync (CamelStore *store, const gchar *top, guint32 flags, EV
else
g_warning ("Unable to fetch the folder hierarchy.\n");
- g_mutex_unlock (priv->get_finfo_lock);
+ g_mutex_unlock (&priv->get_finfo_lock);
return NULL;
}
eas_utils_sync_folders (eas_store, new_folders);
- g_mutex_unlock (priv->get_finfo_lock);
+ g_mutex_unlock (&priv->get_finfo_lock);
offline:
fi = folder_info_from_store_summary ( (CamelEasStore *) store, top, flags, error);
@@ -496,12 +474,13 @@ eas_get_name (CamelService *service, gboolean brief)
return g_strdup_printf(_("ActiveSync service for %s on %s"),
url->user, url->host);
#else
- CamelStoreSettings *settings = CAMEL_STORE_SETTINGS (camel_service_get_settings (service));
+ CamelStoreSettings *settings = CAMEL_STORE_SETTINGS (camel_service_ref_settings (service));
const char *account_uid = camel_eas_settings_get_account_uid ((CamelEasSettings *) settings);
/* Account UID is nothing but the email or user host */
char **strings;
char *ret;
+ g_object_unref(settings);
strings = g_strsplit (account_uid, "@", 0);
if (brief)
ret = g_strdup_printf(_("ActiveSync server %s"),
@@ -534,7 +513,8 @@ static gboolean
eas_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error)
{
#if EDS_CHECK_VERSION (3,3,90)
- CamelStoreSettings *settings = CAMEL_STORE_SETTINGS (camel_service_get_settings
(CAMEL_SERVICE(store)));
+ CamelStoreSettings *settings = CAMEL_STORE_SETTINGS (camel_service_ref_settings
(CAMEL_SERVICE(store)));
+ gboolean ret;
#endif
/* Skip unselectable folders from automatic refresh */
if (info && (info->flags & CAMEL_FOLDER_NOSELECT) != 0) return FALSE;
@@ -545,12 +525,14 @@ eas_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error
(camel_url_get_param (camel_service_get_camel_url(CAMEL_SERVICE(store)),
"check_all") != NULL);
#else
- return CAMEL_STORE_CLASS(camel_eas_store_parent_class)->can_refresh_folder (store, info, error) ||
camel_eas_settings_get_check_all ((CamelEasSettings *)settings);
+ ret = CAMEL_STORE_CLASS(camel_eas_store_parent_class)->can_refresh_folder (store, info, error) ||
camel_eas_settings_get_check_all ((CamelEasSettings *)settings);
+ g_object_unref(settings);
+ return ret;
#endif
}
gboolean
-camel_eas_store_connected (CamelEasStore *eas_store, GError **error)
+camel_eas_store_connected (CamelEasStore *eas_store, GCancellable *cancellable, GError **error)
{
if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (eas_store))) {
@@ -561,7 +543,7 @@ camel_eas_store_connected (CamelEasStore *eas_store, GError **error)
return FALSE;
}
- if (!EVO3_sync(camel_service_connect) ((CamelService *) eas_store, error))
+ if (!EVO3_sync(camel_service_connect) ((CamelService *) eas_store, cancellable, error))
return FALSE;
return TRUE;
@@ -597,7 +579,6 @@ eas_store_finalize (GObject *object)
eas_store = CAMEL_EAS_STORE (object);
g_free (eas_store->storage_path);
- g_mutex_free (eas_store->priv->get_finfo_lock);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (camel_eas_store_parent_class)->finalize (object);
@@ -630,8 +611,6 @@ camel_eas_store_class_init (CamelEasStoreClass *class)
service_class->EVO3_sync(disconnect) = eas_disconnect_sync;
store_class = CAMEL_STORE_CLASS (class);
- store_class->hash_folder_name = eas_hash_folder_name;
- store_class->compare_folder_name = eas_compare_folder_name;
store_class->EVO3_sync(get_folder) = eas_get_folder_sync;
store_class->EVO3_sync(create_folder) = eas_create_folder_sync;
store_class->EVO3_sync(delete_folder) = eas_delete_folder_sync;
@@ -651,5 +630,5 @@ camel_eas_store_init (CamelEasStore *eas_store)
eas_store->priv->handler = NULL;
eas_store->priv->last_refresh_time = time (NULL) - (FINFO_REFRESH_INTERVAL + 10);
- eas_store->priv->get_finfo_lock = g_mutex_new ();
+ g_mutex_init(&eas_store->priv->get_finfo_lock);
}
diff --git a/camel/camel-eas-store.h b/camel/camel-eas-store.h
index 3b2f7bc..aee467b 100644
--- a/camel/camel-eas-store.h
+++ b/camel/camel-eas-store.h
@@ -75,6 +75,7 @@ EasEmailHandler *
camel_eas_store_get_handler (CamelEasStore *eas_store);
gboolean camel_eas_store_connected (CamelEasStore *store,
+ GCancellable *cancellable,
GError **error);
G_END_DECLS
diff --git a/camel/camel-eas-transport.c b/camel/camel-eas-transport.c
index d2b28d8..916031b 100644
--- a/camel/camel-eas-transport.c
+++ b/camel/camel-eas-transport.c
@@ -59,10 +59,11 @@ eas_transport_get_name (CamelService *service,
CamelNetworkSettings *network_settings;
CamelSettings *settings;
- settings = camel_service_get_settings (service);
+ settings = camel_service_ref_settings (service);
network_settings = CAMEL_NETWORK_SETTINGS (settings);
host = camel_network_settings_get_host (network_settings);
+ g_object_unref (settings);
#else
host = camel_service_get_camel_url (service)->host;
#endif
@@ -94,7 +95,7 @@ eas_send_to_sync (CamelTransport *transport,
int fd;
gboolean res;
#if EDS_CHECK_VERSION(3,3,90)
- CamelStoreSettings *settings = CAMEL_STORE_SETTINGS (camel_service_get_settings (service));
+ CamelStoreSettings *settings = CAMEL_STORE_SETTINGS (camel_service_ref_settings (service));
#endif
EVO3(progress_data = cancellable);
@@ -102,6 +103,7 @@ eas_send_to_sync (CamelTransport *transport,
#if EDS_CHECK_VERSION(3,3,90)
account_uid = g_strdup(camel_eas_settings_get_account_uid ((CamelEasSettings *) settings));
+ g_object_unref(settings);
#else
account_uid = camel_url_get_param (camel_service_get_camel_url(service),
"account_uid");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]