[geary] Fix alternate email weirdness in composer from combobox. Bug 770356.



commit 6a38d420aad86a6defeb012651c621a7099c52cd
Author: Michael James Gratton <mike vee net>
Date:   Wed Sep 21 16:06:04 2016 +1000

    Fix alternate email weirdness in composer from combobox. Bug 770356.
    
    * src/client/composer/composer-widget.vala
      (ComposerWidget::add_account_emails_to_from_list): Don't use
      this.account, rename param to make it obvious that is the case.
      (ComposerWidget::update_from_field): Only update from addresses for new
      messages, use this.account to make that obvious.

 src/client/composer/composer-widget.vala |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 270e431..279deaa 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -2200,27 +2200,27 @@ public class ComposerWidget : Gtk.EventBox {
         }
     }
 
-    private bool add_account_emails_to_from_list(Geary.Account account, bool set_active = false) {
+    private bool add_account_emails_to_from_list(Geary.Account other_account, bool set_active = false) {
         Geary.RFC822.MailboxAddresses primary_address = new Geary.RFC822.MailboxAddresses.single(
-            account.information.primary_mailbox);
+            other_account.information.primary_mailbox);
         this.from_multiple.append_text(primary_address.to_rfc822_string());
-        this.from_list.add(new FromAddressMap(account, primary_address));
+        this.from_list.add(new FromAddressMap(other_account, primary_address));
         if (!set_active && from.equal_to(primary_address)) {
             this.from_multiple.set_active(this.from_list.size - 1);
             set_active = true;
         }
 
-        if (this.account.information.alternate_mailboxes != null) {
-            foreach (Geary.RFC822.MailboxAddress alternate_mailbox in 
this.account.information.alternate_mailboxes) {
+        if (other_account.information.alternate_mailboxes != null) {
+            foreach (Geary.RFC822.MailboxAddress alternate_mailbox in 
other_account.information.alternate_mailboxes) {
                 Geary.RFC822.MailboxAddresses addresses = new Geary.RFC822.MailboxAddresses.single(
                     alternate_mailbox);
                 
                 // Displayed in the From dropdown to indicate an "alternate email address"
                 // for an account.  The first printf argument will be the alternate email
                 // address, and the second will be the account's primary email address.
-                string display = _("%1$s via %2$s").printf(addresses.to_rfc822_string(), 
this.account.information.display_name);
+                string display = _("%1$s via %2$s").printf(addresses.to_rfc822_string(), 
other_account.information.display_name);
                 this.from_multiple.append_text(display);
-                this.from_list.add(new FromAddressMap(account, addresses));
+                this.from_list.add(new FromAddressMap(other_account, addresses));
                 
                 if (!set_active && this.from.equal_to(addresses)) {
                     this.from_multiple.set_active(this.from_list.size - 1);
@@ -2264,12 +2264,13 @@ public class ComposerWidget : Gtk.EventBox {
         this.from_multiple.remove_all();
         this.from_list = new Gee.ArrayList<FromAddressMap>();
 
-        bool set_active = add_account_emails_to_from_list(account);
+        bool set_active = false;
         if (this.compose_type == ComposeType.NEW_MESSAGE) {
+            set_active = add_account_emails_to_from_list(this.account);
             foreach (Geary.AccountInformation info in accounts.values) {
                 try {
                     Geary.Account a = Geary.Engine.instance.get_account_instance(info);
-                    if (a != account)
+                    if (a != this.account)
                         set_active = add_account_emails_to_from_list(a, set_active);
                 } catch (Error e) {
                     debug("Error getting account in composer: %s", e.message);


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