[Xfce4-commits] <postler:master> Default to the first HTML part if available
Christian Dywan
noreply at xfce.org
Thu Dec 16 21:00:01 CET 2010
Updating branch refs/heads/master
to 9af88bb59d455599196031080f64ea1ec0c9a1cd (commit)
from 9d9ba8af6367af3b7ab3364a29224ad8e49159c9 (commit)
commit 9af88bb59d455599196031080f64ea1ec0c9a1cd
Author: Christian Dywan <christian at twotoasts.de>
Date: Thu Dec 16 19:26:58 2010 +0100
Default to the first HTML part if available
Fixes: https://bugs.launchpad.net/postler/+bug/690899
postler/postler-content.vala | 16 +++++++++++-----
postler/postler-viewer.vala | 6 ------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index 00da4f7..50e443a 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -852,18 +852,24 @@ public class Postler.Content : WebKit.WebView {
try {
parse_message (location);
- MessagePart message_part = null;
+ /* Look for an HTML part, or otherwise plain text */
+ MessagePart? html_part = null;
+ MessagePart? text_part = null;
foreach (var part in message_parts) {
/* Ignore empty parts inserted by faulty clients */
if (part.body.str.strip () == "")
continue;
- if (mime_type_is_text (part.mime_type)) {
- message_part = part;
+ if (part.mime_type == "text/html") {
+ html_part = part;
break;
}
+ if (part.mime_type == "text/plain" && text_part == null)
+ text_part = part;
}
- if (message_part != null)
- display_part (message_part);
+ if (html_part != null)
+ display_part (html_part);
+ else if (text_part != null)
+ display_part (text_part);
else
display_error (_("No text in the message that can be displayed"));
} catch (GLib.Error error) {
diff --git a/postler/postler-viewer.vala b/postler/postler-viewer.vala
index 618c598..68b85a5 100644
--- a/postler/postler-viewer.vala
+++ b/postler/postler-viewer.vala
@@ -110,12 +110,6 @@ public class Postler.Viewer : Gtk.VBox {
child.destroy ();
uint index = 0;
foreach (var part in content.message_parts) {
- /* Don't display the toplevel multipart part */
- if (index == 0 && part.mime_type.has_prefix ("multipart/")) {
- index++;
- continue;
- }
-
string icon_name = icon_name_for_mime_type (part.mime_type, this);
var icon = new Gtk.Image.from_icon_name (icon_name,
Gtk.IconSize.BUTTON);
More information about the Xfce4-commits
mailing list