make search bar on tracks page Ctrl+F focusable; reset tracklist selection on clear

This commit is contained in:
Drew Weymouth
2023-04-20 21:27:46 -07:00
parent a56daa0c7f
commit cf22503610
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -88,6 +88,12 @@ func (t *TracksPage) OnSongChange(track *subsonic.Child, lastScrobbledIfAny *sub
} }
} }
var _ Searchable = (*TracksPage)(nil)
func (t *TracksPage) SearchWidget() fyne.Focusable {
return t.searcher.Entry
}
func (t *TracksPage) OnSearched(query string) { func (t *TracksPage) OnSearched(query string) {
t.searchText = query t.searchText = query
if query == "" { if query == "" {
+1
View File
@@ -201,6 +201,7 @@ func (t *Tracklist) IncrementPlayCount(trackID string) {
// Remove all tracks from the tracklist. Thread-safe. // Remove all tracks from the tracklist. Thread-safe.
func (t *Tracklist) Clear() { func (t *Tracklist) Clear() {
t.selectionMgr.UnselectAll()
t.tracksMutex.Lock() t.tracksMutex.Lock()
defer t.tracksMutex.Unlock() defer t.tracksMutex.Unlock()
t.Tracks = nil t.Tracks = nil