diff options
author | Milan Crha <mcrha@redhat.com> | 2014-02-06 01:00:25 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2014-02-06 01:00:25 +0800 |
commit | 3c9ff59b23d09bcc3a4d5e8e9a2ee3027d9d6d3d (patch) | |
tree | 2adcd54fbf164cd97e9b81b3c87b7bd142cf884c | |
parent | 337ec545e78e8806e2ffd26ce828bd2b41de9a3e (diff) | |
download | gsoc2013-evolution-3c9ff59b23d09bcc3a4d5e8e9a2ee3027d9d6d3d.tar gsoc2013-evolution-3c9ff59b23d09bcc3a4d5e8e9a2ee3027d9d6d3d.tar.gz gsoc2013-evolution-3c9ff59b23d09bcc3a4d5e8e9a2ee3027d9d6d3d.tar.bz2 gsoc2013-evolution-3c9ff59b23d09bcc3a4d5e8e9a2ee3027d9d6d3d.tar.lz gsoc2013-evolution-3c9ff59b23d09bcc3a4d5e8e9a2ee3027d9d6d3d.tar.xz gsoc2013-evolution-3c9ff59b23d09bcc3a4d5e8e9a2ee3027d9d6d3d.tar.zst gsoc2013-evolution-3c9ff59b23d09bcc3a4d5e8e9a2ee3027d9d6d3d.zip |
Bug #720940 - Always asked to synchronize folders when going offline
-rw-r--r-- | mail/e-mail-backend.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c index 60db3cc55a..3ea4db862b 100644 --- a/mail/e-mail-backend.c +++ b/mail/e-mail-backend.c @@ -108,6 +108,30 @@ mail_backend_uri_to_evname (const gchar *uri, return filename; } +static gboolean +mail_backend_any_store_requires_downsync (EMailAccountStore *account_store) +{ + GQueue queue = G_QUEUE_INIT; + gboolean any_requires_downsync = FALSE; + + g_return_val_if_fail (E_IS_MAIL_ACCOUNT_STORE (account_store), FALSE); + + e_mail_account_store_queue_enabled_services (account_store, &queue); + while (!g_queue_is_empty (&queue)) { + CamelService *service; + + service = g_queue_pop_head (&queue); + if (service == NULL) + continue; + + if (CAMEL_IS_OFFLINE_STORE (service)) + any_requires_downsync = any_requires_downsync || + camel_offline_store_requires_downsync (CAMEL_OFFLINE_STORE (service)); + } + + return any_requires_downsync; +} + /* Callback for various asynchronous CamelStore operations where * the EActivity's reference count is used as a counting semaphore. */ static void @@ -157,7 +181,8 @@ mail_backend_prepare_for_offline_cb (EShell *shell, if (e_shell_backend_is_started (shell_backend)) { gboolean synchronize = FALSE; - if (e_shell_get_network_available (shell)) + if (e_shell_get_network_available (shell) && + mail_backend_any_store_requires_downsync (account_store)) synchronize = em_utils_prompt_user ( window, NULL, "mail:ask-quick-offline", NULL); |