Clean up the options flow handlers a tiny bit
This commit is contained in:
@@ -11,8 +11,8 @@ func (f *Flow) linkOptions() {
|
||||
f.configureSlider(options, "2.10", v10Slider) // Music volume slider
|
||||
f.configureSlider(options, "2.11", v10Slider) // SFX volume slider
|
||||
|
||||
f.onClick(options, "2.12", f.acceptOptions()) // OK button
|
||||
f.onClick(options, "2.24", f.cancelOptions()) // Cancel button
|
||||
f.onClick(options, "2.12", f.acceptOptions) // OK button
|
||||
f.onClick(options, "2.24", f.cancelOptions) // Cancel button
|
||||
|
||||
f.configureSlider(options, "2.26", h9Slider) // Unit speed slider
|
||||
f.configureSlider(options, "2.27", h9Slider) // Animation speed slider
|
||||
@@ -21,12 +21,11 @@ func (f *Flow) linkOptions() {
|
||||
// TODO: implement keybindings save/load behaviour
|
||||
f.onClick(kbd, "3.1", f.setDriver(options)) // Done button
|
||||
f.onClick(kbd, "3.2", f.setDriver(options)) // Cancel button
|
||||
f.onClick(kbd, "3.4", func() {}) // Reset to defaults button
|
||||
f.onClick(kbd, "3.4", func() {}) // TODO: Reset to defaults button
|
||||
}
|
||||
|
||||
// FIXME: exiting is a bit OTT. Perhaps display "save failed"?
|
||||
func (f *Flow) acceptOptions() func() {
|
||||
return func() {
|
||||
func (f *Flow) acceptOptions() {
|
||||
if err := f.optionsIntoConfig(); err != nil {
|
||||
log.Printf("Saving options to config failed: %v", err)
|
||||
f.exit = err
|
||||
@@ -34,12 +33,10 @@ func (f *Flow) acceptOptions() func() {
|
||||
f.setDriverNow(main)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: again, exiting is OTT. We're just resetting the state of
|
||||
// the interface to the values in config.
|
||||
func (f *Flow) cancelOptions() func() {
|
||||
return func() {
|
||||
func (f *Flow) cancelOptions() {
|
||||
if err := f.configIntoOptions(); err != nil {
|
||||
log.Printf("Saving options to config failed: %v", err)
|
||||
f.exit = err
|
||||
@@ -47,7 +44,6 @@ func (f *Flow) cancelOptions() func() {
|
||||
f.exit = f.returnToLastDriverNow(options)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (f *Flow) configIntoOptions() error {
|
||||
var err error
|
||||
|
Reference in New Issue
Block a user