From d6c56f8184de2b3980aca34fb644d2a8f0f4b64f Mon Sep 17 00:00:00 2001 From: Manuel QuiƱones Date: Tue, 22 May 2012 15:20:26 +0000 Subject: Unset "loading..." message when the loading fails SL #3620 Browse has to restore the previous title in the tab and in the URL entry when the loading finishes with WEBKIT_LOAD_FAILED status. This fixes bug #3620 in Sugarlabs trac. The WEBKIT_LOAD_FAILED status is reached in the current webview when the loading is manually handled in the mime-type-policy-decision-requested callback. Signed-off-by: Manuel QuiƱones Tested-by: Manuel Kaufmann Acked-by: Simon Schampijer --- (limited to 'browser.py') diff --git a/browser.py b/browser.py index 764f913..6895667 100644 --- a/browser.py +++ b/browser.py @@ -361,7 +361,8 @@ class TabLabel(Gtk.HBox): browser.connect('notify::title', self.__title_changed_cb) browser.connect('notify::load-status', self.__load_status_changed_cb) - self._label = Gtk.Label(label=_('Untitled')) + self._title = _('Untitled') + self._label = Gtk.Label(label=self._title) self._label.set_ellipsize(Pango.EllipsizeMode.END) self._label.set_alignment(0, 0.5) self.pack_start(self._label, True, True, 0) @@ -397,15 +398,19 @@ class TabLabel(Gtk.HBox): def __title_changed_cb(self, widget, param): if widget.props.title: self._label.set_text(widget.props.title) + self._title = widget.props.title def __load_status_changed_cb(self, widget, param): status = widget.get_load_status() - if WebKit.LoadStatus.PROVISIONAL <= status \ + if status == WebKit.LoadStatus.FAILED: + self._label.set_text(self._title) + elif WebKit.LoadStatus.PROVISIONAL <= status \ < WebKit.LoadStatus.FINISHED: self._label.set_text(_('Loading...')) elif status == WebKit.LoadStatus.FINISHED: if widget.props.title == None: self._label.set_text(_('Untitled')) + self._title = _('Untitled') class Browser(WebKit.WebView): -- cgit v0.9.1