aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2014-01-21 19:51:50 +0800
committerMilan Crha <mcrha@redhat.com>2014-01-21 19:51:50 +0800
commita9730b3e4a557deaec422f3c191418e7a66184e7 (patch)
tree44f59a8160830aac6c4cd95fa35d45042fb9e8ff /mail
parent0044d1ed58855eb9e75cdde380b5ba98474bf145 (diff)
downloadgsoc2013-evolution-a9730b3e4a557deaec422f3c191418e7a66184e7.tar
gsoc2013-evolution-a9730b3e4a557deaec422f3c191418e7a66184e7.tar.gz
gsoc2013-evolution-a9730b3e4a557deaec422f3c191418e7a66184e7.tar.bz2
gsoc2013-evolution-a9730b3e4a557deaec422f3c191418e7a66184e7.tar.lz
gsoc2013-evolution-a9730b3e4a557deaec422f3c191418e7a66184e7.tar.xz
gsoc2013-evolution-a9730b3e4a557deaec422f3c191418e7a66184e7.tar.zst
gsoc2013-evolution-a9730b3e4a557deaec422f3c191418e7a66184e7.zip
Bug #702709 - Do not forget to set CamelSession offline
There was missing a call to set CamelSession offline, which made the other CamelService-s think they can do network operations, while it wasn't true.
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-backend.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index dbbd25e6ee..3e89447ba4 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -123,6 +123,18 @@ mail_backend_store_operation_done_cb (CamelStore *store,
}
static void
+mail_backend_set_session_offline_cb (gpointer user_data,
+ GObject *object)
+{
+ CamelSession *session = user_data;
+
+ g_return_if_fail (CAMEL_IS_SESSION (session));
+
+ camel_session_set_online (session, FALSE);
+ g_object_unref (session);
+}
+
+static void
mail_backend_prepare_for_offline_cb (EShell *shell,
EActivity *activity,
EMailBackend *backend)
@@ -139,6 +151,9 @@ mail_backend_prepare_for_offline_cb (EShell *shell,
session = e_mail_backend_get_session (backend);
account_store = e_mail_ui_session_get_account_store (E_MAIL_UI_SESSION (session));
+ if (!e_shell_get_network_available (shell))
+ camel_session_set_online (CAMEL_SESSION (session), FALSE);
+
if (e_shell_backend_is_started (shell_backend)) {
gboolean synchronize = FALSE;
@@ -160,6 +175,8 @@ mail_backend_prepare_for_offline_cb (EShell *shell,
e_shell_backend_add_activity (shell_backend, activity);
}
+ g_object_weak_ref (G_OBJECT (activity), mail_backend_set_session_offline_cb, g_object_ref (session));
+
e_mail_account_store_queue_enabled_services (account_store, &queue);
while (!g_queue_is_empty (&queue)) {
CamelService *service;