From: Christian Dywan Date: Tue, 13 Apr 2010 21:19:16 +0000 (+0200) Subject: Use view source mode for XML that isn't XHTML X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4a7bb928bf0e8d87de622868edcfe02e90a1e23;p=midori Use view source mode for XML that isn't XHTML --- 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; }