diff options
author | Tomas Popela <tpopela@redhat.com> | 2014-05-05 22:15:06 +0800 |
---|---|---|
committer | Tomas Popela <tpopela@redhat.com> | 2014-05-05 22:15:06 +0800 |
commit | 5306c9f8b0f3bd173b7864d1ba284ead4e5ffadd (patch) | |
tree | 9310954080f46bbcf0ca6d2a4902aa2a41300f7c /e-util | |
parent | 623517d643d3007aef075d53320df57edfe36909 (diff) | |
download | gsoc2013-evolution-5306c9f8b0f3bd173b7864d1ba284ead4e5ffadd.tar.gz gsoc2013-evolution-5306c9f8b0f3bd173b7864d1ba284ead4e5ffadd.tar.zst gsoc2013-evolution-5306c9f8b0f3bd173b7864d1ba284ead4e5ffadd.zip |
EWebView: Allow navigation in page through HTML anchor elements
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-web-view.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/e-util/e-web-view.c b/e-util/e-web-view.c index 47e31dcfb3..00dd6c0ad7 100644 --- a/e-util/e-web-view.c +++ b/e-util/e-web-view.c @@ -542,12 +542,25 @@ web_view_navigation_policy_decision_requested_cb (EWebView *web_view, { EWebViewClass *class; WebKitWebNavigationReason reason; - const gchar *uri; + const gchar *uri, *frame_uri; reason = webkit_web_navigation_action_get_reason (navigation_action); if (reason != WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) return FALSE; + uri = webkit_network_request_get_uri (request); + frame_uri = webkit_web_frame_get_uri (frame); + + /* Allow navigation through sections in page */ + if (uri && *uri && frame_uri && *frame_uri) { + /* The uri should contain the frame uri and the id of the anchor + * element that is separated from uri by hashtag character */ + if (g_str_has_prefix (uri, frame_uri) && strstr (uri, "#")) { + webkit_web_policy_decision_use (policy_decision); + return TRUE; + } + } + /* XXX WebKitWebView does not provide a class method for * this signal, so we do so we can override the default * behavior from subclasses for special URI types. */ @@ -557,8 +570,6 @@ web_view_navigation_policy_decision_requested_cb (EWebView *web_view, webkit_web_policy_decision_ignore (policy_decision); - uri = webkit_network_request_get_uri (request); - class->link_clicked (web_view, uri); return TRUE; |