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



commit ccccb06138ccc83de82254307310769dc0335053
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 1c8477c..9bfc57b 100644
--- a/modules/google-backend/module-google-backend.c
+++ b/modules/google-backend/module-google-backend.c
@@ -453,6 +453,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"));
@@ -579,6 +583,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]