diff options
author | Marco Pesenti Gritti <mpgritti@gmail.com> | 2008-10-15 10:08:06 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpgritti@gmail.com> | 2008-10-15 10:08:06 (GMT) |
commit | c0518123f7a236b2eef924aa4af85bbe92e58727 (patch) | |
tree | fe3534571f4456e5d54fc0b898c5b6a9d5a55e9c /python | |
parent | fe68d402ad560edd6bdb265a14cbd80b5f281ca7 (diff) |
Refactor initialization some more.
Diffstat (limited to 'python')
-rw-r--r-- | python/hulahop.defs | 6 | ||||
-rw-r--r-- | python/webview.py | 16 |
2 files changed, 19 insertions, 3 deletions
diff --git a/python/hulahop.defs b/python/hulahop.defs index cad4a28..d07bf16 100644 --- a/python/hulahop.defs +++ b/python/hulahop.defs @@ -5,6 +5,12 @@ (gtype-id "HULAHOP_TYPE_WEB_VIEW") ) +(define-virtual setup + (of-object "HulahopWebView") + (c-name "hulahop_web_view_setup") + (return-type "none") +) + (define-method grab_focus (of-object "HulahopWebView") (c-name "hulahop_web_view_grab_focus") diff --git a/python/webview.py b/python/webview.py index c257f9c..3cccde6 100644 --- a/python/webview.py +++ b/python/webview.py @@ -227,6 +227,13 @@ class WebView(_hulahop.WebView): interfaces.nsIWebProgressListener) self._status = '' + self._first_uri = None + + def do_setup(self): + _hulahop.WebView.do_setup(self) + + if self._first_uri: + self.load_uri(self._first_uri) def _notify_title_changed(self): self.notify('title') @@ -261,9 +268,12 @@ class WebView(_hulahop.WebView): return self.browser.contentDOMWindow def load_uri(self, uri): - self.web_navigation.loadURI( - uri, interfaces.nsIWebNavigation.LOAD_FLAGS_NONE, - None, None, None) + try: + self.web_navigation.loadURI( + uri, interfaces.nsIWebNavigation.LOAD_FLAGS_NONE, + None, None, None) + except xpcom.Exception: + self._first_uri = uri dom_window = property(get_dom_window) browser = property(get_browser) |