[evolution] Don't try to refresh or sync mail folders when offline.



commit 0b07e836c2aaf32c39fd4795a5f0ec6397b643ff
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Apr 13 12:50:00 2011 -0400

    Don't try to refresh or sync mail folders when offline.
    
    Switching between mail folders in offline mode produces lots of
    annoying alerts for operations we shouldn't even be attempting.

 mail/e-mail-paned-view.c |    4 +++-
 mail/e-mail-reader.c     |    8 +++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c
index f1d5cf1..20a0980 100644
--- a/mail/e-mail-paned-view.c
+++ b/mail/e-mail-paned-view.c
@@ -493,7 +493,9 @@ mail_paned_view_set_folder (EMailReader *reader,
 	if (folder == NULL)
 		goto exit;
 
-	mail_refresh_folder (folder, NULL, NULL);
+	/* Only refresh the folder if we're online. */
+	if (e_shell_get_online (shell))
+		mail_refresh_folder (folder, NULL, NULL);
 
 	/* This is a one-time-only callback. */
 	if (MESSAGE_LIST (message_list)->cursor_uid == NULL &&
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 30480fb..f26921c 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -2906,18 +2906,24 @@ mail_reader_set_folder (EMailReader *reader,
 	EMFormatHTML *formatter;
 	CamelFolder *previous_folder;
 	GtkWidget *message_list;
+	EMailBackend *backend;
+	EShell *shell;
 	const gchar *previous_folder_uri;
 	gboolean outgoing;
 
 	priv = E_MAIL_READER_GET_PRIVATE (reader);
 
+	backend = e_mail_reader_get_backend (reader);
 	formatter = e_mail_reader_get_formatter (reader);
 	message_list = e_mail_reader_get_message_list (reader);
 
 	previous_folder = e_mail_reader_get_folder (reader);
 	previous_folder_uri = e_mail_reader_get_folder_uri (reader);
 
-	if (previous_folder != NULL)
+	shell = e_shell_backend_get_shell (E_SHELL_BACKEND (backend));
+
+	/* Only synchronize the folder if we're online. */
+	if (previous_folder != NULL && e_shell_get_online (shell))
 		mail_sync_folder (previous_folder, NULL, NULL);
 
 	/* Skip the rest if we're already viewing the folder. */



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