[Xfce4-commits] <postler:master> No quote, no signature but an infobar for launchpad

Christian Dywan noreply at xfce.org
Mon Apr 11 23:48:03 CEST 2011


Updating branch refs/heads/master
         to eef2b635960b658c551a2a13571fbd72ac12f1b2 (commit)
       from c7831afefa1990919185289b00bd902bde59ebf1 (commit)

commit eef2b635960b658c551a2a13571fbd72ac12f1b2
Author: Christian Dywan <christian at twotoasts.de>
Date:   Mon Apr 11 23:28:08 2011 +0200

    No quote, no signature but an infobar for launchpad
    
    It's convenient to reply to bug notifications directly but
    only without quoting and signature which don't make sense in
    comments.
    
    An infobar is shown to make it more obvious that the reply is
    to a public bug tracker, as opposed to private mail.

 postler/postler-composer.vala |   13 ++++++++++++-
 postler/postler-content.vala  |   16 +++++++++-------
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index ecc7835..db3a9a7 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -737,7 +737,18 @@ 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 ());
-        content.prepare_reply (location, info, entry_to.text, quote, part, body);
+        bool is_bug_tracker = entry_to.text.has_suffix ("@bugs.launchpad.net>");
+        if (is_bug_tracker) {
+            var infobar = new Gtk.InfoBar ();
+            infobar.set_message_type (Gtk.MessageType.INFO);
+            var content_area = (infobar.get_content_area ()) as Gtk.Box;
+            content_area.pack_start (new Gtk.Label (_("This is a reply to a public bug tracker")));
+            shelf.pack_start (infobar, false, false, 0);
+            shelf.reorder_child (infobar, 7);
+            infobar.show_all ();
+        }
+        content.prepare_reply (location, info, entry_to.text,
+                               quote, part, body, is_bug_tracker);
         return true;
     }
 
diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index beba272..35f14e0 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -446,11 +446,11 @@ public class Postler.Content : WebKit.WebView {
     }
 
     public void prepare_reply (string? location, AccountInfo account_info,
-        string recipient, bool quote, int part, string? excerpt) {
+        string recipient, bool quote, int part, string? excerpt, bool is_bug_tracker) {
 
         var body = new StringBuilder ();
 
-        if (location != null) {
+        if (location != null && !is_bug_tracker) {
             ulong now = new Soup.Date.from_now (0).to_time_t ();
             string date = GLib.Time.local ((time_t)now).format ("%x %X");
             string sender = Postler.Messages.parse_address (recipient)[0];
@@ -548,11 +548,13 @@ public class Postler.Content : WebKit.WebView {
             position--;
         } while (position > 0 && position < body.len);
 
-        unowned string? signature = account_info.signature;
-        if (signature != null && top_post)
-            body.prepend ("\n\n" + signature + "\n");
-        else if (signature != null)
-            body.append ("\n\n" + signature);
+        if (!is_bug_tracker) {
+            unowned string? signature = account_info.signature;
+            if (signature != null && top_post)
+                body.prepend ("\n\n" + signature + "\n");
+            else if (signature != null)
+                body.append ("\n\n" + signature);
+        }
         load_string (body.str, "text/plain", "UTF-8", "about:blank");
     }
 



More information about the Xfce4-commits mailing list