[devhelp] Open external links with gtk_show_uri()



commit b1c9ac188f484cfdaca8974dcff04806896aa380
Author: Frédéric Péters <fpeters 0d be>
Date:   Thu Aug 27 22:36:07 2009 +0200

    Open external links with gtk_show_uri()
    
    This means links to external websites will be opened in the default
    browser instead of the devhelp window.

 src/dh-window.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/dh-window.c b/src/dh-window.c
index 76a2734..73044af 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -790,9 +790,20 @@ window_web_view_navigation_requested_cb (WebKitWebView        *web_view,
                                          DhWindow             *window)
 {
         DhWindowPriv *priv;
+        const char   *uri;
 
         priv = window->priv;
 
+        uri = webkit_network_request_get_uri (request);
+        if (strcmp (uri, "about:blank") == 0) {
+                return WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
+        }
+
+        if (strncmp (uri, "file://", 7) != 0) {
+                gtk_show_uri (NULL, uri, GDK_CURRENT_TIME, NULL);
+                return WEBKIT_NAVIGATION_RESPONSE_IGNORE;
+        }
+
         if (web_view == window_get_active_web_view (window)) {
                 const gchar *uri;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]