From 94375b4567b3a28f12fe6c349e2d014b6a9199b4 Mon Sep 17 00:00:00 2001
Message-Id: <94375b4567b3a28f12fe6c349e2d014b6a9199b4.1336058091.git.humitos@gmail.com>
From: Manuel Kaufmann <humitos@gmail.com>
Date: Thu, 3 May 2012 12:13:11 -0300
Subject: [PATCH Browse] Display 'Loading...' message in the tab title while
the page is loading #3550
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 <humitos@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
|
b
|
class TabbedView(BrowserNotebook): |
190 | 190 | else: |
191 | 191 | self._append_tab(browser) |
192 | 192 | self.emit('focus-url-entry') |
193 | | browser.load_uri('about:blank') |
194 | 193 | return browser |
195 | 194 | |
196 | 195 | def _insert_tab_next(self, browser): |
… |
… |
class TabLabel(Gtk.HBox): |
354 | 353 | GObject.GObject.__init__(self) |
355 | 354 | |
356 | 355 | browser.connect('notify::title', self.__title_changed_cb) |
| 356 | browser.connect('notify::load-status', self.__load_status_changed_cb) |
357 | 357 | |
358 | 358 | self._label = Gtk.Label(label=_('Untitled')) |
359 | 359 | self._label.set_ellipsize(Pango.EllipsizeMode.END) |
… |
… |
class TabLabel(Gtk.HBox): |
392 | 392 | if widget.props.title: |
393 | 393 | self._label.set_text(widget.props.title) |
394 | 394 | |
| 395 | def __load_status_changed_cb(self, widget, param): |
| 396 | status = widget.get_load_status() |
| 397 | if widget.get_uri() == 'about:blank': |
| 398 | self._label.set_text(_('Untitled')) |
| 399 | return None |
| 400 | |
| 401 | if WebKit.LoadStatus.PROVISIONAL <= status \ |
| 402 | < WebKit.LoadStatus.FINISHED: |
| 403 | self._label.set_text(_('Loading...')) |
| 404 | |
395 | 405 | |
396 | 406 | class Browser(WebKit.WebView): |
397 | 407 | __gtype_name__ = 'Browser' |