|
|
c9b2f7 |
From f50530ad101b47d461a345ff2b8b295b86c05d3a Mon Sep 17 00:00:00 2001
|
|
|
c9b2f7 |
From: Milan Crha <mcrha@redhat.com>
|
|
|
c9b2f7 |
Date: Thu, 27 Sep 2018 10:51:05 +0200
|
|
|
c9b2f7 |
Subject: Collection backend schedules two 'populate' requests after going
|
|
|
c9b2f7 |
online
|
|
|
c9b2f7 |
|
|
|
c9b2f7 |
ECollectionBackend base class makes sure the 'populate' method is called
|
|
|
c9b2f7 |
after the backend itself goes online, thus there is no need to schedule
|
|
|
c9b2f7 |
it in the descendant again.
|
|
|
c9b2f7 |
|
|
|
c9b2f7 |
Related to https://gitlab.gnome.org/GNOME/evolution-data-server/issues/36
|
|
|
c9b2f7 |
|
|
|
c9b2f7 |
diff --git a/src/collection/e-ews-backend.c b/src/collection/e-ews-backend.c
|
|
|
c9b2f7 |
index 651694b7..d9a973af 100644
|
|
|
c9b2f7 |
--- a/src/collection/e-ews-backend.c
|
|
|
c9b2f7 |
+++ b/src/collection/e-ews-backend.c
|
|
|
c9b2f7 |
@@ -48,7 +48,7 @@ struct _EEwsBackendPrivate {
|
|
|
c9b2f7 |
|
|
|
c9b2f7 |
gboolean need_update_folders;
|
|
|
c9b2f7 |
|
|
|
c9b2f7 |
- gulong notify_online_id;
|
|
|
c9b2f7 |
+ gulong source_changed_id;
|
|
|
c9b2f7 |
};
|
|
|
c9b2f7 |
|
|
|
c9b2f7 |
struct _SyncFoldersClosure {
|
|
|
c9b2f7 |
@@ -647,15 +647,21 @@ static void
|
|
|
c9b2f7 |
ews_backend_dispose (GObject *object)
|
|
|
c9b2f7 |
{
|
|
|
c9b2f7 |
EEwsBackendPrivate *priv;
|
|
|
c9b2f7 |
+ ESource *source;
|
|
|
c9b2f7 |
|
|
|
c9b2f7 |
priv = E_EWS_BACKEND_GET_PRIVATE (object);
|
|
|
c9b2f7 |
|
|
|
c9b2f7 |
+ source = e_backend_get_source (E_BACKEND (object));
|
|
|
c9b2f7 |
+ if (source && priv->source_changed_id) {
|
|
|
c9b2f7 |
+ g_signal_handler_disconnect (source, priv->source_changed_id);
|
|
|
c9b2f7 |
+ priv->source_changed_id = 0;
|
|
|
c9b2f7 |
+ }
|
|
|
c9b2f7 |
+
|
|
|
c9b2f7 |
g_hash_table_remove_all (priv->folders);
|
|
|
c9b2f7 |
|
|
|
c9b2f7 |
- if (priv->connection != NULL) {
|
|
|
c9b2f7 |
- g_object_unref (priv->connection);
|
|
|
c9b2f7 |
- priv->connection = NULL;
|
|
|
c9b2f7 |
- }
|
|
|
c9b2f7 |
+ g_mutex_lock (&priv->connection_lock);
|
|
|
c9b2f7 |
+ g_clear_object (&priv->connection);
|
|
|
c9b2f7 |
+ g_mutex_unlock (&priv->connection_lock);
|
|
|
c9b2f7 |
|
|
|
c9b2f7 |
/* Chain up to parent's dispose() method. */
|
|
|
c9b2f7 |
G_OBJECT_CLASS (e_ews_backend_parent_class)->dispose (object);
|
|
|
c9b2f7 |
@@ -770,12 +776,8 @@ ews_backend_populate (ECollectionBackend *backend)
|
|
|
c9b2f7 |
|
|
|
c9b2f7 |
ews_backend->priv->need_update_folders = TRUE;
|
|
|
c9b2f7 |
|
|
|
c9b2f7 |
- if (!ews_backend->priv->notify_online_id) {
|
|
|
c9b2f7 |
- ews_backend->priv->notify_online_id = g_signal_connect (
|
|
|
c9b2f7 |
- backend, "notify::online",
|
|
|
c9b2f7 |
- G_CALLBACK (ews_backend_populate), NULL);
|
|
|
c9b2f7 |
-
|
|
|
c9b2f7 |
- g_signal_connect (
|
|
|
c9b2f7 |
+ if (!ews_backend->priv->source_changed_id) {
|
|
|
c9b2f7 |
+ ews_backend->priv->source_changed_id = g_signal_connect (
|
|
|
c9b2f7 |
source, "changed",
|
|
|
c9b2f7 |
G_CALLBACK (ews_backend_source_changed_cb), ews_backend);
|
|
|
c9b2f7 |
}
|