diff options
author | Simon Schampijer <simon@schampijer.de> | 2007-10-02 09:18:43 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@schampijer.de> | 2007-10-02 09:18:43 (GMT) |
commit | 82d1daf4e87eb447e770a80f9924f94317cfa45b (patch) | |
tree | 8b3af4b03489a69e39d2c4ccce033562c0dd2aa2 | |
parent | 802372fbae42bf4aba6dbbb3e92c5c090df76abc (diff) |
Refactored the 'max display of history items code'
-rwxr-xr-x | webtoolbar.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/webtoolbar.py b/webtoolbar.py index c8cf8b3..1b86606 100755 --- a/webtoolbar.py +++ b/webtoolbar.py @@ -31,7 +31,7 @@ import sessionhistory import progresslistener import filepicker -_MAX_HISTORY_ENTRIES = 16 +_MAX_HISTORY_ENTRIES = 15 class WebToolbar(gtk.Toolbar): __gtype_name__ = 'WebToolbar' @@ -189,14 +189,13 @@ class WebToolbar(gtk.Toolbar): palette.menu.remove(menu_item) session_history = self._browser.web_navigation.sessionHistory - if session_history.count <= _MAX_HISTORY_ENTRIES \ - or current_page_index < _MAX_HISTORY_ENTRIES: - bottom = 0 + if current_page_index > _MAX_HISTORY_ENTRIES: + bottom = current_page_index - _MAX_HISTORY_ENTRIES else: - bottom = session_history.count - _MAX_HISTORY_ENTRIES - - if session_history.count == current_page_index: - top = session_history.count-1 + bottom = 0 + if (session_history.count - current_page_index) > \ + _MAX_HISTORY_ENTRIES: + top = current_page_index + _MAX_HISTORY_ENTRIES + 1 else: top = session_history.count |