mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Have checkbox config work as intended
Support checkedIcon Also support uncheckedIcon Addresses the end of #616
This commit is contained in:
parent
ca0345a0b4
commit
2c1e7fc2c9
@ -13,15 +13,21 @@ const (
|
|||||||
type Settings struct {
|
type Settings struct {
|
||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
|
|
||||||
filePath string
|
filePath string
|
||||||
|
checked string
|
||||||
|
unchecked string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
common := cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig)
|
||||||
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
|
|
||||||
|
|
||||||
filePath: ymlConfig.UString("filename"),
|
settings := Settings{
|
||||||
|
common: common,
|
||||||
|
|
||||||
|
filePath: ymlConfig.UString("filename"),
|
||||||
|
checked: ymlConfig.UString("checkedIcon", common.Checkbox.Checked),
|
||||||
|
unchecked: ymlConfig.UString("uncheckedIcon", common.Checkbox.Unchecked),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &settings
|
return &settings
|
||||||
|
@ -155,8 +155,8 @@ func (widget *Widget) persist() {
|
|||||||
// items have the correct checked/unchecked icon per the user's preferences
|
// items have the correct checked/unchecked icon per the user's preferences
|
||||||
func (widget *Widget) setItemChecks() {
|
func (widget *Widget) setItemChecks() {
|
||||||
for _, item := range widget.list.Items {
|
for _, item := range widget.list.Items {
|
||||||
item.CheckedIcon = widget.settings.common.Checkbox.Checked
|
item.CheckedIcon = widget.settings.checked
|
||||||
item.UncheckedIcon = widget.settings.common.Checkbox.Unchecked
|
item.UncheckedIcon = widget.settings.unchecked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user