From 82d1daf4e87eb447e770a80f9924f94317cfa45b Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Tue, 02 Oct 2007 09:18:43 +0000 Subject: Refactored the 'max display of history items code' --- (limited to 'webtoolbar.py') 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 -- cgit v0.9.1