[Xfce4-commits] <postler:master> Don't show primary HTML and text parts as icons

Christian Dywan noreply at xfce.org
Thu Feb 3 00:34:07 CET 2011


Updating branch refs/heads/master
         to f945633a80e314a5681364dfd22bbb70fbac7928 (commit)
       from 5c7df0b9ac7626ea80f3467f47c098689755493e (commit)

commit f945633a80e314a5681364dfd22bbb70fbac7928
Author: Christian Dywan <christian at twotoasts.de>
Date:   Tue Feb 1 23:30:03 2011 +0100

    Don't show primary HTML and text parts as icons

 postler/postler-content.vala |   17 ++++++++---------
 postler/postler-viewer.vala  |    2 ++
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index c3275c4..0763de3 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -99,6 +99,8 @@ public class Postler.Content : WebKit.WebView {
 
     public unowned List<MessagePart> message_parts { public get; set; }
     public MessagePart? current_part { get; private set; }
+    public MessagePart? html_part { get; private set; }
+    public MessagePart? text_part { get; private set; }
 
     const string style_sheet = """
         .headers {
@@ -959,8 +961,8 @@ public class Postler.Content : WebKit.WebView {
             parse_message (location);
 
             /* Look for an HTML part, or otherwise plain text */
-            MessagePart? html_part = null;
-            MessagePart? text_part = null;
+            html_part = null;
+            text_part = null;
             foreach (var part in message_parts) {
                 /* Ignore empty parts inserted by faulty clients */
                 if (part.body.str.strip () == "")
@@ -1005,15 +1007,12 @@ public class Postler.Content : WebKit.WebView {
             current_part = message_part;
 
         string body_chunk;
-        string mime_type = message_part.mime_type;
-        if (mime_type == "text/html")
+        if (message_part == html_part)
             body_chunk = message_part.body.str;
-        else if (message_part.plain_text) {
-            mime_type = "text/html";
+        else if (message_part == text_part) {
             body_chunk = "<span class=\"plain_text\">" + message_part.body.str + "</span>";
         }
         else {
-            mime_type = "text/html";
             body_chunk = """
                 <b>%s</b>
                 <a href="message-part:open:%d">%s</a>
@@ -1090,10 +1089,10 @@ public class Postler.Content : WebKit.WebView {
                         format_header (_("Unsubscribe:"), list_unsubscribe),
                         message_part.plain_text ? "font-family: Monospace;" : "",
                         body_chunk),
-                mime_type, "UTF-8", "about:blank");
+                "text/html", "UTF-8", "about:blank");
         } catch (GLib.Error contents_error) {
             display_error (_("Failed to display message part \"%s\": %s").printf (
-                mime_type, contents_error.message));
+                message_part.mime_type, contents_error.message));
         }
     }
 
diff --git a/postler/postler-viewer.vala b/postler/postler-viewer.vala
index 3a3abc2..3d3a7de 100644
--- a/postler/postler-viewer.vala
+++ b/postler/postler-viewer.vala
@@ -90,6 +90,8 @@ public class Postler.Viewer : Gtk.VBox {
         foreach (var part in content.message_parts) {
             if (part.mime_type.has_prefix ("multipart/"))
                 continue;
+            if (part == content.html_part || part == content.text_part)
+                continue;
 
             attachments.add_part (part);
             if (part == content.current_part)



More information about the Xfce4-commits mailing list