aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/em-composer-utils.c14
-rw-r--r--mail/mail-send-recv.c23
2 files changed, 29 insertions, 8 deletions
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index c9bdaabe79..64e1e2deed 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -520,7 +520,6 @@ composer_send_completed (EMailSession *session,
e_mail_session_send_to_finish (session, result, &error);
if (e_activity_handle_cancellation (context->activity, error)) {
- g_error_free (error);
set_changed = TRUE;
goto exit;
}
@@ -538,6 +537,16 @@ composer_send_completed (EMailSession *session,
e_shell_submit_alert (shell, alert);
g_object_unref (alert);
+ /* The destination store is offline => save to Outbox and try again later */
+ } else if (g_error_matches (error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_UNAVAILABLE)) {
+ /* Inform the user. */
+ e_alert_run_dialog_for_args (
+ GTK_WINDOW (context->composer),
+ "mail-composer:saving-to-outbox", NULL);
+ e_msg_composer_save_to_outbox (context->composer);
+
+ goto exit;
+
/* All other errors are shown in the composer window. */
} else if (error != NULL) {
gint response;
@@ -555,7 +564,6 @@ composer_send_completed (EMailSession *session,
e_msg_composer_send (context->composer);
if (response == GTK_RESPONSE_ACCEPT) /* Save to Outbox */
e_msg_composer_save_to_outbox (context->composer);
- g_error_free (error);
set_changed = TRUE;
goto exit;
}
@@ -569,6 +577,8 @@ composer_send_completed (EMailSession *session,
gtk_widget_destroy, context->composer);
exit:
+ g_clear_error (&error);
+
if (set_changed) {
gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE);
gtk_window_present (GTK_WINDOW (context->composer));
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index a11b10662d..c9334bdf59 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -1154,6 +1154,16 @@ receive_update_got_store (CamelStore *store,
E_MAIL_SESSION (info->session));
if (store != NULL) {
+ CamelProvider *provider;
+
+ /* do not update remote stores in offline */
+ provider = camel_service_get_provider (CAMEL_SERVICE (store));
+ if (provider && (provider->flags & CAMEL_PROVIDER_IS_REMOTE) != 0 &&
+ !camel_session_get_online (info->session))
+ store = NULL;
+ }
+
+ if (store != NULL) {
mail_folder_cache_note_store (
folder_cache, store, info->cancellable,
receive_update_got_folderinfo, info);
@@ -1213,7 +1223,7 @@ send_receive (GtkWindow *parent,
CamelFolder *local_outbox;
CamelService *transport;
struct _send_data *data;
- GList *scan;
+ GList *scan, *siter;
if (send_recv_dialog != NULL) {
if (parent != NULL && gtk_widget_get_realized (send_recv_dialog)) {
@@ -1222,9 +1232,6 @@ send_receive (GtkWindow *parent,
return send_recv_dialog;
}
- if (!camel_session_get_online (CAMEL_SESSION (session)))
- return send_recv_dialog;
-
transport = ref_default_transport (session);
local_outbox =
@@ -1237,8 +1244,10 @@ send_receive (GtkWindow *parent,
if (transport != NULL)
g_object_unref (transport);
- for (scan = data->infos; scan != NULL; scan = scan->next) {
- struct _send_info *info = scan->data;
+ scan = g_list_copy (data->infos);
+
+ for (siter = scan; siter != NULL; siter = siter->next) {
+ struct _send_info *info = siter->data;
if (!CAMEL_IS_SERVICE (info->service))
continue;
@@ -1275,6 +1284,8 @@ send_receive (GtkWindow *parent,
}
}
+ g_list_free (scan);
+
return send_recv_dialog;
}