From e360e989cff7e8ae64dd3a886dbc510a1f03caae Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 22 Oct 2013 09:54:05 +0530 Subject: [PATCH] Copy to library menu move copy by path to top for more than 50 libraries Copy to library menu: Move the choose library by path option to the start of the menu if there are more than 50 libraries. --- src/calibre/gui2/actions/copy_to_library.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/actions/copy_to_library.py b/src/calibre/gui2/actions/copy_to_library.py index a17abbc2fb..f326ed3f12 100644 --- a/src/calibre/gui2/actions/copy_to_library.py +++ b/src/calibre/gui2/actions/copy_to_library.py @@ -280,6 +280,9 @@ class CopyToLibraryAction(InterfaceAction): return db = self.gui.library_view.model().db locations = list(self.stats.locations(db)) + if len(locations) > 50: + self.menu.addAction(_('Choose library by path...'), self.choose_library) + self.menu.addSeparator() for name, loc in locations: self.menu.addAction(name, partial(self.copy_to_library, loc)) @@ -287,7 +290,8 @@ class CopyToLibraryAction(InterfaceAction): partial(self.copy_to_library, loc, delete_after=True)) self.menu.addSeparator() - self.menu.addAction(_('Choose library by path...'), self.choose_library) + if len(locations) <= 50: + self.menu.addAction(_('Choose library by path...'), self.choose_library) self.qaction.setVisible(bool(locations)) def choose_library(self):