[bijiben] Do not follow url



commit 8d7b07b4c247b26288423020c72c9a24a0784cc0
Author: Pierre-Yves Luyten <py luyten fr>
Date:   Sun Jan 19 09:57:24 2014 +0100

    Do not follow url
    
    In case there is a link and a navigation request, do not change the note.

 src/libbiji/editor/biji-webkit-editor.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/libbiji/editor/biji-webkit-editor.c b/src/libbiji/editor/biji-webkit-editor.c
index b47f313..15a679e 100644
--- a/src/libbiji/editor/biji-webkit-editor.c
+++ b/src/libbiji/editor/biji-webkit-editor.c
@@ -304,6 +304,20 @@ on_note_color_changed (BijiNoteObj *note, BijiWebkitEditor *self)
     set_editor_color (GTK_WIDGET (self), &color);
 }
 
+
+gboolean
+on_navigation_request                  (WebKitWebView             *web_view,
+                                        WebKitWebFrame            *frame,
+                                        WebKitNetworkRequest      *request,
+                                        WebKitWebNavigationAction *navigation_action,
+                                        WebKitWebPolicyDecision   *policy_decision,
+                                        gpointer                   user_data)
+{
+  webkit_web_policy_decision_ignore (policy_decision);
+  /* const gchar *       webkit_network_request_get_uri      (WebKitNetworkRequest *request);*/
+  return TRUE;
+}
+
 static void
 biji_webkit_editor_constructed (GObject *obj)
 {
@@ -330,6 +344,12 @@ biji_webkit_editor_constructed (GObject *obj)
 
   webkit_web_view_load_string (view, body, "application/xhtml+xml", NULL, NULL);
 
+
+  /* Do not be a browser */
+  g_signal_connect (view, "navigation-policy-decision-requested",
+                    G_CALLBACK (on_navigation_request), NULL);
+
+
   /* Drag n drop */
   GtkTargetList *targets = webkit_web_view_get_copy_target_list (view);
   gtk_target_list_add_image_targets (targets, 0, TRUE);


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