Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/filepicker.py
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpgritti@gmail.com>2008-10-15 10:52:33 (GMT)
committer Marco Pesenti Gritti <mpgritti@gmail.com>2008-10-15 10:52:33 (GMT)
commit55647642ada6669967154b5523bbfee7eb218519 (patch)
tree7a34963149ddb0667339c021e872a4b26febbc66 /filepicker.py
parent7d3a1a97044b902d83e901c30fdc5a5d4a1f6d55 (diff)
Make the filepicker work on multiple windows.
Diffstat (limited to 'filepicker.py')
-rw-r--r--filepicker.py25
1 files changed, 5 insertions, 20 deletions
diff --git a/filepicker.py b/filepicker.py
index a38de9a..240e7e8 100644
--- a/filepicker.py
+++ b/filepicker.py
@@ -20,6 +20,7 @@ import tempfile
import shutil
import gtk
+import hulahop
import xpcom
from xpcom import components
@@ -29,7 +30,6 @@ from xpcom.server.factory import Factory
from sugar.graphics.objectchooser import ObjectChooser
_temp_files_to_clean = []
-_browser_window = None
def cleanup_temp_files():
for temp_file in _temp_files_to_clean:
@@ -60,17 +60,7 @@ class FilePicker:
def init(self, parent, title, mode):
self._title = title
self._file = None
-
- """
- Would be nice to get the window xid with something like this, but
- couldn't find how.
-
- cls = components.classes['@mozilla.org/embedcomp/window-watcher;1']
- window_watcher = cls.getService(interfaces.nsIWindowWatcher)
- chrome = window_watcher.getChromeForWindow(parent)
- self._parent = chrome.web_view.get_toplevel()
- """
- self._parent = _browser_window
+ self._parent = hulahop.get_view_for_window(parent)
if mode != interfaces.nsIFilePicker.modeOpen:
raise xpcom.COMException(NS_ERROR_NOT_IMPLEMENTED)
@@ -149,11 +139,6 @@ class FilePicker:
return None
components.registrar.registerFactory(FilePicker.cid,
- FilePicker.description,
- '@mozilla.org/filepicker;1',
- Factory(FilePicker))
-
-def init(main_window):
- global _browser_window
- _browser_window = main_window.get_toplevel()
-
+ FilePicker.description,
+ '@mozilla.org/filepicker;1',
+ Factory(FilePicker))