aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer.c
diff options
context:
space:
mode:
Diffstat (limited to 'composer/e-msg-composer.c')
-rw-r--r--composer/e-msg-composer.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 55bfc84492..1b2d5c665c 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1264,6 +1264,15 @@ set_editor_text (EMsgComposer *composer,
/* Commands. */
+static void
+autosave_load_draft_cb (EMsgComposer *composer, GAsyncResult *result,
+ gchar *filename)
+{
+ if (e_composer_autosave_snapshot_finish (composer, result, NULL))
+ g_unlink (filename);
+ g_free (filename);
+}
+
static EMsgComposer *
autosave_load_draft (const gchar *filename)
{
@@ -1284,8 +1293,13 @@ autosave_load_draft (const gchar *filename)
composer = e_msg_composer_new_with_message (msg);
if (composer) {
- if (e_composer_autosave_snapshot (composer))
- g_unlink (filename);
+ /* Mark the message as changed so it gets autosaved again, then
+ * we can safely remove the old autosave file in
+ * autosave_load_draft_cb */
+ gtkhtml_editor_set_changed (GTKHTML_EDITOR (composer), FALSE);
+ e_composer_autosave_snapshot_async (composer,
+ (GAsyncReadyCallback) autosave_load_draft_cb,
+ g_strdup (filename));
gtk_widget_show (GTK_WIDGET (composer));
}
@@ -3883,7 +3897,9 @@ e_msg_composer_request_close_all (void)
* which is misleading.
*/
composer->priv->application_exiting = TRUE;
- e_composer_autosave_snapshot (composer);
+ e_composer_autosave_snapshot_async (composer,
+ (GAsyncReadyCallback) e_composer_autosave_snapshot_finish,
+ NULL);
gtk_action_activate (ACTION (CLOSE));
}