aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;