From b4a7bb928bf0e8d87de622868edcfe02e90a1e23 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Tue, 13 Apr 2010 23:19:16 +0200 Subject: [PATCH] Use view source mode for XML that isn't XHTML --- midori/midori-view.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/midori/midori-view.c b/midori/midori-view.c index c4ca7314..2bffc890 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -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; }