[Xfce4-commits] <postler:master> Append attachments to each message as follow ups

Christian Dywan noreply at xfce.org
Thu Jun 30 04:38:01 CEST 2011


Updating branch refs/heads/master
         to 53dfcf42b867f5bc9d17d4cc7ba4adcd95cafc13 (commit)
       from 3633919cfd1e2767b19c3f7c4ef6a36f326065d3 (commit)

commit 53dfcf42b867f5bc9d17d4cc7ba4adcd95cafc13
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Jun 30 02:29:11 2011 +0200

    Append attachments to each message as follow ups

 postler/postler-content.vala |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index 49b36c1..5969c1c 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -661,10 +661,16 @@ public class Postler.Content : WebKit.WebView {
                 template_path = template_dir.printf (
                     Environment.get_user_data_dir (), theme_name);
             string content_template, outgoing_template, status_template, content_stylesheet;
+            string? next_content_template = null;
             try {
                 FileUtils.get_contents (template_path + "Incoming/Content.html",
                                         out content_template, null);
                 try {
+                    FileUtils.get_contents (template_path + "Incoming/NextContent.html",
+                                            out next_content_template, null);
+                }
+                catch (GLib.Error next_content_error) { }
+                try {
                     FileUtils.get_contents (template_path + "Outgoing/Content.html",
                                             out outgoing_template, null);
                 }
@@ -756,16 +762,25 @@ public class Postler.Content : WebKit.WebView {
                     reply_markup = reply_markup.replace ("importantMessage",
                         "outgoingItem importantMessage");
                 }
-                body_chunk.append (reply_markup);
 
                 foreach (var attachment_part in child.parts) {
                     if (attachment_part != html_part && attachment_part != text_part
                      && !attachment_part.mime_type.has_prefix ("multipart/")) {
                         message_parts.append (attachment_part);
-                        reply_markup = status_template.replace ("%time%", "");
                         /* The extra class attachmentMessage is Postler-specific */
-                        reply_markup = reply_markup.replace ("statusMessage",
-                            "statusMessage attachmentMessage");
+                        if (next_content_template != null) {
+                            reply_markup = reply_markup.replace (
+                                "<span id=\"insert\"></span>", next_content_template);
+                            reply_markup = reply_markup.replace ("followUp",
+                                "followUp attachmentMessage");
+                            reply_markup = reply_markup.replace ("%sender%", "");
+                            reply_markup = reply_markup.replace ("%time{%X}%", "");
+                        }
+                        else {
+                            reply_markup += status_template.replace ("statusMessage",
+                                "statusMessage attachmentMessage");
+                            reply_markup = reply_markup.replace ("%time%", "");
+                        }
                         reply_markup = reply_markup.replace ("%message%",
                             """
                             <b>%s</b><div class="actions">
@@ -775,9 +790,10 @@ public class Postler.Content : WebKit.WebView {
                             attachment_part.filename ?? attachment_part.mime_type,
                             child.parts.position (child.parts.find (attachment_part)), _("Save"),
                             child.parts.position (child.parts.find (attachment_part)), _("Open")));
-                        body_chunk.append (reply_markup);
                     }
                 }
+
+                body_chunk.append (reply_markup);
             }
 
             /* Don't change the message if it's the same to avoid notifications */



More information about the Xfce4-commits mailing list