update searchdialog for fyne.Do
This commit is contained in:
@@ -101,7 +101,7 @@ func (sd *SearchDialog) SearchQuery() string {
|
|||||||
|
|
||||||
func (sd *SearchDialog) Show() {
|
func (sd *SearchDialog) Show() {
|
||||||
sd.BaseWidget.Show()
|
sd.BaseWidget.Show()
|
||||||
go sd.onSearched("")
|
sd.onSearched("")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sd *SearchDialog) Refresh() {
|
func (sd *SearchDialog) Refresh() {
|
||||||
@@ -163,14 +163,18 @@ func (sd *SearchDialog) setResults(results []*mediaprovider.SearchResult) {
|
|||||||
func (sd *SearchDialog) onSearched(query string) {
|
func (sd *SearchDialog) onSearched(query string) {
|
||||||
sd.loadingDots.Start()
|
sd.loadingDots.Start()
|
||||||
var results []*mediaprovider.SearchResult
|
var results []*mediaprovider.SearchResult
|
||||||
res := sd.OnSearched(query)
|
go func() {
|
||||||
if len(res) == 0 {
|
res := sd.OnSearched(query)
|
||||||
log.Println("No results matched the query.")
|
if len(res) == 0 {
|
||||||
} else {
|
log.Println("No results matched the query.")
|
||||||
results = res
|
} else {
|
||||||
}
|
results = res
|
||||||
sd.loadingDots.Stop()
|
}
|
||||||
sd.setResults(results)
|
fyne.Do(func() {
|
||||||
|
sd.loadingDots.Stop()
|
||||||
|
sd.setResults(results)
|
||||||
|
})
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sd *SearchDialog) CreateRenderer() fyne.WidgetRenderer {
|
func (sd *SearchDialog) CreateRenderer() fyne.WidgetRenderer {
|
||||||
|
|||||||
Reference in New Issue
Block a user