Ability to download from grid

- Adding the option to download the album or tracks in grid view from Artist and Album pages.
This commit is contained in:
natilou
2023-06-20 12:35:59 -03:00
parent 7f907267fa
commit 0dfbe685e1
3 changed files with 27 additions and 1 deletions
+9 -1
View File
@@ -129,6 +129,7 @@ type GridViewItem struct {
OnPlay func(shuffle bool)
OnAddToQueue func()
OnAddToPlaylist func()
OnDownload func()
OnShowItemPage func()
OnShowSecondaryPage func()
}
@@ -173,7 +174,8 @@ func (g *GridViewItem) showContextMenu(pos fyne.Position) {
fyne.NewMenuItem("Play", func() { g.onPlay(false) }),
fyne.NewMenuItem("Shuffle", func() { g.onPlay(true) }),
fyne.NewMenuItem("Add to queue", g.onAddToQueue),
fyne.NewMenuItem("Add to playlist...", g.onAddToPlaylist)),
fyne.NewMenuItem("Add to playlist...", g.onAddToPlaylist),
fyne.NewMenuItem("Download", g.onDownload)),
fyne.CurrentApp().Driver().CanvasForObject(g))
}
g.menu.ShowAtPosition(pos)
@@ -218,3 +220,9 @@ func (g *GridViewItem) onAddToPlaylist() {
g.OnAddToPlaylist()
}
}
func (g *GridViewItem) onDownload() {
if g.OnDownload != nil {
g.OnDownload()
}
}