From 978cc1edf77fc88c6c80c75694f96e2848c02ef1 Mon Sep 17 00:00:00 2001 From: Lucian Branescu Mihaila Date: Wed, 06 Oct 2010 13:22:48 +0000 Subject: Fix history on resume. The code is a bit hacky because of xulrunner limitations. I plan to make this code nicer when we move to webkit. --- (limited to 'browser.py') diff --git a/browser.py b/browser.py index ece81d1..8e1dab5 100644 --- a/browser.py +++ b/browser.py @@ -252,12 +252,7 @@ class TabLabel(gtk.HBox): browser.connect('notify::title', self.__title_changed_cb) def __location_changed_cb(self, progress_listener, pspec): - uri = progress_listener.location - cls = components.classes['@mozilla.org/intl/texttosuburi;1'] - texttosuburi = cls.getService(interfaces.nsITextToSubURI) - ui_uri = texttosuburi.unEscapeURIForUI(uri.originCharset, uri.spec) - - self._label.set_text(ui_uri) + self._label.set_text(self._browser.get_url_from_nsiuri(progress_listener.location)) def __title_changed_cb(self, browser, pspec): self._label.set_text(browser.props.title) @@ -300,6 +295,15 @@ class Browser(WebView): self.emit('is-setup') + + def get_url_from_nsiuri(self, uri): + """ + get a nsIURI object and return a string with the url + """ + cls = components.classes['@mozilla.org/intl/texttosuburi;1'] + texttosuburi = cls.getService(interfaces.nsITextToSubURI) + return texttosuburi.unEscapeURIForUI(uri.originCharset, uri.spec) + def get_session(self): return sessionstore.get_session(self) -- cgit v0.9.1