[devhelp] Update to match navigation-request behaviour of latest WebKit
- From: Frederic Peters <fpeters src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [devhelp] Update to match navigation-request behaviour of latest WebKit
- Date: Thu, 27 Aug 2009 14:55:18 +0000 (UTC)
commit 7659c8e1a95eab40e6000529f6a53e72e839e4cc
Author: Frédéric Péters <fpeters 0d be>
Date: Thu Aug 27 16:54:45 2009 +0200
Update to match navigation-request behaviour of latest WebKit
configure.ac | 4 ++--
src/dh-assistant-view.c | 29 ++++++++++-------------------
2 files changed, 12 insertions(+), 21 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6525579..9137983 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,7 +52,7 @@ AC_SUBST(REQUIRES_LIBWNCK)
PKG_CHECK_MODULES(DEVHELP, [
gtk+-2.0 >= 2.10.0
- webkit-1.0
+ webkit-1.0 >= 1.1.13
])
PKG_CHECK_MODULES(LIBDEVHELP, [
@@ -61,7 +61,7 @@ PKG_CHECK_MODULES(LIBDEVHELP, [
$gconf_pkgconfig
$libwnck_pkgconfig
$igemacintegration_pkgconfig
- webkit-1.0
+ webkit-1.0 >= 1.1.13
])
AC_ARG_WITH(zlib, [ --with-zlib=DIR use zlib in DIR], zlibdir=$with_zlib)
diff --git a/src/dh-assistant-view.c b/src/dh-assistant-view.c
index 5487788..548e6bb 100644
--- a/src/dh-assistant-view.c
+++ b/src/dh-assistant-view.c
@@ -29,9 +29,10 @@
#include "dh-window.h"
typedef struct {
- DhBase *base;
- DhLink *link;
- gchar *current_search;
+ DhBase *base;
+ DhLink *link;
+ gchar *current_search;
+ gboolean snippet_loaded;
} DhAssistantViewPriv;
G_DEFINE_TYPE (DhAssistantView, dh_assistant_view, WEBKIT_TYPE_WEB_VIEW);
@@ -71,6 +72,10 @@ assistant_navigation_requested (WebKitWebView *web_view,
if (strcmp (uri, "about:blank") == 0) {
return WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
}
+ else if (! priv->snippet_loaded) {
+ priv->snippet_loaded = TRUE;
+ return WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
+ }
else if (g_str_has_prefix (uri, "file://")) {
GtkWidget *window;
@@ -253,8 +258,6 @@ assistant_view_set_link (DhAssistantView *view,
gchar *stylesheet;
gchar *javascript;
gchar *html;
- gchar *tmp;
- gchar *base;
buf = g_strndup (start, end-start);
@@ -321,27 +324,15 @@ assistant_view_set_link (DhAssistantView *view,
g_free (stylesheet);
g_free (javascript);
- /* We need to set a local base to be able to access the
- * stylesheet and javascript, but we also have to set
- * something that is not the same as the current page,
- * otherwise link clicks won't go through the network
- * request handler (which we need so we can forward then to
- * a main devhelp window. The reason is that page-local
- * anchor links are handled internally in webkit.
- */
- tmp = g_path_get_dirname (filename);
- base = g_strconcat (tmp, "/fake", NULL);
- g_free (tmp);
-
+ priv->snippet_loaded = FALSE;
webkit_web_view_load_string (
WEBKIT_WEB_VIEW (view),
"text/html",
html,
NULL,
- base);
+ filename);
g_free (html);
- g_free (base);
} else {
webkit_web_view_open (WEBKIT_WEB_VIEW (view), "about:blank");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]