Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpgritti@gmail.com>2008-10-15 02:33:21 (GMT)
committer Marco Pesenti Gritti <mpgritti@gmail.com>2008-10-15 02:33:21 (GMT)
commitfe68d402ad560edd6bdb265a14cbd80b5f281ca7 (patch)
tree4d93a16ab81ac808742301c0bafedd063f10e53e /python
parentd3fd80482ca4807c911173c50cc7b8ad2917fa4a (diff)
Better way to map from dom window to view.
Give up on trying to allow to user the view before it's realized, it's just not possible to do it with current mozilla implementation.
Diffstat (limited to 'python')
-rw-r--r--python/__init__.py1
-rw-r--r--python/hulahop.defs14
-rw-r--r--python/webview.py21
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