diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-06-13 19:14:28 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-06-13 19:14:28 (GMT) |
commit | 2c3b4bee71d588f853139ea33e4fc95aff391350 (patch) | |
tree | 08a0c093ba99890aa7084dd6a5b00d51343a0d8b /browser.py | |
parent | f60c6a236b5662671b64511d2bc4431281547063 (diff) |
Add target text/uri-list for images when dragging them out of mozilla.
Diffstat (limited to 'browser.py')
-rw-r--r-- | browser.py | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -26,6 +26,7 @@ from xpcom.components import interfaces from hulahop.webview import WebView import sessionstore +from dnd import DragDropHooks class Browser(WebView): def __init__(self): @@ -36,7 +37,20 @@ class Browser(WebView): window_watcher = cls.getService(interfaces.nsIWindowWatcher) window_watcher.setWindowCreator(window_creator) - self.is_chrome= False + self.is_chrome = False + + self.connect('realize', self._realize_cb) + + def _realize_cb(self, widget): + drag_drop_hooks = DragDropHooks(self) + + cls = components.classes['@mozilla.org/embedcomp/command-params;1'] + cmd_params = cls.createInstance('nsICommandParams') + cmd_params.setISupportsValue('addhook', drag_drop_hooks) + + requestor = self.browser.queryInterface(interfaces.nsIInterfaceRequestor) + command_manager = requestor.getInterface(interfaces.nsICommandManager) + command_manager.doCommand('cmd_clipboardDragDropHook', cmd_params, self.window) def get_session(self): return sessionstore.get_session(self) |