diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-02-01 05:14:49 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-02-01 06:39:05 +0800 |
commit | fd43cd692ad12e7f9c70386c1b0867b16f9ec15d (patch) | |
tree | 7de35780745b82c9655e0bbc87945f36368c4643 /libemail-engine | |
parent | fc3bf6f39e7215df6325515afff3217aedb2cc10 (diff) | |
download | gsoc2013-evolution-fd43cd692ad12e7f9c70386c1b0867b16f9ec15d.tar.gz gsoc2013-evolution-fd43cd692ad12e7f9c70386c1b0867b16f9ec15d.tar.zst gsoc2013-evolution-fd43cd692ad12e7f9c70386c1b0867b16f9ec15d.zip |
Incorporate ESourceUOA.
Where we make exceptions for GNOME Online Accounts, so too shall we for
Ubuntu Online Accounts.
Diffstat (limited to 'libemail-engine')
-rw-r--r-- | libemail-engine/e-mail-session.c | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/libemail-engine/e-mail-session.c b/libemail-engine/e-mail-session.c index 82c73c5349..53d2e7982e 100644 --- a/libemail-engine/e-mail-session.c +++ b/libemail-engine/e-mail-session.c @@ -506,6 +506,27 @@ mail_session_check_goa_mail_disabled (EMailSession *session, return goa_mail_disabled; } +static gboolean +mail_session_check_uoa_mail_disabled (EMailSession *session, + ESource *source) +{ + ESource *uoa_source; + ESourceRegistry *registry; + gboolean uoa_mail_disabled = FALSE; + + registry = e_mail_session_get_registry (session); + + uoa_source = e_source_registry_find_extension ( + registry, source, E_SOURCE_EXTENSION_UOA); + + if (uoa_source != NULL) { + uoa_mail_disabled = !e_source_get_enabled (source); + g_object_unref (uoa_source); + } + + return uoa_mail_disabled; +} + static void mail_session_add_from_source (EMailSession *session, CamelProviderType type, @@ -547,6 +568,10 @@ mail_session_add_from_source (EMailSession *session, if (mail_session_check_goa_mail_disabled (session, source)) return; + /* Same deal for the [Ubuntu Online Accounts] extension. */ + if (mail_session_check_uoa_mail_disabled (session, source)) + return; + service = camel_session_add_service ( CAMEL_SESSION (session), uid, backend_name, type, &error); @@ -630,17 +655,26 @@ mail_session_source_enabled_cb (ESourceRegistry *registry, EMailSession *session) { ESource *goa_source; + ESource *uoa_source; - /* If the source is linked to a GNOME Online Account, - * enabling the source is equivalent to adding it. */ + /* If the source is linked to a GNOME Online Account + * or Ubuntu Online Account, enabling the source is + * equivalent to adding it. */ goa_source = e_source_registry_find_extension ( registry, source, E_SOURCE_EXTENSION_GOA); - if (goa_source != NULL) { + uoa_source = e_source_registry_find_extension ( + registry, source, E_SOURCE_EXTENSION_UOA); + + if (goa_source != NULL || uoa_source != NULL) mail_session_source_added_cb (registry, source, session); + + if (goa_source != NULL) g_object_unref (goa_source); - } + + if (uoa_source != NULL) + g_object_unref (uoa_source); } static void @@ -649,17 +683,26 @@ mail_session_source_disabled_cb (ESourceRegistry *registry, EMailSession *session) { ESource *goa_source; + ESource *uoa_source; - /* If the source is linked to a GNOME Online Account, - * disabling the source is equivalent to removing it. */ + /* If the source is linked to a GNOME Online Account + * or Ubuntu Online Account, disabling the source is + * equivalent to removing it. */ goa_source = e_source_registry_find_extension ( registry, source, E_SOURCE_EXTENSION_GOA); - if (goa_source != NULL) { + uoa_source = e_source_registry_find_extension ( + registry, source, E_SOURCE_EXTENSION_UOA); + + if (goa_source != NULL || uoa_source != NULL) mail_session_source_removed_cb (registry, source, session); + + if (goa_source != NULL) g_object_unref (goa_source); - } + + if (uoa_source != NULL) + g_object_unref (uoa_source); } static void |