remove Query from mediaprovider.SearchResult
This commit is contained in:
@@ -179,5 +179,4 @@ type SearchResult struct {
|
||||
|
||||
// Unset for ContentTypes Artist, Playlist, and Genre
|
||||
ArtistName string
|
||||
Query string
|
||||
}
|
||||
|
||||
@@ -333,10 +333,10 @@ func (m *Controller) DoAddTracksToPlaylistWorkflow(trackIDs []string) {
|
||||
pop.Hide()
|
||||
m.doModalClosed()
|
||||
})
|
||||
sp.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string, query string) {
|
||||
sp.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string) {
|
||||
pop.Hide()
|
||||
if id == "" {
|
||||
go m.App.ServerManager.Server.CreatePlaylist(query, trackIDs)
|
||||
if id == "" /* creating new playlist */ {
|
||||
go m.App.ServerManager.Server.CreatePlaylist(sp.SearchDialog.SearchQuery(), trackIDs)
|
||||
} else {
|
||||
m.App.Config.Application.DefaultPlaylistID = id
|
||||
if sp.SkipDuplicates {
|
||||
@@ -628,7 +628,7 @@ func (c *Controller) ShowQuickSearch() {
|
||||
pop.Hide()
|
||||
c.doModalClosed()
|
||||
})
|
||||
qs.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string, query string) {
|
||||
qs.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string) {
|
||||
pop.Hide()
|
||||
c.doModalClosed()
|
||||
switch contentType {
|
||||
|
||||
@@ -45,7 +45,7 @@ func (q *QuickSearch) SetOnDismiss(onDismiss func()) {
|
||||
q.SearchDialog.OnDismiss = onDismiss
|
||||
}
|
||||
|
||||
func (q *QuickSearch) SetOnNavigateTo(onNavigateTo func(mediaprovider.ContentType, string, string)) {
|
||||
func (q *QuickSearch) SetOnNavigateTo(onNavigateTo func(mediaprovider.ContentType, string)) {
|
||||
q.SearchDialog.OnNavigateTo = onNavigateTo
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ type SearchDialog struct {
|
||||
widget.BaseWidget
|
||||
|
||||
OnDismiss func()
|
||||
OnNavigateTo func(mediaprovider.ContentType, string, string)
|
||||
OnNavigateTo func(mediaprovider.ContentType, string)
|
||||
OnSearched func(string) []*mediaprovider.SearchResult
|
||||
OnInit func() ([]*mediaprovider.SearchResult, *widget.Check)
|
||||
|
||||
@@ -82,10 +82,16 @@ func NewSearchDialog(im util.ImageFetcher, placeholderTitle string, onSearched f
|
||||
return sd
|
||||
}
|
||||
|
||||
// GetSearchEntry returns the search Entry widget for focusing
|
||||
func (sd *SearchDialog) GetSearchEntry() fyne.Focusable {
|
||||
return sd.searchEntry
|
||||
}
|
||||
|
||||
// SearchQuery returns the current search query entered by the user
|
||||
func (sd *SearchDialog) SearchQuery() string {
|
||||
return sd.searchEntry.Text
|
||||
}
|
||||
|
||||
func (sd *SearchDialog) Show() {
|
||||
sd.onInit()
|
||||
sd.BaseWidget.Show()
|
||||
@@ -108,9 +114,8 @@ func (sd *SearchDialog) onSelected(idx int) {
|
||||
}
|
||||
id := sd.searchResults[idx].ID
|
||||
typ := sd.searchResults[idx].Type
|
||||
query := sd.searchResults[idx].Query
|
||||
sd.resultsMutex.RUnlock()
|
||||
sd.OnNavigateTo(typ, id, query)
|
||||
sd.OnNavigateTo(typ, id)
|
||||
}
|
||||
|
||||
func (sd *SearchDialog) moveSelectionDown() {
|
||||
|
||||
@@ -79,9 +79,8 @@ func (sp *SelectPlaylist) onSearched(query string) []*mediaprovider.SearchResult
|
||||
)
|
||||
})
|
||||
results = append(results, &mediaprovider.SearchResult{
|
||||
Name: fmt.Sprintf("Create new playlist: %s", query),
|
||||
Type: mediaprovider.ContentTypePlaylist,
|
||||
Query: query,
|
||||
Name: fmt.Sprintf("Create new playlist: %s", query),
|
||||
Type: mediaprovider.ContentTypePlaylist,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -102,7 +101,7 @@ func (sp *SelectPlaylist) SetOnDismiss(onDismiss func()) {
|
||||
sp.SearchDialog.OnDismiss = onDismiss
|
||||
}
|
||||
|
||||
func (sp *SelectPlaylist) SetOnNavigateTo(onNavigateTo func(mediaprovider.ContentType, string, string)) {
|
||||
func (sp *SelectPlaylist) SetOnNavigateTo(onNavigateTo func(mediaprovider.ContentType, string)) {
|
||||
sp.SearchDialog.OnNavigateTo = onNavigateTo
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user