Skip to content

Commit

Permalink
Add a preference option for the selection of the toolbar style
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-Hall committed Jan 30, 2025
1 parent c9d095a commit c3fc023
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gramps/gen/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def emit(key):
register("interface.size-checked", False)
register("interface.statusbar", 1)
register("interface.toolbar-on", True)
register("interface.toolbar-text", False)
register("interface.toolbar-style", 0)
register("interface.hide-lds", False)
register("interface.toolbar-clipboard", True)
register("interface.toolbar-addons", True)
Expand Down
25 changes: 25 additions & 0 deletions gramps/gui/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,13 @@ def cb_toolbar_changed(self, obj):
"""
self.uistate.emit("toolbar-changed")

def cb_toolbar_style_changed(self, obj):
"""
Called when the toolbar style is changed.
"""
config.set("interface.toolbar-style", obj.get_active())
self.uistate.uimanager.update_menu()

def add_data_panel(self, configdialog):
"""
Config tab with user Appearance and format settings.
Expand Down Expand Up @@ -2110,6 +2117,24 @@ def add_general_panel(self, configdialog):
extra_callback=self.cb_toolbar_changed,
)

row += 1
# Toolbar styles:
obox = Gtk.ComboBoxText()
formats = [
_("Use default preference"),
_("Text only"),
_("Icons only"),
_("Both text and icons"),
]
list(map(obox.append_text, formats))
active = config.get("interface.toolbar-style")
obox.set_active(active)
obox.set_tooltip_text(_("Display text, icons or both on the toolbar buttons."))
obox.connect("changed", self.cb_toolbar_style_changed)
lwidget = BasicLabel(_("%s: ") % _("Toolbar Style"))
grid.attach(lwidget, 1, row, 1, 1)
grid.attach(obox, 2, row, 1, 1)

row += 1
# Gramplet bar close buttons:
self.add_checkbox(
Expand Down
7 changes: 6 additions & 1 deletion gramps/gui/uimanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,12 @@ def iterator(parents):
tb_show = toolbar.get_visible()
toolbar_parent.remove(toolbar)
toolbar = self.builder.get_object("ToolBar") # new toolbar
if config.get("interface.toolbar-text"):
toolbar_style = config.get("interface.toolbar-style")
if toolbar_style == 1:
toolbar.set_style(Gtk.ToolbarStyle.TEXT)
elif toolbar_style == 2:
toolbar.set_style(Gtk.ToolbarStyle.ICONS)
elif toolbar_style == 3:
toolbar.set_style(Gtk.ToolbarStyle.BOTH)
toolbar_parent.pack_start(toolbar, False, True, 0)
if tb_show:
Expand Down

0 comments on commit c3fc023

Please sign in to comment.