Fix #136: add context menu to album and playlist grid views

This commit is contained in:
Drew Weymouth
2023-05-02 17:50:35 -07:00
parent 118b19aa13
commit 76657b5c1c
10 changed files with 122 additions and 97 deletions
+2 -18
View File
@@ -53,9 +53,7 @@ func NewGenrePage(genre string, contr *controller.Controller, pm *backend.Playba
g.playRandom = widget.NewButtonWithIcon("Play random", res.ResShuffleInvertSvg, g.playRandomSongs)
iter := g.lm.GenreIter(g.genre)
g.grid = widgets.NewGridView(widgets.NewGridViewAlbumIterator(iter), g.im)
g.grid.OnPlay = g.onPlayAlbum
g.grid.OnShowSecondaryPage = g.onShowArtistPage
g.grid.OnShowItemPage = g.onShowAlbumPage
g.contr.ConnectAlbumGridActions(g.grid)
g.searcher = widgets.NewSearcher()
g.searcher.OnSearched = g.OnSearched
g.createContainer(false)
@@ -146,18 +144,6 @@ func (g *GenrePage) SearchWidget() fyne.Focusable {
return g.searcher.Entry
}
func (a *GenrePage) onPlayAlbum(albumID string) {
go a.pm.PlayAlbum(albumID, 0)
}
func (a *GenrePage) onShowArtistPage(artistID string) {
a.contr.NavigateTo(controller.ArtistRoute(artistID))
}
func (a *GenrePage) onShowAlbumPage(albumID string) {
a.contr.NavigateTo(controller.AlbumRoute(albumID))
}
func (g *GenrePage) OnSearched(query string) {
g.searchText = query
if query == "" {
@@ -177,9 +163,7 @@ func (g *GenrePage) doSearch(query string) {
})
if g.searchGrid == nil {
g.searchGrid = widgets.NewGridView(widgets.NewGridViewAlbumIterator(iter), g.im)
g.searchGrid.OnPlay = g.onPlayAlbum
g.searchGrid.OnShowItemPage = g.onShowAlbumPage
g.searchGrid.OnShowSecondaryPage = g.onShowArtistPage
g.contr.ConnectAlbumGridActions(g.searchGrid)
} else {
g.searchGrid.Reset(widgets.NewGridViewAlbumIterator(iter))
}