[evolution-ews/evolution-ews-3-12] Bug 737773 - Duplicate GAL in new accounts



commit 68b89a9c71fe094fc402a23fdb8524fa98efe370
Author: Milan Crha <mcrha redhat com>
Date:   Fri Oct 10 14:13:44 2014 +0200

    Bug 737773 - Duplicate GAL in new accounts

 src/collection/e-ews-backend.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/collection/e-ews-backend.c b/src/collection/e-ews-backend.c
index 5b93815..386e41d 100644
--- a/src/collection/e-ews-backend.c
+++ b/src/collection/e-ews-backend.c
@@ -47,6 +47,8 @@ struct _EEwsBackendPrivate {
        GMutex connection_lock;
 
        gboolean need_update_folders;
+
+       gulong notify_online_id;
 };
 
 struct _SyncFoldersClosure {
@@ -536,7 +538,13 @@ add_remote_sources (EEwsBackend *backend)
                                E_SERVER_SIDE_SOURCE (source), TRUE);
                        e_source_registry_server_add_source (registry, source);
                } else {
-                       e_source_registry_server_add_source (registry, source);
+                       GError *error = NULL;
+
+                       if (!e_source_remove_sync (source, NULL, &error))
+                               g_warning ("%s: Failed to remove old EWS source '%s': %s", G_STRFUNC, 
e_source_get_uid (source),
+                                       error ? error->message : "Unknown error");
+
+                       g_clear_error (&error);
                }
        }
 
@@ -657,6 +665,11 @@ ews_backend_populate (ECollectionBackend *backend)
        if (!e_source_get_enabled (source))
                return;
 
+       if (!ews_backend->priv->notify_online_id)
+               ews_backend->priv->notify_online_id = g_signal_connect (
+                       backend, "notify::online",
+                       G_CALLBACK (ews_backend_populate), NULL);
+
        /* For now at least, we don't need to know the
         * results, so no callback function is needed. */
        e_ews_backend_sync_folders (ews_backend, NULL, NULL, NULL);
@@ -1022,10 +1035,6 @@ e_ews_backend_init (EEwsBackend *backend)
        g_mutex_init (&backend->priv->folders_lock);
        g_mutex_init (&backend->priv->sync_state_lock);
        g_mutex_init (&backend->priv->connection_lock);
-
-       g_signal_connect (
-               backend, "notify::online",
-               G_CALLBACK (ews_backend_populate), NULL);
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]