mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Allow user to set the number of recently viewed books shown in the dropdown menu of the view button, via a tweak in Preferences->Tweaks. Fixes #910292 (More entries for the view button)
This commit is contained in:
parent
cedb8749fb
commit
66aefc1897
@ -471,3 +471,8 @@ unified_title_toolbar_on_osx = False
|
|||||||
# this to False you can prevent calibre from saving the original file.
|
# this to False you can prevent calibre from saving the original file.
|
||||||
save_original_format = True
|
save_original_format = True
|
||||||
|
|
||||||
|
#: Number of recently viewed books to show
|
||||||
|
# Right-clicking the View button shows a list of recently viewed books. Control
|
||||||
|
# how many should be shown, here.
|
||||||
|
gui_view_history_size = 15
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ from calibre.constants import isosx
|
|||||||
from calibre.gui2 import error_dialog, Dispatcher, question_dialog, config, \
|
from calibre.gui2 import error_dialog, Dispatcher, question_dialog, config, \
|
||||||
open_local_file, info_dialog
|
open_local_file, info_dialog
|
||||||
from calibre.gui2.dialogs.choose_format import ChooseFormatDialog
|
from calibre.gui2.dialogs.choose_format import ChooseFormatDialog
|
||||||
from calibre.utils.config import prefs
|
from calibre.utils.config import prefs, tweaks
|
||||||
from calibre.ptempfile import PersistentTemporaryFile
|
from calibre.ptempfile import PersistentTemporaryFile
|
||||||
from calibre.gui2.actions import InterfaceAction
|
from calibre.gui2.actions import InterfaceAction
|
||||||
|
|
||||||
@ -239,6 +239,7 @@ class ViewAction(InterfaceAction):
|
|||||||
|
|
||||||
def update_history(self, views, remove=frozenset()):
|
def update_history(self, views, remove=frozenset()):
|
||||||
db = self.gui.current_db
|
db = self.gui.current_db
|
||||||
|
vh = tweaks['gui_view_history_size']
|
||||||
if views:
|
if views:
|
||||||
seen = set()
|
seen = set()
|
||||||
history = []
|
history = []
|
||||||
@ -247,12 +248,12 @@ class ViewAction(InterfaceAction):
|
|||||||
seen.add(title)
|
seen.add(title)
|
||||||
history.append((id_, title))
|
history.append((id_, title))
|
||||||
|
|
||||||
db.prefs['gui_view_history'] = history[:10]
|
db.prefs['gui_view_history'] = history[:vh]
|
||||||
self.build_menus(db)
|
self.build_menus(db)
|
||||||
if remove:
|
if remove:
|
||||||
history = db.prefs.get('gui_view_history', [])
|
history = db.prefs.get('gui_view_history', [])
|
||||||
history = [x for x in history if x[0] not in remove]
|
history = [x for x in history if x[0] not in remove]
|
||||||
db.prefs['gui_view_history'] = history[:10]
|
db.prefs['gui_view_history'] = history[:vh]
|
||||||
self.build_menus(db)
|
self.build_menus(db)
|
||||||
|
|
||||||
def _view_books(self, rows):
|
def _view_books(self, rows):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user