[geary] Tidy up how pending attachments are managed.



commit bfbafb288814e79b1068a4c94cbc45a46e11923f
Author: Michael James Gratton <mike vee net>
Date:   Thu Sep 29 10:12:33 2016 +1000

    Tidy up how pending attachments are managed.
    
    * src/client/composer/composer-widget.vala
      (ComposerWidget::fill_in_from_referred): Always remember pending
      attachments, only add them to the composer's attachments.
      (ComposerWidget::add_pending_attachments): New method for updating
      pending attachments.

 src/client/composer/composer-widget.vala |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 31e69da..ad47cb9 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -735,6 +735,7 @@ public class ComposerWidget : Gtk.EventBox {
             this.reply_subject = Geary.RFC822.Utils.create_subject_for_reply(referred);
             this.forward_subject = Geary.RFC822.Utils.create_subject_for_forward(referred);
         }
+        this.pending_attachments = referred.attachments;
         this.last_quote = quote;
         switch (this.compose_type) {
             case ComposeType.NEW_MESSAGE:
@@ -762,9 +763,7 @@ public class ComposerWidget : Gtk.EventBox {
                 } catch (Error error) {
                     debug("Error getting message body: %s", error.message);
                 }
-
-                foreach(Geary.Attachment attachment in referred.attachments)
-                    add_attachment(attachment.file, true);
+                add_pending_attachments();
             break;
 
             case ComposeType.REPLY:
@@ -773,7 +772,6 @@ public class ComposerWidget : Gtk.EventBox {
                 this.references = Geary.RFC822.Utils.reply_references(referred);
                 this.body_html = "\n\n" + Geary.RFC822.Utils.quote_email_for_reply(referred, quote,
                     Geary.RFC822.TextFormat.HTML);
-                this.pending_attachments = referred.attachments;
                 if (quote != null)
                     this.top_posting = false;
                 else
@@ -784,9 +782,7 @@ public class ComposerWidget : Gtk.EventBox {
                 this.subject = forward_subject;
                 this.body_html = "\n\n" + Geary.RFC822.Utils.quote_email_for_forward(referred, quote,
                     Geary.RFC822.TextFormat.HTML);
-                foreach(Geary.Attachment attachment in referred.attachments)
-                    add_attachment(attachment.file, true);
-                this.pending_attachments = referred.attachments;
+                add_pending_attachments();
             break;
         }
     }
@@ -1519,7 +1515,7 @@ public class ComposerWidget : Gtk.EventBox {
         } while (!dialog.is_finished(add_attachment));
     }
 
-    private void on_pending_attachments() {
+    private void add_pending_attachments() {
         foreach(Geary.Attachment attachment in this.pending_attachments)
             add_attachment(attachment.file, false);
     }
@@ -2395,3 +2391,7 @@ public class ComposerWidget : Gtk.EventBox {
     
 }
 
+    private void on_pending_attachments() {
+        add_pending_attachments();
+    }
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]