From c0518123f7a236b2eef924aa4af85bbe92e58727 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Wed, 15 Oct 2008 10:08:06 +0000 Subject: Refactor initialization some more. --- (limited to 'python') 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) -- cgit v0.9.1