[Xfce4-commits] <midori:master> Use view source mode for XML that isn't XHTML

Christian Dywan noreply at xfce.org
Wed Apr 14 04:24:03 CEST 2010


Updating branch refs/heads/master
         to b4a7bb928bf0e8d87de622868edcfe02e90a1e23 (commit)
       from 586469fa7352b9f3d1f990fd71ed80d7783e20d2 (commit)

commit b4a7bb928bf0e8d87de622868edcfe02e90a1e23
Author: Christian Dywan <christian at twotoasts.de>
Date:   Tue Apr 13 23:19:16 2010 +0200

    Use view source mode for XML that isn't XHTML

 midori/midori-view.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/midori/midori-view.c b/midori/midori-view.c
index c4ca731..2bffc89 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;
     }
 



More information about the Xfce4-commits mailing list