2012/5/3 Manuel Kaufmann <humi...@gmail.com>: > First of all, we don't need to open "about:blank" when we create a new > tab, this was making the history to save that "page" and allowing to > go back to it. > > That is related with this PATCH because we are checking the browser > "load-status" property to know what title put in the tab label. Now, > we check for the "load-status" property and set the title according to > the load progress: if WebKit is loading the page we put "Loading..." > or the page's title otherwise with the exception of "about:blank" page > that has no title, so we put "Untitled". > > Signed-off-by: Manuel Kaufmann <humi...@gmail.com> > --- > browser.py | 12 +++++++++++- > 1 files changed, 11 insertions(+), 1 deletions(-) > > diff --git a/browser.py b/browser.py > index c0bb7bc..3cb8f38 100644 > --- a/browser.py > +++ b/browser.py > @@ -190,7 +190,6 @@ class TabbedView(BrowserNotebook): > else: > self._append_tab(browser) > self.emit('focus-url-entry') > - browser.load_uri('about:blank')
This line is an important fix, there is no need to load about:blank, WebKit will show an empty page by default. It was messing the web history. Thanks! > return browser > > def _insert_tab_next(self, browser): > @@ -354,6 +353,7 @@ class TabLabel(Gtk.HBox): > GObject.GObject.__init__(self) > > 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._label.set_ellipsize(Pango.EllipsizeMode.END) > @@ -392,6 +392,16 @@ class TabLabel(Gtk.HBox): > if widget.props.title: > self._label.set_text(widget.props.title) > > + def __load_status_changed_cb(self, widget, param): > + status = widget.get_load_status() > + if widget.get_uri() == 'about:blank': > + self._label.set_text(_('Untitled')) > + return None This problem with this is that it applies each time the loading status changes. Further, I tested and there is other case that leave us with "Loading..." after the loading finishes: pages without title (with no <title> label in the <head>). The attached re-patch will fix it. > + if WebKit.LoadStatus.PROVISIONAL <= status \ > + < WebKit.LoadStatus.FINISHED: > + self._label.set_text(_('Loading...')) > + > > class Browser(WebKit.WebView): > __gtype_name__ = 'Browser' > -- > 1.7.7.6 > -- .. manuq ..
diff --git a/browser.py b/browser.py index 53cd5d0..27002b4 100644 --- a/browser.py +++ b/browser.py @@ -394,13 +394,12 @@ class TabLabel(Gtk.HBox): def __load_status_changed_cb(self, widget, param): status = widget.get_load_status() - if widget.get_uri() == 'about:blank': - self._label.set_text(_('Untitled')) - return None - if 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')) class Browser(WebKit.WebView):
_______________________________________________ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel