diff --git a/res/bundled.go b/res/bundled.go
index 154b27b..4956f1a 100644
--- a/res/bundled.go
+++ b/res/bundled.go
@@ -20,6 +20,11 @@ var ResPlaybuttonPng = &fyne.StaticResource{
StaticContent: []byte(
"\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x80\x00\x00\x00\x80\b\x03\x00\x00\x00\xf4\xe0\x91\xf9\x00\x00\x00\x04gAMA\x00\x00\xb1\x8f\v\xfca\x05\x00\x00\x00 cHRM\x00\x00z&\x00\x00\x80\x84\x00\x00\xfa\x00\x00\x00\x80\xe8\x00\x00u0\x00\x00\xea`\x00\x00:\x98\x00\x00\x17p\x9c\xbaQ<\x00\x00\x01\xcePLTE\x00\x00\x00\"\xd7)!\xd3(#\xe2+!\xd6( \xce'\"\xd9)!\xd5(\"\xd6)\x1b\xae!!\xd2(\"\xd8)\x1b\xb0!\"\xd8)!\xd5(!\xd5(\"\xd7)!\xd6(!\xd6(!\xd6(!\xd6(\"\xd7)!\xd6(\"\xdb)!\xd6(!\xd6(!\xd6(!\xd6(!\xd6(\"\xd7)\"\xd6)\"\xd6)\"\xd7)!\xd6(!\xd6(!\xd6(!\xd6(!\xd6(\"\xd7)!\xd6(!\xd5(!\xd6(\"\xd7)!\xd6(#\xde*!\xd5(!\xd6(!\xd6(!\xd6( \xcd'!\xd3(!\xd6(!\xd6(!\xd2(!\xd5(!\xd6(!\xd6(!\xd6(!\xd6(\"\xd7)!\xd6(!\xd6(\"\xd7)!\xd6(!\xd5(!\xd6(\"\xd6)\"\xd7)\"\xd6)!\xd6(!\xd6(\"\xd6)!\xd6(!\xd5(!\xd6(\"\xd6)!\xd6(!\xd6(!\xd6(\"\xd6)!\xd5(!\xd6(\"\xd6)\"\xd7)\"\xd7)!\xd6(\"\xd7)!\xd6(!\xd5(\"\xd6)!\xd6(!\xd5(\"\xd7)!\xd6(!\xd6(!\xd6(!\xd6(!\xd5(!\xd6(!\xd4(!\xd6(!\xd5(!\xd6(!\xd6(!\x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f2'\xc4\xe6\xb4\x1c\x9b\x80\xa9V\x83\xdf\x00\xfeRZ\xa7\x8eLB\xb4\xf9f[\xf8\xfc\ti\xbbi\x8e>\x1c\x80[\x8da\xca@\x9f\\\x8d\xb7\x0e\x85 &V\xe6\xda\x7f\xb0\xabI\x8e\x8d\xf1\x030U\xde\x0e\xaf?!\xb7+\xfd\xb6\x8dX\x9a\xbe\x13n\x80;\xd3~\x8bT\xd3\xccl\xb8\xfd\t\x99\x9d1\x1d\x04@\x0e{\x00ݢ\x8d\x81A\x00\xea6\xed\xc2\xdd(\x80\x9d\xdd\xff\x1d\x00z\n\x80\x93\x90\xe9o\b\xfe\"\x02\x7f\x15\x83\x7f\x8c\xc0?\xc7\xe0\v\x12\xf0%\x19\xf8\xa2\x14|Y\x0e\xbe1\x01ߚ\x81oN\xc1\xb7\xe7\xe0\a\x14\xe0G4\xe0\x87T\xe0\xc7t\xf0\a\x95\xe0G\xb5\xe0\x87\xd5\xcc\xc7\xf5\xbfwv\xfe\b=\xaeg\xbe\xb0\xd8\xdd\x15{a\x01\x7fe\x03~i\x05~m\a\x7fq\t~u\v\x7fy\r~}\x0f_\xc0\x00^\xc2\x01_\xc4\x02_\xc6\x03^\xc8\x04_\xca\x05_\xcc\x06^\xce\a_\xd0\b_\xd2\t_\xd4\n^\xd6\v_\xd8\f_\xda\r_\xdc\x0e_\xde\x0f\xdf\xe0\x00\xdf\xe2\x81\xc0\x9b\\\x10|\x9b\x0f|\xa3\x13\x02o\xf5B\xf0\xcdn\b\xbc\xdd\x0f\xc17<\"\xf0\x96O/\x02lӫw\"`\xdb~}\f\xa0\x8d\xcf>\x04\xd8\xd6o\x1f\x03h\xf3\xfb>\x84\xe0\xf6\xff\xbfN\xd2\xc9+\xf1{\x02!\x00\x00\x00%tEXtdate:create\x002023-01-19T01:37:03+00:00/\x9b0\x17\x00\x00\x00%tEXtdate:modify\x002023-01-19T01:36:39+00:00\x9b\xfb\xbb8\x00\x00\x00\x00IEND\xaeB`\x82"),
}
+var ResLibrarySvg = &fyne.StaticResource{
+ StaticName: "library.svg",
+ StaticContent: []byte(
+ "\n"),
+}
var ResCastSvg = &fyne.StaticResource{
StaticName: "cast.svg",
StaticContent: []byte(
diff --git a/res/bundled_gen.sh b/res/bundled_gen.sh
index 9470b62..2792568 100755
--- a/res/bundled_gen.sh
+++ b/res/bundled_gen.sh
@@ -3,6 +3,7 @@
fyne bundle -package res -prefix Res appicon-256.png > bundled.go
fyne bundle -append -prefix Res icons/coreui/playlist-add-next.svg >> bundled.go
fyne bundle -append -prefix Res icons/freepik/playbutton.png >> bundled.go
+fyne bundle -append -prefix Res icons/majesticons/library.svg >> bundled.go
fyne bundle -append -prefix Res icons/publicdomain/cast.svg >> bundled.go
fyne bundle -append -prefix Res icons/publicdomain/disc.svg >> bundled.go
fyne bundle -append -prefix Res icons/publicdomain/headphones.svg >> bundled.go
diff --git a/res/icons/majesticons/icons-attrib.txt b/res/icons/majesticons/icons-attrib.txt
new file mode 100644
index 0000000..ae0e1f4
--- /dev/null
+++ b/res/icons/majesticons/icons-attrib.txt
@@ -0,0 +1,3 @@
+These icons are from the Majesticons Solid Interface Icons collection by halfmage on svgrepo.com and are available under the MIT license
+
+https://www.svgrepo.com/page/licensing/#MIT
diff --git a/res/icons/majesticons/library.svg b/res/icons/majesticons/library.svg
new file mode 100644
index 0000000..080de51
--- /dev/null
+++ b/res/icons/majesticons/library.svg
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/res/translations/en.json b/res/translations/en.json
index e72fe8f..1170cff 100644
--- a/res/translations/en.json
+++ b/res/translations/en.json
@@ -15,6 +15,7 @@
"Albums": "Albums",
"albums": "albums",
"All": "All",
+ "All Libraries": "All Libraries",
"All Tracks": "All Tracks",
"Allow multiple app instances": "Allow multiple app instances",
"Alt. URL": "Alt. URL",
@@ -182,6 +183,7 @@
"Search page": "Search page",
"Search playlists or new playlist name": "Search playlists or new playlist name",
"sec": "sec",
+ "Select Library": "Select Library",
"selected": "selected",
"Send playback statistics to server": "Send playback statistics to server",
"Server": "Server",
diff --git a/ui/browsing/browsingpane.go b/ui/browsing/browsingpane.go
index a1956c3..e666ae7 100644
--- a/ui/browsing/browsingpane.go
+++ b/ui/browsing/browsingpane.go
@@ -153,6 +153,14 @@ func (b *BrowsingPane) AddSettingsSubmenu(label string, icon fyne.Resource, menu
b.settingsMenu.Items = append(b.settingsMenu.Items, item)
}
+func (b *BrowsingPane) SetSubmenuForMenuItem(label string, submenu *fyne.Menu) {
+ for _, item := range b.settingsMenu.Items {
+ if item.Label == label {
+ item.ChildMenu = submenu
+ }
+ }
+}
+
func (b *BrowsingPane) AddSettingsMenuSeparator() {
b.settingsMenu.Items = append(b.settingsMenu.Items,
fyne.NewMenuItemSeparator())
diff --git a/ui/mainwindow.go b/ui/mainwindow.go
index 52d4fc7..c77b98d 100644
--- a/ui/mainwindow.go
+++ b/ui/mainwindow.go
@@ -43,8 +43,11 @@ type MainWindow struct {
alreadyConnected bool // tracks if we have already connected to a server before
content *mainWindowContent
- // needs to bes shown/hidden when switching between servers based on whether they support radio
+ // needs to be shown/hidden when switching between servers based on whether they support radio
radioBtn fyne.CanvasObject
+
+ // updated when changing servers or libraries
+ librarySubmenu *fyne.Menu
}
func NewMainWindow(fyneApp fyne.App, appName, displayAppName, appVersion string, app *backend.App) MainWindow {
@@ -102,6 +105,8 @@ func NewMainWindow(fyneApp fyne.App, appName, displayAppName, appVersion string,
})
m.BrowsingPane.AddSettingsMenuItem(lang.L("Log Out"), theme.LogoutIcon(), func() { app.ServerManager.Logout(true) })
m.BrowsingPane.AddSettingsMenuItem(lang.L("Switch Servers"), theme.LoginIcon(), func() { app.ServerManager.Logout(false) })
+ m.BrowsingPane.AddSettingsSubmenu(lang.L("Select Library"), myTheme.LibraryIcon, fyne.NewMenu("",
+ fyne.NewMenuItem(lang.L("All Libraries"), func() { /* dummy - will get replaced on server login */ })))
m.BrowsingPane.AddSettingsMenuItem(lang.L("Rescan Library"), theme.ViewRefreshIcon(), func() { app.ServerManager.Server.RescanLibrary() })
m.BrowsingPane.AddSettingsMenuSeparator()
m.BrowsingPane.AddSettingsSubmenu(lang.L("Visualizations"), myTheme.VisualizationIcon,
@@ -229,6 +234,49 @@ func (m *MainWindow) RunOnServerConnectedTasks(app *backend.App, displayAppName
}()
}
+ doSetLibrary := func(libraryID string, menuIdx int) {
+ fyne.Do(func() {
+ m.App.ServerManager.Server.SetLibrary(libraryID)
+ // Pages in the history could contain content
+ // outside the new library, so clear history
+ m.BrowsingPane.ClearHistory()
+ // ... and reload current page for the same reason
+ m.BrowsingPane.Reload()
+ // check only the menu item for the new library
+ for i, menuItem := range m.librarySubmenu.Items {
+ menuItem.Checked = (i == menuIdx)
+ }
+ })
+ }
+
+ libraries, err := app.ServerManager.Server.GetLibraries()
+ if err != nil {
+ log.Printf("error loading server libraries: %s", err.Error())
+ }
+ libraryMenu := fyne.NewMenu("")
+ libraryMenuItemOffset := 0
+ if len(libraries) != 1 {
+ // If there is exactly one library in the list,
+ // we just want to have one menu entry with that library's name.
+ // Otherwise, add the "All Libraries" menu item at the top.
+ libraryMenu.Items = append(libraryMenu.Items,
+ fyne.NewMenuItem(lang.L("All Libraries"), func() {
+ doSetLibrary("", 0)
+ }))
+ libraryMenuItemOffset = 1
+ }
+ for i, l := range libraries {
+ _l := l
+ _i := i + libraryMenuItemOffset
+ libraryMenu.Items = append(libraryMenu.Items,
+ fyne.NewMenuItem(_l.Name, func() {
+ doSetLibrary(_l.ID, _i)
+ }))
+ }
+ m.librarySubmenu = libraryMenu
+ m.librarySubmenu.Items[0].Checked = true
+ m.BrowsingPane.SetSubmenuForMenuItem(lang.L("Select Library"), libraryMenu)
+
fyne.Do(func() {
m.BrowsingPane.EnableNavigationButtons()
m.Router.NavigateTo(m.StartupPage())
diff --git a/ui/theme/theme.go b/ui/theme/theme.go
index 3ff3f13..feb3435 100644
--- a/ui/theme/theme.go
+++ b/ui/theme/theme.go
@@ -62,6 +62,7 @@ var (
RepeatOneIcon fyne.Resource = theme.NewThemedResource(res.ResRepeatoneSvg)
SortIcon fyne.Resource = theme.NewThemedResource(res.ResUpdownarrowSvg)
VisualizationIcon fyne.Resource = theme.NewThemedResource(res.ResOscilloscopeSvg)
+ LibraryIcon fyne.Resource = theme.NewThemedResource(res.ResLibrarySvg)
)
type AppearanceMode string