[Xfce4-commits] <postler:master> Render messages sent by the user as outgoing

Christian Dywan noreply at xfce.org
Thu Jun 30 00:34:02 CEST 2011


Updating branch refs/heads/master
         to 98fd9073b789962b67334782b0320fba5c95f75d (commit)
       from e30e71add20ec01d25df9749ae64f23db8dc0664 (commit)

commit 98fd9073b789962b67334782b0320fba5c95f75d
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Jun 29 22:11:52 2011 +0200

    Render messages sent by the user as outgoing

 postler/postler-content.vala |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index e511e7d..1b96360 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -653,17 +653,24 @@ public class Postler.Content : WebKit.WebView {
             if (template_path == null)
                 template_path = template_dir.printf (
                     Environment.get_user_data_dir (), theme_name);
-            string content_template, status_template, content_stylesheet;
+            string content_template, outgoing_template, status_template, content_stylesheet;
             try {
                 FileUtils.get_contents (template_path + "Incoming/Content.html",
                                         out content_template, null);
+                try {
+                    FileUtils.get_contents (template_path + "Outgoing/Content.html",
+                                            out outgoing_template, null);
+                }
+                catch (GLib.Error outgoing_error) {
+                    outgoing_template = content_template;
+                }
                 FileUtils.get_contents (template_path + "Status.html",
                                         out status_template, null);
                 FileUtils.get_contents (template_path + "main.css",
                                         out content_stylesheet, null);
             }
             catch (GLib.Error template_error) {
-                content_template = """
+                content_template = outgoing_template = """
                     <div class="reply">
                     <div class="sender">%sender%<div class="time">%time{%X}%</div></div>
                     %message%
@@ -714,7 +721,10 @@ public class Postler.Content : WebKit.WebView {
                     child.sender, child.subject, _("Forward")));
 
                 string reply_markup;
-                reply_markup = content_template.replace ("%message%", reply_chunk.str);
+                if (Contact.name_from_string (child.sender) == _("You"))
+                    reply_markup = outgoing_template.replace ("%message%", reply_chunk.str);
+                else
+                    reply_markup = content_template.replace ("%message%", reply_chunk.str);
                 reply_markup = reply_markup.replace ("\"%sender%\"", ("\"" + child.sender + "\""));
                 reply_markup = reply_markup.replace ("%sender%", linkify_address (child.sender, null));
                 reply_markup = reply_markup.replace ("%time{%X}%", format_date (child.date));



More information about the Xfce4-commits mailing list