1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

WTF-400 Checklist items now have dynamically-settable checkmark icons

This commit is contained in:
Chris Cummer 2019-04-19 09:08:36 -07:00
parent 59f0bc6cfc
commit 643840e0da

View File

@ -193,7 +193,10 @@ func (widget *Widget) load() {
filePath := fmt.Sprintf("%s/%s", confDir, widget.filePath)
fileData, _ := wtf.ReadFileBytes(filePath)
yaml.Unmarshal(fileData, &widget.list)
widget.setItemChecks()
}
func (widget *Widget) newItem() {
@ -227,6 +230,15 @@ func (widget *Widget) persist() {
}
}
// setItemChecks rolls through the checklist and ensures that all checklist
// 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.CheckedIcon
item.UncheckedIcon = widget.settings.common.UncheckedIcon
}
}
/* -------------------- Modal Form -------------------- */
func (widget *Widget) addButtons(form *tview.Form, saveFctn func()) {