Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2012-05-04 12:27:07 (GMT)
committer Manuel QuiƱones <manuq@laptop.org>2012-05-04 13:57:09 (GMT)
commit04a0de3de3b24ae22bf326de046fb256bdbfeccb (patch)
treedf146d2c47cee136661b369fd8846c6bd65bbae4
parentebb013347fcf777401c589a557c50fae8b7eb7e7 (diff)
Display 'Loading...' message in the tab and url titles 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 and url 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> Acked-by: Manuel QuiƱones <manuq@laptop.org> Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r--browser.py11
-rw-r--r--webtoolbar.py7
2 files changed, 17 insertions, 1 deletions
diff --git a/browser.py b/browser.py
index 0334e6b..764f913 100644
--- a/browser.py
+++ b/browser.py
@@ -196,7 +196,6 @@ class TabbedView(BrowserNotebook):
else:
self._append_tab(browser)
self.emit('focus-url-entry')
- browser.load_uri('about:blank')
return browser
def _insert_tab_next(self, browser):
@@ -360,6 +359,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)
@@ -398,6 +398,15 @@ 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 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):
__gtype_name__ = 'Browser'
diff --git a/webtoolbar.py b/webtoolbar.py
index e4e647a..e7c66c9 100644
--- a/webtoolbar.py
+++ b/webtoolbar.py
@@ -352,6 +352,13 @@ class PrimaryToolbar(ToolbarBase):
self._update_navigation_buttons()
def __loading_changed_cb(self, widget, param):
+ status = widget.get_load_status()
+ if WebKit.LoadStatus.PROVISIONAL <= status \
+ < WebKit.LoadStatus.FINISHED:
+ self.entry._set_title(_('Loading...'))
+ elif status == WebKit.LoadStatus.FINISHED:
+ if widget.props.title == None:
+ self.entry._set_title(_('Loading...'))
self._set_status(widget.get_load_status())
def __progress_changed_cb(self, widget, param):