[geary/wip/728002-webkit2: 62/105] Minor code cleanup.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/728002-webkit2: 62/105] Minor code cleanup.
- Date: Sun, 1 Jan 2017 23:55:04 +0000 (UTC)
commit 3bf261f70d76c282cb601679eb8fea82028a8c3b
Author: Michael James Gratton <mike vee net>
Date: Tue Oct 11 02:04:13 2016 +1100
Minor code cleanup.
.../conversation-viewer/conversation-message.vala | 31 +++++++++-----------
1 files changed, 14 insertions(+), 17 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-message.vala
b/src/client/conversation-viewer/conversation-message.vala
index 5a07459..97a4448 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -714,13 +714,23 @@ public class ConversationMessage : Gtk.Grid {
Geary.Mime.ContentDisposition? disposition, string? content_id, Geary.Memory.Buffer buffer) {
if (content_type == null) {
debug("Not displaying inline: no Content-Type");
-
return null;
}
-
- if (!is_content_type_supported_inline(content_type)) {
+
+ 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) {
debug("Not displaying %s inline: unsupported Content-Type", content_type.to_string());
-
return null;
}
@@ -746,19 +756,6 @@ public class ConversationMessage : Gtk.Grid {
}
}
- private static bool is_content_type_supported_inline(Geary.Mime.ContentType content_type) {
- foreach (string mime_type in INLINE_MIME_TYPES) {
- try {
- if (content_type.is_mime_type(mime_type))
- return true;
- } catch (Error err) {
- debug("Unable to compare MIME type %s: %s", mime_type, err.message);
- }
- }
-
- return false;
- }
-
/*
* Test whether text looks like a URI that leads somewhere other than href. The text
* will have a scheme prepended if it doesn't already have one, and the short versions
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]