update searchdialog for fyne.Do

This commit is contained in:
Drew Weymouth
2025-02-08 08:35:34 -03:00
parent 2ff3853015
commit f7e5e1e9a4
+5 -1
View File
@@ -101,7 +101,7 @@ func (sd *SearchDialog) SearchQuery() string {
func (sd *SearchDialog) Show() {
sd.BaseWidget.Show()
go sd.onSearched("")
sd.onSearched("")
}
func (sd *SearchDialog) Refresh() {
@@ -163,14 +163,18 @@ func (sd *SearchDialog) setResults(results []*mediaprovider.SearchResult) {
func (sd *SearchDialog) onSearched(query string) {
sd.loadingDots.Start()
var results []*mediaprovider.SearchResult
go func() {
res := sd.OnSearched(query)
if len(res) == 0 {
log.Println("No results matched the query.")
} else {
results = res
}
fyne.Do(func() {
sd.loadingDots.Stop()
sd.setResults(results)
})
}()
}
func (sd *SearchDialog) CreateRenderer() fyne.WidgetRenderer {