diff options
author | Milan Crha <mcrha@redhat.com> | 2012-03-01 16:43:00 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-03-01 16:43:47 +0800 |
commit | 78cd0d0a73fd9941fe715438f9f498257d147090 (patch) | |
tree | 5f3389194c10c3d24b2ff4e10dd109da976023c8 | |
parent | 16a287af9336bda57e66e1e8fbfa46a64ca4d57f (diff) | |
download | gsoc2013-evolution-78cd0d0a73fd9941fe715438f9f498257d147090.tar gsoc2013-evolution-78cd0d0a73fd9941fe715438f9f498257d147090.tar.gz gsoc2013-evolution-78cd0d0a73fd9941fe715438f9f498257d147090.tar.bz2 gsoc2013-evolution-78cd0d0a73fd9941fe715438f9f498257d147090.tar.lz gsoc2013-evolution-78cd0d0a73fd9941fe715438f9f498257d147090.tar.xz gsoc2013-evolution-78cd0d0a73fd9941fe715438f9f498257d147090.tar.zst gsoc2013-evolution-78cd0d0a73fd9941fe715438f9f498257d147090.zip |
Bug #617557 - Can lost message after send failed
-rw-r--r-- | composer/e-msg-composer.c | 16 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 12 |
2 files changed, 20 insertions, 8 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 9f32d8cabe..c9f41d599a 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -3518,6 +3518,10 @@ msg_composer_send_cb (EMsgComposer *composer, g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); + /* The callback can set editor 'changed' if anything failed. */ + editor = GTKHTML_EDITOR (composer); + gtkhtml_editor_set_changed (editor, FALSE); + g_signal_emit ( composer, signals[SEND], 0, message, context->activity); @@ -3525,10 +3529,6 @@ msg_composer_send_cb (EMsgComposer *composer, g_object_unref (message); async_context_free (context); - - /* XXX This should be elsewhere. */ - editor = GTKHTML_EDITOR (composer); - gtkhtml_editor_set_changed (editor, FALSE); } /** @@ -3610,6 +3610,10 @@ msg_composer_save_to_drafts_cb (EMsgComposer *composer, g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message)); + /* The callback can set editor 'changed' if anything failed. */ + editor = GTKHTML_EDITOR (composer); + gtkhtml_editor_set_changed (editor, FALSE); + g_signal_emit ( composer, signals[SAVE_TO_DRAFTS], 0, message, context->activity); @@ -3617,10 +3621,6 @@ msg_composer_save_to_drafts_cb (EMsgComposer *composer, g_object_unref (message); async_context_free (context); - - /* XXX This should be elsewhere. */ - editor = GTKHTML_EDITOR (composer); - gtkhtml_editor_set_changed (editor, FALSE); } /** diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 23c1755687..ef5476f657 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -510,11 +510,13 @@ composer_send_completed (EMailSession *session, AsyncContext *context) { GError *error = NULL; + gboolean set_changed = FALSE; 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; } @@ -549,6 +551,7 @@ composer_send_completed (EMailSession *session, 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; } @@ -561,6 +564,9 @@ composer_send_completed (EMailSession *session, gtk_widget_destroy, context->composer); exit: + if (set_changed) + gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE); + async_context_free (context); } @@ -649,9 +655,11 @@ composer_save_to_drafts_complete (EMailSession *session, e_mail_session_handle_draft_headers_finish (session, result, &error); if (e_activity_handle_cancellation (context->activity, error)) { + gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE); g_error_free (error); } else if (error != NULL) { + gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE); g_warning ("%s", error->message); g_error_free (error); @@ -688,6 +696,7 @@ composer_save_to_drafts_cleanup (CamelFolder *drafts_folder, if (e_activity_handle_cancellation (context->activity, error)) { g_warn_if_fail (context->message_uid == NULL); + gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE); async_context_free (context); g_error_free (error); return; @@ -698,6 +707,7 @@ composer_save_to_drafts_cleanup (CamelFolder *drafts_folder, alert_sink, "mail-composer:save-to-drafts-error", error->message, NULL); + gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE); async_context_free (context); g_error_free (error); return; @@ -761,6 +771,7 @@ composer_save_to_drafts_got_folder (EMailSession *session, if (e_activity_handle_cancellation (context->activity, error)) { g_warn_if_fail (drafts_folder == NULL); + gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE); async_context_free (context); g_error_free (error); return; @@ -780,6 +791,7 @@ composer_save_to_drafts_got_folder (EMailSession *session, GTK_WINDOW (context->composer), "mail:ask-default-drafts", NULL); if (response != GTK_RESPONSE_YES) { + gtkhtml_editor_set_changed (GTKHTML_EDITOR (context->composer), TRUE); async_context_free (context); return; } |