Fix #700: add Song Radio context menu item to play queue list
This commit is contained in:
@@ -31,6 +31,12 @@ func NewTrackContextMenu(disablePlaybackMenu bool, auxItems []*fyne.MenuItem) *T
|
|||||||
tcm := &TrackContextMenu{}
|
tcm := &TrackContextMenu{}
|
||||||
|
|
||||||
tcm.menu = fyne.NewMenu("")
|
tcm.menu = fyne.NewMenu("")
|
||||||
|
tcm.songRadioMenuItem = fyne.NewMenuItem(lang.L("Play song radio"), func() {
|
||||||
|
if tcm.OnPlaySongRadio != nil {
|
||||||
|
tcm.OnPlaySongRadio()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
tcm.songRadioMenuItem.Icon = myTheme.RadioIcon
|
||||||
if !disablePlaybackMenu {
|
if !disablePlaybackMenu {
|
||||||
play := fyne.NewMenuItem(lang.L("Play"), func() {
|
play := fyne.NewMenuItem(lang.L("Play"), func() {
|
||||||
if tcm.OnPlay != nil {
|
if tcm.OnPlay != nil {
|
||||||
@@ -56,12 +62,6 @@ func NewTrackContextMenu(disablePlaybackMenu bool, auxItems []*fyne.MenuItem) *T
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
add.Icon = theme.ContentAddIcon()
|
add.Icon = theme.ContentAddIcon()
|
||||||
tcm.songRadioMenuItem = fyne.NewMenuItem(lang.L("Play song radio"), func() {
|
|
||||||
if tcm.OnPlaySongRadio != nil {
|
|
||||||
tcm.OnPlaySongRadio()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
tcm.songRadioMenuItem.Icon = myTheme.RadioIcon
|
|
||||||
tcm.menu.Items = append(tcm.menu.Items,
|
tcm.menu.Items = append(tcm.menu.Items,
|
||||||
play, shuffle, playNext, add, tcm.songRadioMenuItem)
|
play, shuffle, playNext, add, tcm.songRadioMenuItem)
|
||||||
}
|
}
|
||||||
@@ -104,6 +104,9 @@ func NewTrackContextMenu(disablePlaybackMenu bool, auxItems []*fyne.MenuItem) *T
|
|||||||
})
|
})
|
||||||
tcm.shareMenuItem.Icon = myTheme.ShareIcon
|
tcm.shareMenuItem.Icon = myTheme.ShareIcon
|
||||||
tcm.menu.Items = append(tcm.menu.Items, tcm.shareMenuItem)
|
tcm.menu.Items = append(tcm.menu.Items, tcm.shareMenuItem)
|
||||||
|
if disablePlaybackMenu {
|
||||||
|
tcm.menu.Items = append(tcm.menu.Items, tcm.songRadioMenuItem)
|
||||||
|
}
|
||||||
tcm.menu.Items = append(tcm.menu.Items, fyne.NewMenuItemSeparator())
|
tcm.menu.Items = append(tcm.menu.Items, fyne.NewMenuItemSeparator())
|
||||||
tcm.menu.Items = append(tcm.menu.Items, favorite, unfavorite)
|
tcm.menu.Items = append(tcm.menu.Items, favorite, unfavorite)
|
||||||
tcm.ratingSubmenu = NewRatingSubmenu(func(rating int) {
|
tcm.ratingSubmenu = NewRatingSubmenu(func(rating int) {
|
||||||
|
|||||||
@@ -41,10 +41,6 @@ type TracklistOptions struct {
|
|||||||
// must be set before the context menu is shown for the first time
|
// must be set before the context menu is shown for the first time
|
||||||
AuxiliaryMenuItems []*fyne.MenuItem
|
AuxiliaryMenuItems []*fyne.MenuItem
|
||||||
|
|
||||||
// DisablePlaybackMenu sets whether to disable playback options in
|
|
||||||
// the tracklist context menu.
|
|
||||||
DisablePlaybackMenu bool
|
|
||||||
|
|
||||||
// Disables sorting the tracklist by clicking individual columns.
|
// Disables sorting the tracklist by clicking individual columns.
|
||||||
DisableSorting bool
|
DisableSorting bool
|
||||||
|
|
||||||
@@ -518,7 +514,7 @@ func (t *Tracklist) onShowContextMenu(e *fyne.PointEvent, trackIdx int) {
|
|||||||
t.list.Refresh()
|
t.list.Refresh()
|
||||||
}
|
}
|
||||||
if t.ctxMenu == nil {
|
if t.ctxMenu == nil {
|
||||||
t.ctxMenu = util.NewTrackContextMenu(t.Options.DisablePlaybackMenu, t.Options.AuxiliaryMenuItems)
|
t.ctxMenu = util.NewTrackContextMenu(false, t.Options.AuxiliaryMenuItems)
|
||||||
t.ctxMenu.OnPlay = func(shuffle bool) {
|
t.ctxMenu.OnPlay = func(shuffle bool) {
|
||||||
t.OnPlaySelection(t.SelectedTracks(), shuffle)
|
t.OnPlaySelection(t.SelectedTracks(), shuffle)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user