diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/__init__.py | 1 | ||||
-rw-r--r-- | python/hulahop.defs | 14 | ||||
-rw-r--r-- | python/webview.py | 21 |
3 files changed, 13 insertions, 23 deletions
diff --git a/python/__init__.py b/python/__init__.py index 983302e..a1fde26 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -27,6 +27,7 @@ from hulahop import config sys.path.insert(0, os.path.join(config.libxul_dir, 'python')) from hulahop._hulahop import shutdown +from hulahop._hulahop import get_view_for_window from hulahop import _hulahop _XO_DPI = 200 diff --git a/python/hulahop.defs b/python/hulahop.defs index 55c1733..cad4a28 100644 --- a/python/hulahop.defs +++ b/python/hulahop.defs @@ -5,12 +5,6 @@ (gtype-id "HULAHOP_TYPE_WEB_VIEW") ) -(define-method create_window - (of-object "HulahopWebView") - (c-name "hulahop_web_view_create_window") - (return-type "none") -) - (define-method grab_focus (of-object "HulahopWebView") (c-name "hulahop_web_view_grab_focus") @@ -76,3 +70,11 @@ (return-type "none") ) +(define-function get_view_for_window + (c-name "hulahop_get_view_for_window") + (return-type "HulahopWebView*") + (parameters + '("PyObject*" "dom_window") + ) +) + diff --git a/python/webview.py b/python/webview.py index b4dc51f..c257f9c 100644 --- a/python/webview.py +++ b/python/webview.py @@ -25,8 +25,6 @@ from xpcom import components from xpcom.components import interfaces from xpcom.nsError import * -_views = [] - class _Chrome: _com_interfaces_ = interfaces.nsIWebBrowserChrome, \ interfaces.nsIWebBrowserChrome2, \ @@ -147,6 +145,9 @@ class _Chrome: #logging.debug("nsIEmbeddingSiteWindow.get_visibility: %r" % self.web_view.get_toplevel().props.visible) return self.web_view.get_toplevel().props.visible + def get_webBrowser(self): + return self.web_view.browser + def get_chromeFlags(self): return self._chrome_flags @@ -206,6 +207,7 @@ class WebView(_hulahop.WebView): 'status' : (str, None, None, None, gobject.PARAM_READABLE) } + def __init__(self): _hulahop.WebView.__init__(self) @@ -226,15 +228,6 @@ class WebView(_hulahop.WebView): self._status = '' - self.create_window() - - self.connect('destroy', self.__destroy_cb) - - _views.append(self) - - def __destroy_cb(self): - _views.remove(self) - def _notify_title_changed(self): self.notify('title') @@ -278,9 +271,3 @@ class WebView(_hulahop.WebView): doc_shell = property(get_doc_shell) web_progress = property(get_web_progress) web_navigation = property(get_web_navigation) - -def lookup_view(chrome): - for view in _views: - if view._chrome == chrome: - return view - return None |