Skip to content

Commit

Permalink
Have checkbox config work as intended
Browse files Browse the repository at this point in the history
Support checkedIcon
Also support uncheckedIcon
Addresses the end of wtfutil#616
  • Loading branch information
Seanstoppable committed Oct 2, 2019
1 parent ca0345a commit 2c1e7fc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions modules/todo/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

common := cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig)

settings := Settings{
common: cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig),
common: common,

filePath: ymlConfig.UString("filename"),
filePath: ymlConfig.UString("filename"),
checked: ymlConfig.UString("checkedIcon", common.Checkbox.Checked),
unchecked: ymlConfig.UString("uncheckedIcon", common.Checkbox.Unchecked),
}

return &settings
Expand Down
4 changes: 2 additions & 2 deletions modules/todo/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit 2c1e7fc

Please sign in to comment.