summaryrefslogtreecommitdiffstats
path: root/pkg/gui/controllers/menu_controller.go
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-09-05 21:49:33 +0200
committerStefan Haller <stefan@haller-berlin.de>2023-09-18 10:15:11 +0200
commit7f9818cfa2a3115ecd0f043b5e94044be1346cda (patch)
tree083497230ebd23c6232d2628d97ec87c7a852bf1 /pkg/gui/controllers/menu_controller.go
parent679148449a27486196e4d5aa7f1bf27d8853e9fe (diff)
Add DisabledReason field to MenuItem
This is useful to disable items that are not applicable right now because of some condition (e.g. the "delete branch" menu item when the currently checked-out branch is selected). When a DisabledReason is set on a menu item, we - show it in a tooltip (below the regular tooltip of the item, if it has one) - strike through the item's key, if it has one - show an error message with the DisabledReason if the user tries to invoke the command
Diffstat (limited to 'pkg/gui/controllers/menu_controller.go')
-rw-r--r--pkg/gui/controllers/menu_controller.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/gui/controllers/menu_controller.go b/pkg/gui/controllers/menu_controller.go
index 108bd9cf7..0af32ef71 100644
--- a/pkg/gui/controllers/menu_controller.go
+++ b/pkg/gui/controllers/menu_controller.go
@@ -54,7 +54,7 @@ func (self *MenuController) GetOnFocus() func(types.OnFocusOpts) error {
return func(types.OnFocusOpts) error {
selectedMenuItem := self.context().GetSelected()
if selectedMenuItem != nil {
- self.c.Views().Tooltip.SetContent(selectedMenuItem.Tooltip)
+ self.c.Views().Tooltip.SetContent(self.c.Helpers().Confirmation.TooltipForMenuItem(selectedMenuItem))
}
return nil
}