|
|
79117e |
diff -up evolution-3.8.5/mail/e-mail-backend.c.disconnect-on-network-outage evolution-3.8.5/mail/e-mail-backend.c
|
|
|
79117e |
--- evolution-3.8.5/mail/e-mail-backend.c.disconnect-on-network-outage 2013-07-23 14:51:52.000000000 +0200
|
|
|
79117e |
+++ evolution-3.8.5/mail/e-mail-backend.c 2014-04-07 12:47:49.658625438 +0200
|
|
|
79117e |
@@ -128,6 +128,18 @@ mail_backend_store_operation_done_cb (Ca
|
|
|
79117e |
}
|
|
|
79117e |
|
|
|
79117e |
static void
|
|
|
79117e |
+mail_backend_set_session_offline_cb (gpointer user_data,
|
|
|
79117e |
+ GObject *object)
|
|
|
79117e |
+{
|
|
|
79117e |
+ CamelSession *session = user_data;
|
|
|
79117e |
+
|
|
|
79117e |
+ g_return_if_fail (CAMEL_IS_SESSION (session));
|
|
|
79117e |
+
|
|
|
79117e |
+ camel_session_set_online (session, FALSE);
|
|
|
79117e |
+ g_object_unref (session);
|
|
|
79117e |
+}
|
|
|
79117e |
+
|
|
|
79117e |
+static void
|
|
|
79117e |
mail_backend_prepare_for_offline_cb (EShell *shell,
|
|
|
79117e |
EActivity *activity,
|
|
|
79117e |
EMailBackend *backend)
|
|
|
79117e |
@@ -138,18 +150,6 @@ mail_backend_prepare_for_offline_cb (ESh
|
|
|
79117e |
GQueue queue = G_QUEUE_INIT;
|
|
|
79117e |
gboolean synchronize = FALSE;
|
|
|
79117e |
|
|
|
79117e |
- if (e_shell_backend_is_started (E_SHELL_BACKEND (backend))) {
|
|
|
79117e |
- if (!e_activity_get_cancellable (activity)) {
|
|
|
79117e |
- GCancellable *cancellable;
|
|
|
79117e |
-
|
|
|
79117e |
- cancellable = camel_operation_new ();
|
|
|
79117e |
- e_activity_set_cancellable (activity, cancellable);
|
|
|
79117e |
- g_object_unref (cancellable);
|
|
|
79117e |
- }
|
|
|
79117e |
-
|
|
|
79117e |
- e_shell_backend_add_activity (E_SHELL_BACKEND (backend), activity);
|
|
|
79117e |
- }
|
|
|
79117e |
-
|
|
|
79117e |
window = e_shell_get_active_window (shell);
|
|
|
79117e |
session = e_mail_backend_get_session (backend);
|
|
|
79117e |
account_store = e_mail_ui_session_get_account_store (E_MAIL_UI_SESSION (session));
|
|
|
79117e |
@@ -163,8 +163,29 @@ mail_backend_prepare_for_offline_cb (ESh
|
|
|
79117e |
mail_cancel_all ();
|
|
|
79117e |
camel_session_set_network_available (
|
|
|
79117e |
CAMEL_SESSION (session), FALSE);
|
|
|
79117e |
+ camel_session_set_online (CAMEL_SESSION (session), FALSE);
|
|
|
79117e |
}
|
|
|
79117e |
|
|
|
79117e |
+ if (e_shell_backend_is_started (E_SHELL_BACKEND (backend))) {
|
|
|
79117e |
+ GCancellable *cancellable;
|
|
|
79117e |
+
|
|
|
79117e |
+ cancellable = e_activity_get_cancellable (activity);
|
|
|
79117e |
+ if (!cancellable) {
|
|
|
79117e |
+ cancellable = camel_operation_new ();
|
|
|
79117e |
+ e_activity_set_cancellable (activity, cancellable);
|
|
|
79117e |
+ g_object_unref (cancellable);
|
|
|
79117e |
+ } else {
|
|
|
79117e |
+ /* Maybe the cancellable just got cancelled when the above
|
|
|
79117e |
+ mail_cancel_all() had been called, but we want it alive
|
|
|
79117e |
+ for the following "go-offline" operation, thus reset it. */
|
|
|
79117e |
+ g_cancellable_reset (cancellable);
|
|
|
79117e |
+ }
|
|
|
79117e |
+
|
|
|
79117e |
+ e_shell_backend_add_activity (E_SHELL_BACKEND (backend), activity);
|
|
|
79117e |
+ }
|
|
|
79117e |
+
|
|
|
79117e |
+ g_object_weak_ref (G_OBJECT (activity), mail_backend_set_session_offline_cb, g_object_ref (session));
|
|
|
79117e |
+
|
|
|
79117e |
e_mail_account_store_queue_enabled_services (account_store, &queue);
|
|
|
79117e |
while (!g_queue_is_empty (&queue)) {
|
|
|
79117e |
CamelService *service;
|