From 802372fbae42bf4aba6dbbb3e92c5c090df76abc Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Mon, 01 Oct 2007 22:05:33 +0000 Subject: Limit to 15 entries in the palette of the back/forward buttons --- (limited to 'webtoolbar.py') diff --git a/webtoolbar.py b/webtoolbar.py index 098ac4d..c8cf8b3 100755 --- a/webtoolbar.py +++ b/webtoolbar.py @@ -31,6 +31,8 @@ import sessionhistory import progresslistener import filepicker +_MAX_HISTORY_ENTRIES = 16 + class WebToolbar(gtk.Toolbar): __gtype_name__ = 'WebToolbar' @@ -187,7 +189,18 @@ class WebToolbar(gtk.Toolbar): palette.menu.remove(menu_item) session_history = self._browser.web_navigation.sessionHistory - for i in range(0, session_history.count): + if session_history.count <= _MAX_HISTORY_ENTRIES \ + or current_page_index < _MAX_HISTORY_ENTRIES: + bottom = 0 + else: + bottom = session_history.count - _MAX_HISTORY_ENTRIES + + if session_history.count == current_page_index: + top = session_history.count-1 + else: + top = session_history.count + + for i in range(bottom, top): if i == current_page_index: continue -- cgit v0.9.1