[Xfce4-commits] <postler:master> Implement support for 'body' in mailto string

Christian Dywan noreply at xfce.org
Sat Jan 15 04:20:03 CET 2011


Updating branch refs/heads/master
         to 2df05f03f5dd880fc522656083d6ce11c453b11f (commit)
       from a37e33af180c1c17be450814d651d2c10718ca39 (commit)

commit 2df05f03f5dd880fc522656083d6ce11c453b11f
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Jan 15 04:18:47 2011 +0100

    Implement support for 'body' in mailto string
    
    Fixes: https://bugs.launchpad.net/postler/+bug/690904

 postler/postler-composer.vala |   14 +++++++++++++-
 postler/postler-reader.vala   |    2 +-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index 58477ce..d26c57c 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -29,6 +29,7 @@ public class Postler.Composer : Gtk.Window {
 
     public string subject { get { return entry_subject.text; } }
     int part = 0;
+    string? body = null;
 
     const string ui_markup = """
         <ui>
@@ -609,7 +610,14 @@ public class Postler.Composer : Gtk.Window {
 
     public bool prepare_reply (string? location=null, bool quote=false) {
         var info = selected_account_for_address (combo_from.get_active_text ());
-        return content.prepare_reply (location, info, entry_to.text, quote, part);
+        if (!content.prepare_reply (location, info, entry_to.text, quote, part))
+            return false;
+        if (body != null)
+            GLib.Idle.add (() => {
+                insert_text (body);
+                return false;
+            });
+        return true;
     }
 
     public bool add_field (string field, string data) {
@@ -640,6 +648,10 @@ public class Postler.Composer : Gtk.Window {
             entry = entry_copy;
         else if (name == "subject")
             entry = entry_subject;
+        else if (name == "body") {
+            body = data;
+            return true;
+        }
         else if (name == "attach") {
             string filename = data.has_prefix ("file:///")
                 ? data.substring (7, -1) : data;
diff --git a/postler/postler-reader.vala b/postler/postler-reader.vala
index 8c67255..4044363 100644
--- a/postler/postler-reader.vala
+++ b/postler/postler-reader.vala
@@ -30,7 +30,7 @@ public class Postler.Reader {
         Intl.textdomain (Config.GETTEXT_PACKAGE);
 
         var context = new GLib.OptionContext (_(
-            "[mailto:][ADDRESS][?subject=SUBJECT]"
+            "[mailto:][ADDRESS][?subject=SUBJECT][&body=BODY]"
           + "[&from=FROM][&to=TO][&cc=COPY][&attach=ATTACHMENT][&part=PART]"));
         context.set_help_enabled (true);
         context.add_main_entries (options, null);



More information about the Xfce4-commits mailing list