add album filters to genre page

This commit is contained in:
Drew Weymouth
2023-05-12 09:22:49 -07:00
parent 85701c568c
commit 4730b74039
3 changed files with 46 additions and 30 deletions
+8 -2
View File
@@ -17,7 +17,8 @@ import (
type AlbumFilterButton struct {
widget.Button
OnChanged func()
OnChanged func()
GenreDisabled bool
filter *backend.AlbumFilter
dialog *widget.PopUp
@@ -36,7 +37,7 @@ func NewAlbumFilterButton(filter *backend.AlbumFilter) *AlbumFilterButton {
}
func (a *AlbumFilterButton) Refresh() {
if a.filter.IsEmpty() {
if a.filter.IsEmpty() || (a.GenreDisabled && a.filterEmptyExceptGenre()) {
a.Importance = widget.MediumImportance
} else {
a.Importance = widget.HighImportance
@@ -44,6 +45,11 @@ func (a *AlbumFilterButton) Refresh() {
a.Button.Refresh()
}
func (a *AlbumFilterButton) filterEmptyExceptGenre() bool {
return !a.filter.ExcludeFavorited && !a.filter.ExcludeUnfavorited &&
a.filter.MinYear == 0 && a.filter.MaxYear == 0
}
func (a *AlbumFilterButton) onFilterChanged() {
a.Refresh()
if a.OnChanged != nil {