[Xfce4-commits] <postler:master> Show View as plain text/ HTML in extra headers
Christian Dywan
noreply at xfce.org
Thu Mar 31 23:10:01 CEST 2011
Updating branch refs/heads/master
to 5c6fb5beaf65aecc36e0bc3b5c034132332aaea9 (commit)
from a9cbcdd3679ae88ef3fed13bf540f0848f7656a8 (commit)
commit 5c6fb5beaf65aecc36e0bc3b5c034132332aaea9
Author: Christian Dywan <christian at twotoasts.de>
Date: Thu Mar 31 23:07:01 2011 +0200
Show View as plain text/ HTML in extra headers
postler/postler-content.vala | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index 9411719..01d0e52 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -1044,10 +1044,16 @@ public class Postler.Content : WebKit.WebView {
}
string body_chunk;
- if (message_part == html_part)
+ string? html_or_text = "";
+ if (message_part == html_part) {
body_chunk = message_part.body.str;
+ if (text_part != null)
+ html_or_text = "<a href=\"#text\">" + _("View as plain text") + "</a>";
+ }
else if (message_part == text_part) {
body_chunk = render_plain_text (message_part.body.str);
+ if (html_part != null)
+ html_or_text = "<a href=\"#html\">" + _("View as HTML") + "</a>";
}
else {
body_chunk = """
@@ -1106,6 +1112,7 @@ public class Postler.Content : WebKit.WebView {
%s
%s
%s
+ %s
</span>
</span>
<p class="body" style="%s">%s</p>
@@ -1118,6 +1125,7 @@ public class Postler.Content : WebKit.WebView {
format_header (_("Blind Copy:"), blind_copy),
reply != "" || organization != "" || x_mailer != ""
|| list_unsubscribe != ""
+ || html_or_text != ""
? "%s »".printf (_("More")) : "",
_("Subject:"), subject,
/* TODO: Sender:? */
@@ -1125,6 +1133,7 @@ public class Postler.Content : WebKit.WebView {
format_header (_("Organization:"), organization),
format_header (_("Application:"), x_mailer),
format_header (_("Unsubscribe:"), list_unsubscribe),
+ html_or_text,
message_part.plain_text ? "font-family: Monospace;" : "",
body_chunk),
"text/html", "UTF-8", "about:blank");
@@ -1167,6 +1176,16 @@ public class Postler.Content : WebKit.WebView {
settings.set ("enable-scripts", false);
return true;
}
+ else if (uri.has_suffix ("#html")) {
+ decision.ignore ();
+ display_part (html_part);
+ return true;
+ }
+ else if (uri.has_suffix ("#text")) {
+ decision.ignore ();
+ display_part (text_part);
+ return true;
+ }
if (uri != null && uri.has_prefix ("about:"))
return false;
More information about the Xfce4-commits
mailing list