Refactor and temporarily disable sharing artists
This commit is contained in:
+10
-13
@@ -94,9 +94,9 @@ func newAlbumPage(
|
||||
a.tracklist.SetVisibleColumns(a.cfg.TracklistColumns)
|
||||
a.tracklist.SetSorting(sort)
|
||||
_, canRate := a.mp.(mediaprovider.SupportsRating)
|
||||
_, canShare := a.mp.(mediaprovider.SupportsRating)
|
||||
_, canShare := a.mp.(mediaprovider.SupportsSharing)
|
||||
a.tracklist.Options.DisableRating = !canRate
|
||||
a.tracklist.Options.HideSharing = !canShare
|
||||
a.tracklist.Options.DisableSharing = !canShare
|
||||
a.tracklist.OnVisibleColumnsChanged = func(cols []string) {
|
||||
a.cfg.TracklistColumns = cols
|
||||
}
|
||||
@@ -185,6 +185,7 @@ type AlbumPageHeader struct {
|
||||
artistLabelSpace *util.HSpace // TODO: remove when no longer needed
|
||||
genreLabel *widgets.MultiHyperlink
|
||||
miscLabel *widget.Label
|
||||
shareMenuItem *fyne.MenuItem
|
||||
|
||||
toggleFavButton *widgets.FavoriteButton
|
||||
|
||||
@@ -248,19 +249,15 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader {
|
||||
a.page.contr.ShowAlbumInfoDialog(a.albumID, a.titleLabel.String(), a.cover.Image())
|
||||
})
|
||||
info.Icon = theme.InfoIcon()
|
||||
menuItems := []*fyne.MenuItem{queue, playlist, download, info}
|
||||
|
||||
_, canShare := page.mp.(mediaprovider.SupportsSharing)
|
||||
if canShare {
|
||||
share := fyne.NewMenuItem("Share...", func() {
|
||||
a.page.contr.ShowShareDialog(a.albumID)
|
||||
})
|
||||
share.Icon = myTheme.ShareIcon
|
||||
menuItems = append(menuItems, share)
|
||||
}
|
||||
menu := fyne.NewMenu("", menuItems...)
|
||||
a.shareMenuItem = fyne.NewMenuItem("Share...", func() {
|
||||
a.page.contr.ShowShareDialog(a.albumID)
|
||||
})
|
||||
a.shareMenuItem.Icon = myTheme.ShareIcon
|
||||
menu := fyne.NewMenu("", queue, playlist, download, info, a.shareMenuItem)
|
||||
pop = widget.NewPopUpMenu(menu, fyne.CurrentApp().Driver().CanvasForObject(a))
|
||||
}
|
||||
_, canShare := page.mp.(mediaprovider.SupportsSharing)
|
||||
a.shareMenuItem.Disabled = !canShare
|
||||
pos := fyne.CurrentApp().Driver().AbsolutePositionForObject(menuBtn)
|
||||
pop.ShowAtPosition(fyne.NewPos(pos.X, pos.Y+menuBtn.Size().Height))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user