[Xfce4-commits] <midori:master> Guess MIME type (content type) if not known

Christian Dywan noreply at xfce.org
Sun May 20 18:18:02 CEST 2012


Updating branch refs/heads/master
         to 9fe40ad8508b93341ce8546342ae3bd7f1e60ca6 (commit)
       from 2c89501bf4d39f5f9a016b632f0043bbed0fe0f4 (commit)

commit 9fe40ad8508b93341ce8546342ae3bd7f1e60ca6
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun May 20 18:12:15 2012 +0200

    Guess MIME type (content type) if not known

 midori/midori-view.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/midori/midori-view.c b/midori/midori-view.c
index 9561be7..882da8d 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -2947,11 +2947,10 @@ webkit_web_view_download_requested_cb (GtkWidget*      web_view,
     mime_type = g_object_get_data(G_OBJECT (view), "download-mime-type");
     content_type = g_content_type_from_mime_type (mime_type);
     if (!content_type)
-    #ifdef G_OS_WIN32
-        content_type = g_content_type_get_mime_type ("*");
-    #else
-        content_type = g_strdup ("application/octet-stream");
-    #endif
+        content_type = g_content_type_guess (
+            webkit_download_get_suggested_filename (download), NULL, 0, NULL);
+    if (!content_type)
+        content_type = g_content_type_from_mime_type ("application/octet-stream");
     description = g_content_type_get_description (content_type);
     #if GTK_CHECK_VERSION (2, 14, 0)
     icon = g_content_type_get_icon (content_type);


More information about the Xfce4-commits mailing list