make artist and album hyperlinks in tracklist; refactor navigation to the controller package
This commit is contained in:
@@ -16,9 +16,16 @@ import (
|
||||
"github.com/dweymouth/go-subsonic/subsonic"
|
||||
)
|
||||
|
||||
type NavigationHandler func(Route)
|
||||
|
||||
type Controller struct {
|
||||
MainWindow fyne.Window
|
||||
App *backend.App
|
||||
NavHandler NavigationHandler
|
||||
}
|
||||
|
||||
func (m Controller) NavigateTo(route Route) {
|
||||
m.NavHandler(route)
|
||||
}
|
||||
|
||||
func (m Controller) ShowPopUpImage(img image.Image) {
|
||||
@@ -66,6 +73,12 @@ func (m Controller) ConnectTracklistActions(tracklist *widgets.Tracklist) {
|
||||
m.App.PlaybackManager.OnTrackFavoriteStatusChanged(id, fav)
|
||||
}
|
||||
}
|
||||
tracklist.OnShowAlbumPage = func(albumID string) {
|
||||
m.NavigateTo(AlbumRoute(albumID))
|
||||
}
|
||||
tracklist.OnShowArtistPage = func(artistID string) {
|
||||
m.NavigateTo(ArtistRoute(artistID))
|
||||
}
|
||||
}
|
||||
|
||||
func (m Controller) PromptForFirstServer() {
|
||||
|
||||
Reference in New Issue
Block a user