[evince] Improve mime type detection on win32
- From: Jan-Joost Spanjers <jspanjers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] Improve mime type detection on win32
- Date: Thu, 17 Nov 2011 19:04:19 +0000 (UTC)
commit 7802664fef53b83c32548e2f477083cc47ee06cc
Author: Hib Eris <hib hiberis nl>
Date: Mon Nov 7 14:05:07 2011 +0100
Improve mime type detection on win32
libdocument/ev-file-helpers.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/libdocument/ev-file-helpers.c b/libdocument/ev-file-helpers.c
index cab0ad5..5662e9e 100644
--- a/libdocument/ev-file-helpers.c
+++ b/libdocument/ev-file-helpers.c
@@ -455,7 +455,6 @@ get_mime_type_from_uri (const gchar *uri, GError **error)
static gchar *
get_mime_type_from_data (const gchar *uri, GError **error)
{
-#ifndef G_OS_WIN32
GFile *file;
GFileInputStream *input_stream;
gssize size_read;
@@ -492,16 +491,19 @@ get_mime_type_from_data (const gchar *uri, GError **error)
if (!content_type)
return NULL;
+#ifdef G_OS_WIN32
+ /* On Windows, the implementation of g_content_type_guess() is
+ * sometimes too limited, so we do use get_mime_type_from_uri()
+ * as a fallback */
+ if (strcmp (content_type, "*") == 0) {
+ g_free (content_type);
+ return get_mime_type_from_uri (uri, error);
+ }
+#endif /* G_OS_WIN32 */
+
mime_type = g_content_type_get_mime_type (content_type);
g_free (content_type);
return mime_type;
-#else
- /*
- * On Windows, the implementation of g_content_type_guess() is too limited at the moment, so we do not
- * use it and fall back to get_mime_type_from_uri()
- */
- return get_mime_type_from_uri (uri, error);
-#endif /* G_OS_WIN32 */
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]