[Xfce4-commits] <postler:master> Select 'from' address from arguments if possible

Christian Dywan noreply at xfce.org
Mon Jun 21 20:12:05 CEST 2010


Updating branch refs/heads/master
         to e5946737192a7fb4aafe16921f4b3f83a18c1f95 (commit)
       from 130cba583489c1ac2ffccc91556488e1f9848cee (commit)

commit e5946737192a7fb4aafe16921f4b3f83a18c1f95
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Jun 19 21:46:42 2010 +0200

    Select 'from' address from arguments if possible

 postler/postler-composer.vala |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index df337c3..cb434d0 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -246,10 +246,25 @@ public class Postler.Composer : Gtk.Window {
     }
 
     public bool add_field (string field, string data) {
+        if (data == "")
+            return false;
+
         string name = field.down ();
         Gtk.Entry entry = null;
         if (name == "from") {
-            /* TODO: Check if there's an according account and select it */
+            var model = combo_from.model;
+            Gtk.TreeIter iter;
+            string from = Postler.Messages.parse_address (data)[1];
+            if (model.iter_children (out iter, null)) {
+                do {
+                    string address;
+                    model.get (iter, 0, out address, -1);
+                    if (from in address) {
+                        combo_from.set_active_iter (iter);
+                        break;
+                    }
+                } while (model.iter_next (ref iter));
+            }
             return true;
         }
         else if (name == "to")



More information about the Xfce4-commits mailing list