reuse context menu across both types of tracklist

This commit is contained in:
Drew Weymouth
2025-03-26 17:06:56 -07:00
parent 5c88180d69
commit 9ddb5e6e69
3 changed files with 67 additions and 106 deletions
+12
View File
@@ -9,6 +9,8 @@ import (
"github.com/dweymouth/supersonic/sharedutil"
"github.com/dweymouth/supersonic/ui/widgets"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/lang"
"fyne.io/fyne/v2/widget"
)
@@ -179,4 +181,14 @@ func (c *Controller) ConnectPlayQueuelistActions(list *widgets.PlayQueueList) {
}
list.OnSetRating = c.SetTrackRatings
list.OnSetFavorite = c.SetTrackFavorites
list.OnPlaySongRadio = func(track *mediaprovider.Track) {
go func() {
if err := c.App.PlaybackManager.PlaySimilarSongs(track.ID); err != nil {
fyne.Do(func() {
c.ToastProvider.ShowErrorToast(lang.L("Unable to play song radio"))
})
}
}()
}
list.OnShowTrackInfo = c.ShowTrackInfoDialog
}