2008-01-03 Xan Lopez <xan@gnome.org>
authoralp@webkit.org <alp@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Jan 2008 06:34:56 +0000 (06:34 +0000)
committeralp@webkit.org <alp@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Jan 2008 06:34:56 +0000 (06:34 +0000)
        Reviewed by Alp Toker.

        http://bugs.webkit.org/show_bug.cgi?id=16654
        [GTK] Signal "navigation-requested" does not react correctly on
        return TRUE from callbacks

        * WebView/webkitwebview.cpp: use our own accumulator for signals
        returning WebKitNavigationResponse. The emission will be stopped
        when any callback returns anything but
        WEBKIT_NAVIGATION_RESPONSE_ACCEPT.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29147 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/gtk/ChangeLog
WebKit/gtk/WebView/webkitwebview.cpp

index e0ada22..39e315a 100644 (file)
@@ -1,3 +1,16 @@
+2008-01-03  Xan Lopez  <xan@gnome.org>
+
+        Reviewed by Alp Toker.
+
+        http://bugs.webkit.org/show_bug.cgi?id=16654
+        [GTK] Signal "navigation-requested" does not react correctly on
+        return TRUE from callbacks
+        
+        * WebView/webkitwebview.cpp: use our own accumulator for signals
+        returning WebKitNavigationResponse. The emission will be stopped
+        when any callback returns anything but
+        WEBKIT_NAVIGATION_RESPONSE_ACCEPT.
+
 2008-01-02  Holger Hans Peter Freyther  <zecke@selfish.org>
 
         Rubber stamped by Darin.
index f5ee325..6e6e580 100644 (file)
@@ -549,6 +549,18 @@ static void webkit_web_view_finalize(GObject* object)
     G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object);
 }
 
+static gboolean webkit_navigation_request_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy)
+{
+  gboolean continueEmission = TRUE;
+  int signalHandled = g_value_get_int(handlerReturn);
+  g_value_set_int(returnAccu, signalHandled);
+
+  if (signalHandled != WEBKIT_NAVIGATION_RESPONSE_ACCEPT)
+      continueEmission = FALSE;
+
+  return continueEmission;
+}
+
 static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
 {
     GtkBindingSet* binding_set;
@@ -565,7 +577,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
             G_TYPE_FROM_CLASS(webViewClass),
             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
             G_STRUCT_OFFSET (WebKitWebViewClass, navigation_requested),
-            NULL,
+            webkit_navigation_request_handled,
             NULL,
             webkit_marshal_INT__OBJECT_OBJECT,
             G_TYPE_INT, 2,