[Xfce4-commits] <postler:master> Choose the sender address from a combo when composing

Christian Dywan noreply at xfce.org
Sun Jun 13 23:04:02 CEST 2010


Updating branch refs/heads/master
         to 1f9cfd13942ca2b0aeab510657ae902c7071cddf (commit)
       from 1131d9cc9b0f847507ef72ba8616358a98a3a7f1 (commit)

commit 1f9cfd13942ca2b0aeab510657ae902c7071cddf
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Jun 12 23:29:11 2010 +0200

    Choose the sender address from a combo when composing

 postler/postler-composer.vala |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index d225c0e..80ff2af 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -12,6 +12,8 @@
 const string GETTEXT_PACKAGE_COMPOSER = Config.GETTEXT_PACKAGE;
 
 public class Postler.Composer : Gtk.Window {
+    Accounts accounts = new Accounts ();
+
     Gtk.UIManager ui;
     Gtk.ActionGroup actions;
 
@@ -19,7 +21,7 @@ public class Postler.Composer : Gtk.Window {
     Gtk.Toolbar toolbar;
     Postler.Content content;
 
-    Gtk.Entry entry_from;
+    Gtk.ComboBox combo_from;
     Gtk.Entry entry_to;
     Gtk.Entry entry_copy;
     Gtk.Entry entry_subject;
@@ -135,8 +137,8 @@ public class Postler.Composer : Gtk.Window {
         var label = new Gtk.Label.with_mnemonic (_("_From:"));
         box.pack_start (label, false, false, 4);
         sizegroup.add_widget (label);
-        entry_from = new Gtk.Entry ();
-        box.pack_start (entry_from, true, true, 4);
+        combo_from = new Gtk.ComboBox.text ();
+        box.pack_start (combo_from, true, true, 4);
         box = new Gtk.HBox (false, 0);
         shelf.pack_start (box, false, false, 4);
         label = new Gtk.Label.with_mnemonic (_("_To:"));
@@ -169,7 +171,17 @@ public class Postler.Composer : Gtk.Window {
             actions.get_action ("MessageSend").sensitive = state;
         });
 
-        entry_from.grab_focus ();
+        unowned GLib.List<AccountInfo> infos = accounts.get_infos ();
+        /* foreach (unowned AccountInfo account_info in infos) { */
+        for (unowned GLib.List<AccountInfo> info_iter = infos;
+            info_iter != null; info_iter = info_iter.next) {
+            AccountInfo account_info = info_iter.data;
+
+            if (account_info.address != null)
+                combo_from.append_text (account_info.address);
+        }
+        combo_from.set_active (0);
+        combo_from.grab_focus ();
 
         content.editable = true;
         var settings = content.settings;
@@ -193,8 +205,10 @@ public class Postler.Composer : Gtk.Window {
     public bool add_field (string field, string data) {
         string name = field.down ();
         Gtk.Entry entry = null;
-        if (name == "from")
-            entry = entry_from;
+        if (name == "from") {
+            /* TODO: Check if there's an according account and select it */
+            return true;
+        }
         else if (name == "to")
             entry = entry_to;
         else if (name == "cc")



More information about the Xfce4-commits mailing list