From 6318ce33e4aab1b158b69aa1b148a3ad96a63b0e Mon Sep 17 00:00:00 2001 From: natilou <30585029+natilou@users.noreply.github.com> Date: Wed, 21 Jun 2023 23:35:56 -0300 Subject: [PATCH] getting the album name from titleLabel and adding ellipsis after 'Download' option --- ui/browsing/albumpage.go | 11 +++-------- ui/browsing/playlistpage.go | 2 +- ui/widgets/gridviewitem.go | 2 +- ui/widgets/tracklist.go | 2 +- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/ui/browsing/albumpage.go b/ui/browsing/albumpage.go index d532228..22c3f62 100644 --- a/ui/browsing/albumpage.go +++ b/ui/browsing/albumpage.go @@ -201,14 +201,9 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader { a.page.contr.DoAddTracksToPlaylistWorkflow( sharedutil.TracksToIDs(a.page.tracks)) }), - fyne.NewMenuItem("Download", func() { - go func() { - album, err := a.page.mp.GetAlbum(a.albumID) - if err != nil { - log.Print("Error while getting the album: ", album) - } - a.page.contr.ShowDownloadDialog(a.page.tracks, album.Name) - }() + fyne.NewMenuItem("Download...", func() { + a.page.contr.ShowDownloadDialog(a.page.tracks, a.titleLabel.String()) + })) pop = widget.NewPopUpMenu(menu, fyne.CurrentApp().Driver().CanvasForObject(a)) } diff --git a/ui/browsing/playlistpage.go b/ui/browsing/playlistpage.go index 99ec63b..39d5182 100644 --- a/ui/browsing/playlistpage.go +++ b/ui/browsing/playlistpage.go @@ -261,7 +261,7 @@ func NewPlaylistPageHeader(page *PlaylistPage) *PlaylistPageHeader { a.page.contr.DoAddTracksToPlaylistWorkflow( sharedutil.TracksToIDs(a.page.tracks)) }), - fyne.NewMenuItem("Download", func() { + fyne.NewMenuItem("Download...", func() { a.page.contr.ShowDownloadDialog(a.page.tracks, a.playlistInfo.Name) })) pop = widget.NewPopUpMenu(menu, fyne.CurrentApp().Driver().CanvasForObject(a)) diff --git a/ui/widgets/gridviewitem.go b/ui/widgets/gridviewitem.go index 02e4894..edd3cba 100644 --- a/ui/widgets/gridviewitem.go +++ b/ui/widgets/gridviewitem.go @@ -175,7 +175,7 @@ func (g *GridViewItem) showContextMenu(pos fyne.Position) { fyne.NewMenuItem("Shuffle", func() { g.onPlay(true) }), fyne.NewMenuItem("Add to queue", g.onAddToQueue), fyne.NewMenuItem("Add to playlist...", g.onAddToPlaylist), - fyne.NewMenuItem("Download", g.onDownload)), + fyne.NewMenuItem("Download...", g.onDownload)), fyne.CurrentApp().Driver().CanvasForObject(g)) } g.menu.ShowAtPosition(pos) diff --git a/ui/widgets/tracklist.go b/ui/widgets/tracklist.go index edf0a9a..65bebda 100644 --- a/ui/widgets/tracklist.go +++ b/ui/widgets/tracklist.go @@ -510,7 +510,7 @@ func (t *Tracklist) onShowContextMenu(e *fyne.PointEvent, trackIdx int) { } })) t.ctxMenu.Items = append(t.ctxMenu.Items, - fyne.NewMenuItem("Download", func() { + fyne.NewMenuItem("Download...", func() { t.onDownload(t.selectedTracks(), "Selected tracks") })) t.ctxMenu.Items = append(t.ctxMenu.Items, fyne.NewMenuItemSeparator())