diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py
index 9649a79cc1..ade4b496fe 100644
--- a/src/calibre/gui2/__init__.py
+++ b/src/calibre/gui2/__init__.py
@@ -29,6 +29,8 @@ gprefs.defaults['action-layout-toolbar'] = (
'Connect Share', None, 'Remove Books', None, 'Help', 'Preferences',
)
+gprefs.defaults['action-layout-toolbar-child'] = ()
+
gprefs.defaults['action-layout-toolbar-device'] = (
'Add Books', 'Edit Metadata', None, 'Convert Books', 'View',
'Send To Device', None, None, 'Location Manager', None, None,
diff --git a/src/calibre/gui2/layout.py b/src/calibre/gui2/layout.py
index e8a4e79384..e4814ffbb8 100644
--- a/src/calibre/gui2/layout.py
+++ b/src/calibre/gui2/layout.py
@@ -278,11 +278,16 @@ class ToolBar(QToolBar): # {{{
pass
def build_bar(self):
- self.child_bar.setVisible(gprefs['show_child_bar'])
self.showing_donate = False
showing_device = self.location_manager.has_device
- actions = '-device' if showing_device else ''
- actions = gprefs['action-layout-toolbar'+actions]
+ mactions = '-device' if showing_device else ''
+ mactions = gprefs['action-layout-toolbar'+mactions]
+ cactions = gprefs['action-layout-toolbar-child']
+
+ show_child = gprefs['show_child_bar']
+ if not len(cactions):
+ show_child = False
+ self.child_bar.setVisible(show_child)
for ac in self.added_actions:
m = ac.menu()
@@ -292,41 +297,27 @@ class ToolBar(QToolBar): # {{{
self.clear()
self.child_bar.clear()
self.added_actions = []
- self.spacers = [Spacer(self.child_bar), Spacer(self.child_bar),
- Spacer(self), Spacer(self)]
- self.child_bar.addWidget(self.spacers[0])
- if gprefs['show_child_bar']:
- self.addWidget(self.spacers[2])
- for what in actions:
- if what is None and not gprefs['show_child_bar']:
- self.addSeparator()
- elif what == 'Location Manager':
- for ac in self.location_manager.available_actions:
- self.addAction(ac)
- self.added_actions.append(ac)
- self.setup_tool_button(ac, QToolButton.MenuButtonPopup)
- elif what == 'Donate':
- self.d_widget = QWidget()
- self.d_widget.setLayout(QVBoxLayout())
- self.d_widget.layout().addWidget(self.donate_button)
- self.addWidget(self.d_widget)
- self.showing_donate = True
- elif what in self.gui.iactions:
- action = self.gui.iactions[what]
- bar = self
- if action.action_type == 'current' and gprefs['show_child_bar']:
- bar = self.child_bar
- bar.addAction(action.qaction)
- self.added_actions.append(action.qaction)
- self.setup_tool_button(action.qaction, action.popup_type)
-
- self.child_bar.addWidget(self.spacers[1])
- if gprefs['show_child_bar']:
- self.addWidget(self.spacers[3])
- else:
- for s in self.spacers[2:]:
- s.setVisible(False)
+ for bar, actions in ((self, mactions), (self.child_bar, cactions)):
+ for what in actions:
+ if what is None:
+ bar.addSeparator()
+ elif what == 'Location Manager':
+ for ac in self.location_manager.available_actions:
+ bar.addAction(ac)
+ bar.added_actions.append(ac)
+ bar.setup_tool_button(ac, QToolButton.MenuButtonPopup)
+ elif what == 'Donate':
+ self.d_widget = QWidget()
+ self.d_widget.setLayout(QVBoxLayout())
+ self.d_widget.layout().addWidget(self.donate_button)
+ bar.addWidget(self.d_widget)
+ self.showing_donate = True
+ elif what in self.gui.iactions:
+ action = self.gui.iactions[what]
+ bar.addAction(action.qaction)
+ self.added_actions.append(action.qaction)
+ self.setup_tool_button(action.qaction, action.popup_type)
def setup_tool_button(self, ac, menu_mode=None):
ch = self.widgetForAction(ac)
diff --git a/src/calibre/gui2/preferences/look_feel.ui b/src/calibre/gui2/preferences/look_feel.ui
index bc965b89fa..048c664934 100644
--- a/src/calibre/gui2/preferences/look_feel.ui
+++ b/src/calibre/gui2/preferences/look_feel.ui
@@ -6,8 +6,8 @@
0
0
- 670
- 422
+ 717
+ 444
@@ -247,7 +247,7 @@ then the tags will be displayed each on their own line.
-
- &Split the toolbar into two toolbars
+ Add a &second toolbar
diff --git a/src/calibre/gui2/preferences/toolbar.py b/src/calibre/gui2/preferences/toolbar.py
index a0d48f3910..a17531c7d3 100644
--- a/src/calibre/gui2/preferences/toolbar.py
+++ b/src/calibre/gui2/preferences/toolbar.py
@@ -208,6 +208,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
LOCATIONS = [
('toolbar', _('The main toolbar')),
+ ('toolbar-child', _('The second toolbar')),
('toolbar-device', _('The main toolbar when a device is connected')),
('context-menu', _('The context menu for the books in the '
'calibre library')),