Honor autosave_encrypted preference when using external editor.
authorAndrej Kacian <ticho@claws-mail.org>
Mon, 12 Dec 2016 23:55:24 +0000 (00:55 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Mon, 12 Dec 2016 23:55:24 +0000 (00:55 +0100)
Patch by Ashish Gupta <ashmew2@gmail.com>.

src/compose.c

index ae84883..a4e4881 100644 (file)
@@ -9493,6 +9493,14 @@ static gboolean compose_ext_editor_kill(Compose *compose)
        return TRUE;
 }
 
        return TRUE;
 }
 
+static gboolean compose_can_autosave(Compose *compose)
+{
+       if (compose->privacy_system && compose->use_encryption)
+               return prefs_common.autosave && prefs_common.autosave_encrypted;
+       else
+               return prefs_common.autosave;
+}
+
 static gboolean compose_input_cb(GIOChannel *source, GIOCondition condition,
                                 gpointer data)
 {
 static gboolean compose_input_cb(GIOChannel *source, GIOCondition condition,
                                 gpointer data)
 {
@@ -9521,7 +9529,10 @@ static gboolean compose_input_cb(GIOChannel *source, GIOCondition condition,
                gtk_text_buffer_set_text(buffer, "", -1);
                compose_insert_file(compose, compose->exteditor_file);
                compose_changed_cb(NULL, compose);
                gtk_text_buffer_set_text(buffer, "", -1);
                compose_insert_file(compose, compose->exteditor_file);
                compose_changed_cb(NULL, compose);
-               compose_draft((gpointer)compose, COMPOSE_AUTO_SAVE);
+
+               /* Check if we should save the draft or not */
+               if (compose_can_autosave(compose))
+                 compose_draft((gpointer)compose, COMPOSE_AUTO_SAVE);
 
                if (claws_unlink(compose->exteditor_file) < 0)
                        FILE_OP_ERROR(compose->exteditor_file, "unlink");
 
                if (claws_unlink(compose->exteditor_file) < 0)
                        FILE_OP_ERROR(compose->exteditor_file, "unlink");
@@ -10382,14 +10393,6 @@ void compose_close_toolbar(Compose *compose)
        compose_close_cb(NULL, compose);
 }
 
        compose_close_cb(NULL, compose);
 }
 
-static gboolean compose_can_autosave(Compose *compose)
-{
-       if (compose->privacy_system && compose->use_encryption)
-               return prefs_common.autosave && prefs_common.autosave_encrypted;
-       else
-               return prefs_common.autosave;
-}
-
 static void compose_close_cb(GtkAction *action, gpointer data)
 {
        Compose *compose = (Compose *)data;
 static void compose_close_cb(GtkAction *action, gpointer data)
 {
        Compose *compose = (Compose *)data;