From 1a916cd7da7104a562bc848c5b1a18d40fe07c13 Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Thu, 14 Jun 2007 21:08:10 +0000 Subject: Stop/Reload button fixes --- (limited to 'webtoolbar.py') diff --git a/webtoolbar.py b/webtoolbar.py index 320eb08..cfa360c 100755 --- a/webtoolbar.py +++ b/webtoolbar.py @@ -52,19 +52,19 @@ class _ProgressListener: self.total_requests += 1 elif stateFlags & interfaces.nsIWebProgressListener.STATE_STOP: self.completed_requests += 1 - + if stateFlags & interfaces.nsIWebProgressListener.STATE_IS_NETWORK: if stateFlags & interfaces.nsIWebProgressListener.STATE_START: self.toolbar._set_title(None) - self.toolbar._show_stop_icon() + self.toolbar.set_loading(True) self.toolbar._update_navigation_buttons() self._reset_requests_count() elif stateFlags & interfaces.nsIWebProgressListener.STATE_STOP: - self.toolbar._show_reload_icon() + self.toolbar.set_loading(False) self.toolbar._update_navigation_buttons() if self.total_requests < self.completed_requests: - self.toolbar._set_progress(1.0) + self.toolbar._set_progress(1.0) elif self.total_requests > 0: self.toolbar._set_progress(float(self.completed_requests) / float(self.total_requests)) @@ -155,8 +155,16 @@ class WebToolbar(gtk.Toolbar): self._set_title(embed.props.title) def _stop_and_reload_cb(self, button): - if self._embed.props.loading: - self._browser.web_navigation.stop() + if self._loading: + self._browser.web_navigation.stop(interfaces.nsIWebNavigation.STOP_ALL) else: flags = interfaces.nsIWebNavigation.LOAD_FLAGS_NONE self._browser.web_navigation.reload(flags) + + def set_loading(self, loading): + self._loading = loading + + if self._loading: + self._show_stop_icon() + else: + self._show_reload_icon() \ No newline at end of file -- cgit v0.9.1