Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--browser.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/browser.py b/browser.py
index f35ded3..259d888 100644
--- a/browser.py
+++ b/browser.py
@@ -490,6 +490,8 @@ class Browser(WebKit.WebView):
self.connect('download-requested', self.__download_requested_cb)
self.connect('mime-type-policy-decision-requested',
self.__mime_type_policy_cb)
+ self.connect('new-window-policy-decision-requested',
+ self.__new_window_policy_cb)
def get_history(self):
"""Return the browsing history of this browser."""
@@ -591,6 +593,21 @@ class Browser(WebKit.WebView):
policy_decision.download()
return True
+ def __new_window_policy_cb(self, webview, webframe, request,
+ navigation_action, policy_decision):
+ """Open new tab instead of a new window.
+
+ Browse doesn't support many windows, as any Sugar activity.
+ So we will handle the request, ignoring it and returning True
+ to inform WebKit that a decision was made. And we will open a
+ new tab instead.
+
+ """
+ policy_decision.ignore()
+ uri = request.get_uri()
+ self.open_new_tab(uri)
+ return True
+
def __download_requested_cb(self, browser, download):
downloadmanager.add_download(download, browser)
return True