Show radio buttons in the show log graph and commit sort order menus

This commit is contained in:
Stefan Haller 2024-06-01 20:26:24 +02:00
parent 68c966567c
commit 4967e5136e

View file

@ -1085,6 +1085,7 @@ func (self *LocalCommitsController) handleOpenLogMenu() error {
Label: self.c.Tr.ShowGitGraph,
OpensMenu: true,
OnPress: func() error {
currentValue := self.c.GetAppState().GitLogShowGraph
onPress := func(value string) func() error {
return func() error {
self.c.GetAppState().GitLogShowGraph = value
@ -1101,14 +1102,17 @@ func (self *LocalCommitsController) handleOpenLogMenu() error {
{
Label: "always",
OnPress: onPress("always"),
Widget: types.MakeMenuRadioButton(currentValue == "always"),
},
{
Label: "never",
OnPress: onPress("never"),
Widget: types.MakeMenuRadioButton(currentValue == "never"),
},
{
Label: "when maximised",
OnPress: onPress("when-maximised"),
Widget: types.MakeMenuRadioButton(currentValue == "when-maximised"),
},
},
})
@ -1118,6 +1122,7 @@ func (self *LocalCommitsController) handleOpenLogMenu() error {
Label: self.c.Tr.SortCommits,
OpensMenu: true,
OnPress: func() error {
currentValue := self.c.GetAppState().GitLogOrder
onPress := func(value string) func() error {
return func() error {
self.c.GetAppState().GitLogOrder = value
@ -1139,14 +1144,17 @@ func (self *LocalCommitsController) handleOpenLogMenu() error {
{
Label: "topological (topo-order)",
OnPress: onPress("topo-order"),
Widget: types.MakeMenuRadioButton(currentValue == "topo-order"),
},
{
Label: "date-order",
OnPress: onPress("date-order"),
Widget: types.MakeMenuRadioButton(currentValue == "date-order"),
},
{
Label: "author-date-order",
OnPress: onPress("author-date-order"),
Widget: types.MakeMenuRadioButton(currentValue == "author-date-order"),
},
},
})