[Xfce4-commits] <postler:master> Use g_content_type_is_a to identify text attachments

Christian Dywan noreply at xfce.org
Sat Nov 27 04:34:02 CET 2010


Updating branch refs/heads/master
         to 75c9e2991c6370adc792a7066aa5346b21599da7 (commit)
       from 90052a060bcd500c430fb35d065315e3a948bee2 (commit)

commit 75c9e2991c6370adc792a7066aa5346b21599da7
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Nov 27 01:09:11 2010 +0100

    Use g_content_type_is_a to identify text attachments

 postler/postler-content.vala |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index e1d67a0..50998e0 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -427,6 +427,10 @@ public class Postler.Content : WebKit.WebView {
         }
     }
 
+    bool mime_type_is_text (string mime_type) {
+        return g_content_type_is_a (mime_type, "text/plain");
+    }
+
     public bool display (string location) {
         last_location = location;
         subject = _("(No subject)");
@@ -576,7 +580,7 @@ public class Postler.Content : WebKit.WebView {
                 boundary = boundary.replace ("\"", " ").strip ();
             else
                 multipart = 0;
-            if (!(mime_type.has_prefix ("text/") || multipart > 0)) {
+            if (!(mime_type_is_text (mime_type) || multipart > 0)) {
                 display_error (_("This message of type \"%s\" can't be displayed.").
                                printf (mime_type));
                 last_location = location;
@@ -721,7 +725,7 @@ public class Postler.Content : WebKit.WebView {
                 /* Ignore empty parts inserted by faulty clients */
                 if (part.body.str.strip () == "")
                     continue;
-                if (part.mime_type.has_prefix ("text/")) {
+                if (mime_type_is_text (part.mime_type)) {
                     message_part = part;
                     break;
                 }



More information about the Xfce4-commits mailing list