[evolution-data-server] [Google/ownCloud backend] Always update discovered ESource details



commit 6d216d4a47a5fb5667751f16eb86e71e2195a6b6
Author: Milan Crha <mcrha redhat com>
Date:   Thu Aug 20 17:29:57 2015 +0200

    [Google/ownCloud backend] Always update discovered ESource details

 modules/google-backend/module-google-backend.c     |   47 ++++++++++----------
 modules/owncloud-backend/module-owncloud-backend.c |   47 ++++++++++----------
 2 files changed, 48 insertions(+), 46 deletions(-)
---
diff --git a/modules/google-backend/module-google-backend.c b/modules/google-backend/module-google-backend.c
index 54f23f4..f794aa1 100644
--- a/modules/google-backend/module-google-backend.c
+++ b/modules/google-backend/module-google-backend.c
@@ -247,31 +247,8 @@ google_add_found_source (ECollectionBackend *collection,
        source_uid = g_hash_table_lookup (known_sources, identity);
        is_new = !source_uid;
        if (is_new) {
-               ESource *master_source;
-
                source = e_collection_backend_new_child (collection, identity);
                g_warn_if_fail (source != NULL);
-
-               if (source) {
-                       ESourceCollection *collection_extension;
-                       ESourceAuthentication *child_auth;
-                       ESourceResource *resource;
-                       ESourceWebdav *master_webdav, *child_webdav;
-
-                       master_source = e_backend_get_source (E_BACKEND (collection));
-                       master_webdav = e_source_get_extension (master_source, 
E_SOURCE_EXTENSION_WEBDAV_BACKEND);
-                       collection_extension = e_source_get_extension (master_source, 
E_SOURCE_EXTENSION_COLLECTION);
-                       child_auth = e_source_get_extension (source, E_SOURCE_EXTENSION_AUTHENTICATION);
-                       child_webdav = e_source_get_extension (source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
-                       resource = e_source_get_extension (source, E_SOURCE_EXTENSION_RESOURCE);
-
-                       e_source_authentication_set_user (child_auth, e_source_collection_get_identity 
(collection_extension));
-                       e_source_webdav_set_soup_uri (child_webdav, uri);
-                       e_source_resource_set_identity (resource, identity);
-
-                       /* inherit ssl trust options */
-                       e_source_webdav_set_ssl_trust (child_webdav, e_source_webdav_get_ssl_trust 
(master_webdav));
-               }
        } else {
                source = e_source_registry_server_ref_source (server, source_uid);
                g_warn_if_fail (source != NULL);
@@ -279,6 +256,30 @@ google_add_found_source (ECollectionBackend *collection,
                g_hash_table_remove (known_sources, identity);
        }
 
+       if (source) {
+               ESource *master_source;
+               ESourceCollection *collection_extension;
+               ESourceAuthentication *child_auth;
+               ESourceResource *resource;
+               ESourceWebdav *master_webdav, *child_webdav;
+
+               master_source = e_backend_get_source (E_BACKEND (collection));
+               master_webdav = e_source_get_extension (master_source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
+               collection_extension = e_source_get_extension (master_source, E_SOURCE_EXTENSION_COLLECTION);
+               child_auth = e_source_get_extension (source, E_SOURCE_EXTENSION_AUTHENTICATION);
+               child_webdav = e_source_get_extension (source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
+               resource = e_source_get_extension (source, E_SOURCE_EXTENSION_RESOURCE);
+
+               e_source_authentication_set_user (child_auth, e_source_collection_get_identity 
(collection_extension));
+               e_source_webdav_set_soup_uri (child_webdav, uri);
+               e_source_resource_set_identity (resource, identity);
+
+               if (is_new) {
+                       /* inherit ssl trust options */
+                       e_source_webdav_set_ssl_trust (child_webdav, e_source_webdav_get_ssl_trust 
(master_webdav));
+               }
+       }
+
        g_free (identity);
        g_free (url);
 
diff --git a/modules/owncloud-backend/module-owncloud-backend.c 
b/modules/owncloud-backend/module-owncloud-backend.c
index 354c011..6315d0d 100644
--- a/modules/owncloud-backend/module-owncloud-backend.c
+++ b/modules/owncloud-backend/module-owncloud-backend.c
@@ -175,31 +175,8 @@ owncloud_add_found_source (ECollectionBackend *collection,
        source_uid = g_hash_table_lookup (known_sources, identity);
        is_new = !source_uid;
        if (is_new) {
-               ESource *master_source;
-
                source = e_collection_backend_new_child (collection, identity);
                g_warn_if_fail (source != NULL);
-
-               if (source) {
-                       ESourceCollection *collection_extension;
-                       ESourceAuthentication *child_auth;
-                       ESourceResource *resource;
-                       ESourceWebdav *master_webdav, *child_webdav;
-
-                       master_source = e_backend_get_source (E_BACKEND (collection));
-                       master_webdav = e_source_get_extension (master_source, 
E_SOURCE_EXTENSION_WEBDAV_BACKEND);
-                       collection_extension = e_source_get_extension (master_source, 
E_SOURCE_EXTENSION_COLLECTION);
-                       child_auth = e_source_get_extension (source, E_SOURCE_EXTENSION_AUTHENTICATION);
-                       child_webdav = e_source_get_extension (source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
-                       resource = e_source_get_extension (source, E_SOURCE_EXTENSION_RESOURCE);
-
-                       e_source_authentication_set_user (child_auth, e_source_collection_get_identity 
(collection_extension));
-                       e_source_webdav_set_soup_uri (child_webdav, uri);
-                       e_source_resource_set_identity (resource, identity);
-
-                       /* inherit ssl trust options */
-                       e_source_webdav_set_ssl_trust (child_webdav, e_source_webdav_get_ssl_trust 
(master_webdav));
-               }
        } else {
                source = e_source_registry_server_ref_source (server, source_uid);
                g_warn_if_fail (source != NULL);
@@ -207,6 +184,30 @@ owncloud_add_found_source (ECollectionBackend *collection,
                g_hash_table_remove (known_sources, identity);
        }
 
+       if (source) {
+               ESource *master_source;
+               ESourceCollection *collection_extension;
+               ESourceAuthentication *child_auth;
+               ESourceResource *resource;
+               ESourceWebdav *master_webdav, *child_webdav;
+
+               master_source = e_backend_get_source (E_BACKEND (collection));
+               master_webdav = e_source_get_extension (master_source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
+               collection_extension = e_source_get_extension (master_source, E_SOURCE_EXTENSION_COLLECTION);
+               child_auth = e_source_get_extension (source, E_SOURCE_EXTENSION_AUTHENTICATION);
+               child_webdav = e_source_get_extension (source, E_SOURCE_EXTENSION_WEBDAV_BACKEND);
+               resource = e_source_get_extension (source, E_SOURCE_EXTENSION_RESOURCE);
+
+               e_source_authentication_set_user (child_auth, e_source_collection_get_identity 
(collection_extension));
+               e_source_webdav_set_soup_uri (child_webdav, uri);
+               e_source_resource_set_identity (resource, identity);
+
+               if (is_new) {
+                       /* inherit ssl trust options */
+                       e_source_webdav_set_ssl_trust (child_webdav, e_source_webdav_get_ssl_trust 
(master_webdav));
+               }
+       }
+
        g_free (identity);
        g_free (url);
 


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