[evolution/gnome-3-10] Bug #702709 - Do not forget to set CamelSession offline



commit 3424952991393ba34e237717709b23b08f0f7101
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jan 21 12:56:13 2014 +0100

    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 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index b7fb847..cfab193 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -128,6 +128,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)
@@ -145,6 +157,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_get_network_available (shell) &&
                e_shell_backend_is_started (E_SHELL_BACKEND (backend)))
                synchronize = em_utils_prompt_user (
@@ -167,6 +182,8 @@ mail_backend_prepare_for_offline_cb (EShell *shell,
                g_object_unref (cancellable);
        }
 
+       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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]