[evolution] Bug #617557 - Can lost message after send failed
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug #617557 - Can lost message after send failed
- Date: Thu, 1 Mar 2012 08:44:00 +0000 (UTC)
commit 78cd0d0a73fd9941fe715438f9f498257d147090
Author: Milan Crha <mcrha redhat com>
Date: Thu Mar 1 09:43:00 2012 +0100
Bug #617557 - Can lost message after send failed
composer/e-msg-composer.c | 16 ++++++++--------
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 9f32d8c..c9f41d5 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 23c1755..ef5476f 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]