From a9730b3e4a557deaec422f3c191418e7a66184e7 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 21 Jan 2014 12:51:50 +0100 Subject: 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. --- mail/e-mail-backend.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'mail/e-mail-backend.c') 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 @@ -122,6 +122,18 @@ mail_backend_store_operation_done_cb (CamelStore *store, g_object_unref (activity); } +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, @@ -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; -- cgit v1.2.3