[geary/bug/728002-webkit2: 139/140] Query Webview for supported image types instead of hardcoding them.



commit ac8a532557d56eaab22d4e7c76131048913eb03b
Author: Michael James Gratton <mike vee net>
Date:   Tue Jan 31 23:56:51 2017 +1100

    Query Webview for supported image types instead of hardcoding them.

 .../conversation-viewer/conversation-message.vala  |   26 +------------------
 1 files changed, 2 insertions(+), 24 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-message.vala 
b/src/client/conversation-viewer/conversation-message.vala
index 1209161..f6bb7cd 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -126,17 +126,6 @@ public class ConversationMessage : Gtk.Grid {
 
     }
 
-    private const string[] INLINE_MIME_TYPES = {
-        "image/png",
-        "image/gif",
-        "image/jpeg",
-        "image/pjpeg",
-        "image/bmp",
-        "image/x-icon",
-        "image/x-xbitmap",
-        "image/x-xbm"
-    };
-
     private const int MAX_INLINE_IMAGE_MAJOR_DIM = 1024;
 
     private const string ACTION_COPY_EMAIL = "copy_email";
@@ -686,19 +675,8 @@ public class ConversationMessage : Gtk.Grid {
             return null;
         }
 
-        bool is_supported = false;
-        foreach (string mime_type in INLINE_MIME_TYPES) {
-            try {
-                is_supported = content_type.is_mime_type(mime_type);
-            } catch (Error err) {
-                debug("Unable to compare MIME type %s: %s", mime_type, err.message);
-            }
-            if (is_supported) {
-                break;
-            }
-        }
-
-        if (!is_supported) {
+        if (content_type.media_type != "image" ||
+            !this.web_view.can_show_mime_type(content_type.to_string())) {
             debug("Not displaying %s inline: unsupported Content-Type", content_type.to_string());
             return null;
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]