persist tracklist column visibility change immediately

This commit is contained in:
Drew Weymouth
2023-04-21 19:13:48 -07:00
parent 2f14a09cd8
commit 1171916449
7 changed files with 31 additions and 17 deletions
+3 -7
View File
@@ -108,13 +108,6 @@ func (a *ArtistPage) Reload() {
}
func (a *ArtistPage) Save() SavedPage {
// TODO: find a better place to update the tracklist columns preference
// If user changes columns but doesn't navigate to another page,
// we won't be persisting the change
if a.tracklistCtr != nil {
tl := a.tracklistCtr.Objects[0].(*widgets.Tracklist)
a.cfg.TracklistColumns = tl.VisibleColumns()
}
s := a.artistPageState
return &s
}
@@ -192,6 +185,9 @@ func (a *ArtistPage) showTopTracks() {
tl := widgets.NewTracklist(ts)
tl.AutoNumber = true
tl.SetVisibleColumns(a.cfg.TracklistColumns)
tl.OnVisibleColumnsChanged = func(cols []string) {
a.cfg.TracklistColumns = cols
}
tl.SetNowPlaying(a.nowPlayingID)
a.contr.ConnectTracklistActions(tl)
a.tracklistCtr = container.New(