]> spindle.queued.net Git - midori/commitdiff
Use view source mode for XML that isn't XHTML
authorChristian Dywan <christian@twotoasts.de>
Tue, 13 Apr 2010 21:19:16 +0000 (23:19 +0200)
committerChristian Dywan <christian@twotoasts.de>
Wed, 14 Apr 2010 01:55:19 +0000 (03:55 +0200)
midori/midori-view.c

index c4ca73145e4c2a4b29d1fe0251ad8e78bde7f9af..2bffc890681e023538547bcc92dbfb3b1061b70a 100644 (file)
@@ -2499,9 +2499,27 @@ webkit_web_view_mime_type_decision_cb (GtkWidget*               web_view,
 
     if (webkit_web_view_can_show_mime_type (WEBKIT_WEB_VIEW (web_view), mime_type))
     {
+        #if WEBKIT_CHECK_VERSION (1, 1, 14)
+        gboolean view_source = FALSE;
+
+        if (strcmp (mime_type, "application/xhtml+xml"))
+        {
+            #if GLIB_CHECK_VERSION (2, 18, 0)
+            content_type = g_content_type_from_mime_type (mime_type);
+            #else
+            content_type = g_strdup (mime_type);
+            #endif
+            if (g_content_type_is_a (content_type, "application/xml"))
+                view_source = TRUE;
+            g_free (content_type);
+        }
+        webkit_web_view_set_view_source_mode (WEBKIT_WEB_VIEW (web_view), view_source);
+        #endif
+
         katze_assign (view->mime_type, g_strdup (mime_type));
         midori_view_update_icon (view, NULL);
         g_object_notify (G_OBJECT (view), "mime-type");
+
         return FALSE;
     }