diff options
author | Milan Crha <mcrha@redhat.com> | 2015-09-23 15:14:18 +0200 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2015-09-23 15:15:31 +0200 |
commit | f1081b2e9c3b67029f7c058940a91f3ec01a937b (patch) | |
tree | 84e60a3bbd1fe5cf17b3ba8f2d23223012af2056 | |
parent | 82d227d1c4138b19ee946f185525192248a84a6c (diff) | |
download | evolution-data-server-f1081b2e9c3b67029f7c058940a91f3ec01a937b.tar.gz |
Correct runtime warnings from ubuntu-online-accounts module
-rw-r--r-- | modules/ubuntu-online-accounts/e-signon-session-password.c | 2 | ||||
-rw-r--r-- | modules/ubuntu-online-accounts/module-ubuntu-online-accounts.c | 35 |
2 files changed, 34 insertions, 3 deletions
diff --git a/modules/ubuntu-online-accounts/e-signon-session-password.c b/modules/ubuntu-online-accounts/e-signon-session-password.c index 02a36c278..b12aecef3 100644 --- a/modules/ubuntu-online-accounts/e-signon-session-password.c +++ b/modules/ubuntu-online-accounts/e-signon-session-password.c @@ -240,7 +240,6 @@ signon_session_password_process_cb (GObject *source_object, AsyncContext *async_context; GVariant *session_data; GVariant *secret; - GString *string = NULL; GError *error = NULL; simple = G_SIMPLE_ASYNC_RESULT (user_data); @@ -276,7 +275,6 @@ signon_session_password_process_cb (GObject *source_object, async_context->password = g_string_new (g_variant_get_string (secret, NULL)); - g_string_free (string, TRUE); g_variant_unref (secret); exit: diff --git a/modules/ubuntu-online-accounts/module-ubuntu-online-accounts.c b/modules/ubuntu-online-accounts/module-ubuntu-online-accounts.c index ba3882ea6..51feee640 100644 --- a/modules/ubuntu-online-accounts/module-ubuntu-online-accounts.c +++ b/modules/ubuntu-online-accounts/module-ubuntu-online-accounts.c @@ -150,7 +150,40 @@ ubuntu_online_accounts_ref_account_service (EUbuntuOnlineAccounts *extension, const gchar *extension_name; const gchar *service_type; - service_type = e_source_get_ag_service_type (source); + if (e_source_has_extension (source, E_SOURCE_EXTENSION_COLLECTION)) { + /* Asking for credentials on the main (collection) source, which + doesn't belong to any particular service, thus try to pick any + enabled service, expecting the same password/token being + used for all other services. */ + service_type = NULL; + account_services = g_object_get_data (G_OBJECT (source), "ag-account-services"); + g_warn_if_fail (account_services != NULL); + if (account_services) { + AgAccountService *ag_service; + + ag_service = g_hash_table_lookup (account_services, E_AG_SERVICE_TYPE_CALENDAR); + if (ag_service && ag_account_service_get_enabled (ag_service)) + service_type = E_AG_SERVICE_TYPE_CALENDAR; + + if (!service_type) { + ag_service = g_hash_table_lookup (account_services, E_AG_SERVICE_TYPE_CONTACTS); + if (ag_service && ag_account_service_get_enabled (ag_service)) + service_type = E_AG_SERVICE_TYPE_CONTACTS; + } + + if (!service_type) { + ag_service = g_hash_table_lookup (account_services, E_AG_SERVICE_TYPE_MAIL); + if (ag_service && ag_account_service_get_enabled (ag_service)) + service_type = E_AG_SERVICE_TYPE_MAIL; + } + + if (!service_type) + return NULL; + } + } else { + service_type = e_source_get_ag_service_type (source); + } + g_return_val_if_fail (service_type != NULL, NULL); extension_name = E_SOURCE_EXTENSION_UOA; |