[evolution-data-server] Do not add Google Tasks source for non-GOA master sources



commit 9855823f89ef63955b75d2f37e3c9e3e02fcf27d
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jun 12 12:52:15 2015 +0200

    Do not add Google Tasks source for non-GOA master sources
    
    Google mail account configured directly in the Evolution can have set
    also Contacts and Calendar parts, which makes it a collection.
    The Google source-registry module adds for each such collection
    the Tasks source, which is not correct, because the GTasks require
    OAuth2, which is provided only through GOA. Thus do not add the GTasks
    source for non-GOA collection sources.

 modules/google-backend/module-google-backend.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/modules/google-backend/module-google-backend.c b/modules/google-backend/module-google-backend.c
index 3746090..1c1192e 100644
--- a/modules/google-backend/module-google-backend.c
+++ b/modules/google-backend/module-google-backend.c
@@ -451,6 +451,10 @@ google_backend_add_tasks (ECollectionBackend *backend)
 
        collection_source = e_backend_get_source (E_BACKEND (backend));
 
+       /* Tasks require OAuth2, which is supported only through GOA */
+       if (!e_source_has_extension (collection_source, E_SOURCE_EXTENSION_GOA))
+               return;
+
        resource_id = GOOGLE_TASKS_RESOURCE_ID;
        source = e_collection_backend_new_child (backend, resource_id);
        e_source_set_display_name (source, _("Tasks"));
@@ -577,6 +581,15 @@ google_backend_populate (ECollectionBackend *backend)
                ESource *source = link->data;
 
                have_tasks = have_tasks || e_source_has_extension (source, E_SOURCE_EXTENSION_TASK_LIST);
+               if (have_tasks) {
+                       source = e_backend_get_source (E_BACKEND (backend));
+
+                       /* Tasks require OAuth2, which is supported only through GOA */
+                       if (!e_source_has_extension (source, E_SOURCE_EXTENSION_GOA)) {
+                               e_source_remove_sync (source, NULL, NULL);
+                               have_tasks = FALSE;
+                       }
+               }
        }
        g_list_free_full (list, (GDestroyNotify) g_object_unref);
 


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