Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Quiñones <manuq@laptop.org>2012-03-23 12:03:17 (GMT)
committer Manuel Quiñones <manuq@laptop.org>2012-03-28 19:24:05 (GMT)
commit273cab7ffc0c0b4ae17d5844bc1d9c0fc06fef19 (patch)
tree256586e50b0e0e01becec0aeab3a0afb27f459aa
parentaa109ec239afe692c0ea471670647e0c886e0a92 (diff)
Update progress bar and stop/reload buttons when switching tabs
Calling the _set_status and _set_progress methods in the web toolbar directly when a new tab is activated. Also the callback for load-status is disconnected now in the previous tab, like the other callbacks. Removed the update of the navigation buttons when the loading status changes. This is only needed when the adress changes or when the tabs are switched. Removed the title set to None when loading status chenges, this was giving the following Gtk error: Gtk-CRITICAL **: gtk_entry_set_text: assertion `text != NULL' failed Signed-off-by: Manuel Quiñones <manuq@laptop.org> Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r--pdfviewer.py1
-rw-r--r--webtoolbar.py18
2 files changed, 9 insertions, 10 deletions
diff --git a/pdfviewer.py b/pdfviewer.py
index c7e2452..ef6a6ea 100644
--- a/pdfviewer.py
+++ b/pdfviewer.py
@@ -366,7 +366,6 @@ class PDFTabPage(Gtk.HBox):
def __download_progress_cb(self, download, data):
progress = download.get_progress()
- self._browser.props.load_status = WebKit.LoadStatus.PROVISIONAL
self._browser.props.progress = progress
def __download_status_cb(self, download, data):
diff --git a/webtoolbar.py b/webtoolbar.py
index 7525053..654f720 100644
--- a/webtoolbar.py
+++ b/webtoolbar.py
@@ -324,6 +324,7 @@ class PrimaryToolbar(ToolbarBase):
self._browser.disconnect(self._title_changed_hid)
self._browser.disconnect(self._uri_changed_hid)
self._browser.disconnect(self._progress_changed_hid)
+ self._browser.disconnect(self._loading_changed_hid)
self._browser = browser
if self._browser.props.title:
@@ -331,11 +332,11 @@ class PrimaryToolbar(ToolbarBase):
else:
self._set_title(_('Untitled'))
self._set_address(self._browser.props.uri)
+ self._set_progress(self._browser.props.progress)
+ self._set_status(self._browser.props.load_status)
- if isinstance(self._browser, Browser):
- self.entry.props.editable = True
- else:
- self.entry.props.editable = False
+ is_webkit_browser = isinstance(self._browser, Browser)
+ self.entry.props.editable = is_webkit_browser
self._title_changed_hid = self._browser.connect(
'notify::title', self._title_changed_cb)
@@ -349,15 +350,14 @@ class PrimaryToolbar(ToolbarBase):
self._update_navigation_buttons()
def __loading_changed_cb(self, widget, param):
- status = widget.get_load_status()
- if status <= WebKit.LoadStatus.COMMITTED:
- self._set_title(None)
- self._set_loading(status < WebKit.LoadStatus.FINISHED)
- self._update_navigation_buttons()
+ self._set_status(widget.get_load_status())
def __progress_changed_cb(self, widget, param):
self._set_progress(widget.get_progress())
+ def _set_status(self, status):
+ self._set_loading(status < WebKit.LoadStatus.FINISHED)
+
def _set_progress(self, progress):
if progress == 1.0:
self.entry.set_progress_fraction(0.0)