Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/browser.py
diff options
context:
space:
mode:
Diffstat (limited to 'browser.py')
-rw-r--r--browser.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/browser.py b/browser.py
index 2d65237..83cc7ea 100644
--- a/browser.py
+++ b/browser.py
@@ -35,6 +35,7 @@ from sugar3.graphics.icon import Icon
from widgets import BrowserNotebook
import globalhistory
+import downloadmanager
_ZOOM_AMOUNT = 0.1
_LIBRARY_PATH = '/usr/share/library-common/index.html'
@@ -389,6 +390,9 @@ class Browser(WebKit.WebView):
self._global_history = globalhistory.get_global_history()
self.connect('notify::load-status', self.__load_status_changed_cb)
self.connect('notify::title', self.__title_changed_cb)
+ self.connect('download-requested', self.__download_requested_cb)
+ self.connect('mime-type-policy-decision-requested',
+ self.__mime_type_policy_cb)
def get_history(self):
"""Return the browsing history of this browser."""
@@ -478,6 +482,16 @@ class Browser(WebKit.WebView):
title = unicode(title, 'utf-8')
self._global_history.set_page_title(uri, title)
+ def __mime_type_policy_cb(self, webview, frame, request, mimetype,
+ policy_decision):
+ if not self.can_show_mime_type(mimetype):
+ policy_decision.download()
+ return True
+
+ def __download_requested_cb(self, browser, download):
+ downloadmanager.add_download(download, browser)
+ return True
+
class PopupDialog(Gtk.Window):
def __init__(self):