]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/webview_webkit.cpp
Overhaul wxWebHandler naming to try and make it consistent with the rest of wxWidgets...
[wxWidgets.git] / src / gtk / webview_webkit.cpp
index 36b3eace967f62556ddf3711a55b38df38d3a08b..c1493d21e6b1c51cc0490f8f07c1d438c23240a4 100644 (file)
@@ -65,7 +65,7 @@ static gboolean
 wxgtk_webview_webkit_navigation(WebKitWebView*,
                                 WebKitWebFrame *frame,
                                 WebKitNetworkRequest *request,
-                                WebKitWebNavigationAction*,
+                                WebKitWebNavigationAction *,
                                 WebKitWebPolicyDecision *policy_decision,
                                 wxWebViewWebKit *webKitCtrl)
 {
@@ -258,17 +258,29 @@ wxgtk_webview_webkit_new_window(WebKitWebView*,
     if (webKitCtrl && webKitCtrl->GetEventHandler())
         webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent);
 
-    if (thisEvent.IsVetoed())
-    {
-        webkit_web_policy_decision_ignore(policy_decision);
-    }
-    else
-    {
-        webkit_web_policy_decision_use(policy_decision);
-    }
+    //We always want the user to handle this themselves
+    webkit_web_policy_decision_ignore(policy_decision);
     return TRUE;
 }
 
+static void
+wxgtk_webview_webkit_title_changed(WebKitWebView *webView,
+                                   WebKitWebFrame *frame,
+                                   gchar *title,
+                                   wxWebViewWebKit *webKitCtrl)
+{
+    wxWebNavigationEvent thisEvent(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED,
+                                   webKitCtrl->GetId(),
+                                   webKitCtrl->GetCurrentURL(),
+                                   "",
+                                   true);
+    thisEvent.SetString(wxString(title, wxConvUTF8));
+
+    if (webKitCtrl && webKitCtrl->GetEventHandler())
+        webKitCtrl->GetEventHandler()->ProcessEvent(thisEvent);
+
+}
+
 } // extern "C"
 
 //-----------------------------------------------------------------------------
@@ -320,6 +332,9 @@ bool wxWebViewWebKit::Create(wxWindow *parent,
     g_signal_connect_after(web_view, "new-window-policy-decision-requested",
                            G_CALLBACK(wxgtk_webview_webkit_new_window), this);
 
+    g_signal_connect_after(web_view, "title-changed",
+                           G_CALLBACK(wxgtk_webview_webkit_title_changed), this);
+
     m_parent->DoAddChild( this );
 
     PostCreation(size);