1
0
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:
Sean Smith 2019-10-02 17:40:27 -04:00
parent ca0345a0b4
commit 2c1e7fc2c9
2 changed files with 12 additions and 6 deletions

View File

@ -13,15 +13,21 @@ const (
type Settings struct {
common *cfg.Common
filePath string
filePath string
checked string
unchecked string
}
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

View File

@ -155,8 +155,8 @@ func (widget *Widget) persist() {
// items have the correct checked/unchecked icon per the user's preferences
func (widget *Widget) setItemChecks() {
for _, item := range widget.list.Items {
item.CheckedIcon = widget.settings.common.Checkbox.Checked
item.UncheckedIcon = widget.settings.common.Checkbox.Unchecked
item.CheckedIcon = widget.settings.checked
item.UncheckedIcon = widget.settings.unchecked
}
}