[evolution-ews/gnome-3-38] eds-I#286 - Skip collection account refresh when parts disabled
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews/gnome-3-38] eds-I#286 - Skip collection account refresh when parts disabled
- Date: Thu, 7 Jan 2021 17:42:29 +0000 (UTC)
commit 456f65f099d3b06f6cc16a013a34b5dffcb07088
Author: Milan Crha <mcrha redhat com>
Date: Thu Jan 7 18:40:53 2021 +0100
eds-I#286 - Skip collection account refresh when parts disabled
It doesn't make sense to ask the server for existing sources, the less
the user for credentials to login to the server, when all the related
parts are disabled.
Related to https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/286
src/EWS/registry/e-ews-backend.c | 25 +++++++++++++------------
src/Microsoft365/registry/e-m365-backend.c | 21 +++++++++++----------
2 files changed, 24 insertions(+), 22 deletions(-)
---
diff --git a/src/EWS/registry/e-ews-backend.c b/src/EWS/registry/e-ews-backend.c
index b9915a9e..341773d3 100644
--- a/src/EWS/registry/e-ews-backend.c
+++ b/src/EWS/registry/e-ews-backend.c
@@ -600,7 +600,7 @@ static void
ews_backend_source_changed_cb (ESource *source,
EEwsBackend *backend)
{
- if (!e_source_get_enabled (source)) {
+ if (!e_collection_backend_get_part_enabled (E_COLLECTION_BACKEND (backend),
E_COLLECTION_BACKEND_PART_ANY)) {
backend->priv->need_update_folders = TRUE;
return;
}
@@ -814,12 +814,13 @@ ews_backend_folders_synced_cb (GObject *source,
}
static void
-ews_backend_populate (ECollectionBackend *backend)
+ews_backend_populate (ECollectionBackend *collection_backend)
{
ESource *source;
- EEwsBackend *ews_backend = E_EWS_BACKEND (backend);
+ EEwsBackend *ews_backend = E_EWS_BACKEND (collection_backend);
+ EBackend *backend = E_BACKEND (ews_backend);
- source = e_backend_get_source (E_BACKEND (backend));
+ source = e_backend_get_source (backend);
ews_backend->priv->need_update_folders = TRUE;
@@ -830,32 +831,32 @@ ews_backend_populate (ECollectionBackend *backend)
}
/* do not do anything, if account is disabled */
- if (!e_source_get_enabled (source))
+ if (!e_collection_backend_get_part_enabled (collection_backend, E_COLLECTION_BACKEND_PART_ANY))
return;
- if (!e_collection_backend_freeze_populate (backend)) {
- e_collection_backend_thaw_populate (backend);
+ if (!e_collection_backend_freeze_populate (collection_backend)) {
+ e_collection_backend_thaw_populate (collection_backend);
return;
}
ews_backend_add_gal_source (ews_backend);
- ews_backend_claim_old_resources (backend);
+ ews_backend_claim_old_resources (collection_backend);
- if (e_backend_get_online (E_BACKEND (backend))) {
+ if (e_backend_get_online (backend)) {
CamelEwsSettings *ews_settings;
ews_settings = ews_backend_get_settings (ews_backend);
if (e_ews_connection_utils_get_without_password (ews_settings)) {
- e_backend_schedule_authenticate (E_BACKEND (backend), NULL);
+ e_backend_schedule_authenticate (backend, NULL);
} else {
- e_backend_credentials_required_sync (E_BACKEND (backend),
+ e_backend_credentials_required_sync (backend,
E_SOURCE_CREDENTIALS_REASON_REQUIRED, NULL, 0, NULL,
NULL, NULL);
}
}
- e_collection_backend_thaw_populate (backend);
+ e_collection_backend_thaw_populate (collection_backend);
}
static gchar *
diff --git a/src/Microsoft365/registry/e-m365-backend.c b/src/Microsoft365/registry/e-m365-backend.c
index 1eef5f81..a19917b0 100644
--- a/src/Microsoft365/registry/e-m365-backend.c
+++ b/src/Microsoft365/registry/e-m365-backend.c
@@ -59,7 +59,7 @@ static void
m365_backend_source_changed_cb (ESource *source,
EM365Backend *backend)
{
- if (!e_source_get_enabled (source)) {
+ if (!e_collection_backend_get_part_enabled (E_COLLECTION_BACKEND (backend),
E_COLLECTION_BACKEND_PART_ANY)) {
backend->priv->need_update_folders = TRUE;
return;
}
@@ -71,10 +71,11 @@ m365_backend_source_changed_cb (ESource *source,
}
static void
-m365_backend_populate (ECollectionBackend *backend)
+m365_backend_populate (ECollectionBackend *collection_backend)
{
ESource *source;
- EM365Backend *m365_backend = E_M365_BACKEND (backend);
+ EM365Backend *m365_backend = E_M365_BACKEND (collection_backend);
+ EBackend *backend = E_BACKEND (m365_backend);
source = e_backend_get_source (E_BACKEND (backend));
@@ -86,20 +87,20 @@ m365_backend_populate (ECollectionBackend *backend)
}
/* do not do anything, if account is disabled */
- if (!e_source_get_enabled (source))
+ if (!e_collection_backend_get_part_enabled (collection_backend, E_COLLECTION_BACKEND_PART_ANY))
return;
- if (!e_collection_backend_freeze_populate (backend)) {
- e_collection_backend_thaw_populate (backend);
+ if (!e_collection_backend_freeze_populate (collection_backend)) {
+ e_collection_backend_thaw_populate (collection_backend);
return;
}
- m365_backend_claim_old_resources (backend);
+ m365_backend_claim_old_resources (collection_backend);
- if (e_backend_get_online (E_BACKEND (backend)))
- e_backend_schedule_authenticate (E_BACKEND (backend), NULL);
+ if (e_backend_get_online (backend))
+ e_backend_schedule_authenticate (backend, NULL);
- e_collection_backend_thaw_populate (backend);
+ e_collection_backend_thaw_populate (collection_backend);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]