make artist and album hyperlinks in tracklist; refactor navigation to the controller package

This commit is contained in:
Drew Weymouth
2023-02-23 17:23:14 -08:00
parent 6682e3923e
commit d01ac697bd
16 changed files with 218 additions and 195 deletions
+13
View File
@@ -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() {