[evolution-mapi] Listen for ESource changes only after source-registry backend is populated
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-mapi] Listen for ESource changes only after source-registry backend is populated
- Date: Thu, 3 Sep 2015 17:09:48 +0000 (UTC)
commit 002361d4b37e61ab739dfa1b3428627bdb41591e
Author: Milan Crha <mcrha redhat com>
Date: Thu Sep 3 19:08:04 2015 +0200
Listen for ESource changes only after source-registry backend is populated
This helps to avoid unnecessary updates on the source-registry side.
src/collection/e-mapi-backend.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/collection/e-mapi-backend.c b/src/collection/e-mapi-backend.c
index 2a732da..1769556 100644
--- a/src/collection/e-mapi-backend.c
+++ b/src/collection/e-mapi-backend.c
@@ -39,6 +39,7 @@ struct _EMapiBackendPrivate {
GHashTable *folders;
gboolean need_update_folders;
+ gulong source_changed_handler_id;
GMutex credentials_lock;
ENamedParameters *credentials;
@@ -435,10 +436,6 @@ mapi_backend_constructed (GObject *object)
* of weird races with clients trying to create folders. */
e_server_side_source_set_remote_creatable (
E_SERVER_SIDE_SOURCE (source), TRUE);
-
- g_signal_connect (
- source, "changed",
- G_CALLBACK (mapi_backend_source_changed_cb), backend);
}
static void
@@ -450,6 +447,11 @@ mapi_backend_dispose (GObject *object)
g_hash_table_remove_all (priv->folders);
+ if (priv->source_changed_handler_id) {
+ g_signal_handler_disconnect (e_backend_get_source (E_BACKEND (object)),
priv->source_changed_handler_id);
+ priv->source_changed_handler_id = 0;
+ }
+
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_mapi_backend_parent_class)->dispose (object);
}
@@ -484,6 +486,11 @@ mapi_backend_populate (ECollectionBackend *backend)
if (!e_source_get_enabled (source))
return;
+ if (!mapi_backend->priv->source_changed_handler_id)
+ mapi_backend->priv->source_changed_handler_id = g_signal_connect (
+ source, "changed",
+ G_CALLBACK (mapi_backend_source_changed_cb), backend);
+
/* We test authentication passwords by attempting to synchronize
* the folder hierarchy. Since we want to synchronize the folder
* hierarchy immediately on startup, schedule an authentication
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]