mirror of
https://github.com/Xpl0itU/WiiUDownloader.git
synced 2025-06-04 00:58:43 -04:00
Keep searched text when region/category change
This commit is contained in:
parent
23b72380e3
commit
6f27d36f31
1 changed files with 15 additions and 6 deletions
|
@ -32,6 +32,7 @@ type MainWindow struct {
|
||||||
currentRegion uint8
|
currentRegion uint8
|
||||||
deleteEncryptedContentsCheckbox *gtk.CheckButton
|
deleteEncryptedContentsCheckbox *gtk.CheckButton
|
||||||
logger *wiiudownloader.Logger
|
logger *wiiudownloader.Logger
|
||||||
|
lastSearchText string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMainWindow(entries []wiiudownloader.TitleEntry, logger *wiiudownloader.Logger) *MainWindow {
|
func NewMainWindow(entries []wiiudownloader.TitleEntry, logger *wiiudownloader.Logger) *MainWindow {
|
||||||
|
@ -54,11 +55,12 @@ func NewMainWindow(entries []wiiudownloader.TitleEntry, logger *wiiudownloader.L
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWindow := MainWindow{
|
mainWindow := MainWindow{
|
||||||
window: win,
|
window: win,
|
||||||
titles: entries,
|
titles: entries,
|
||||||
searchEntry: searchEntry,
|
searchEntry: searchEntry,
|
||||||
currentRegion: wiiudownloader.MCP_REGION_EUROPE | wiiudownloader.MCP_REGION_JAPAN | wiiudownloader.MCP_REGION_USA,
|
currentRegion: wiiudownloader.MCP_REGION_EUROPE | wiiudownloader.MCP_REGION_JAPAN | wiiudownloader.MCP_REGION_USA,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
|
lastSearchText: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
searchEntry.Connect("changed", mainWindow.onSearchEntryChanged)
|
searchEntry.Connect("changed", mainWindow.onSearchEntryChanged)
|
||||||
|
@ -354,10 +356,12 @@ func (mw *MainWindow) onRegionChange(button *gtk.CheckButton, region uint8) {
|
||||||
mw.currentRegion = region ^ mw.currentRegion
|
mw.currentRegion = region ^ mw.currentRegion
|
||||||
}
|
}
|
||||||
mw.updateTitles(mw.titles)
|
mw.updateTitles(mw.titles)
|
||||||
|
mw.filterTitles(mw.lastSearchText)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mw *MainWindow) onSearchEntryChanged() {
|
func (mw *MainWindow) onSearchEntryChanged() {
|
||||||
text, _ := mw.searchEntry.GetText()
|
text, _ := mw.searchEntry.GetText()
|
||||||
|
mw.lastSearchText = text
|
||||||
mw.filterTitles(text)
|
mw.filterTitles(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,9 +393,14 @@ func (mw *MainWindow) filterTitles(filterText string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mw *MainWindow) onCategoryToggled(button *gtk.ToggleButton) {
|
func (mw *MainWindow) onCategoryToggled(button *gtk.ToggleButton) {
|
||||||
category, _ := button.GetLabel()
|
category, err := button.GetLabel()
|
||||||
|
if err != nil {
|
||||||
|
mw.logger.Fatal("Unable to get label:", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
mw.titles = wiiudownloader.GetTitleEntries(wiiudownloader.GetCategoryFromFormattedCategory(category))
|
mw.titles = wiiudownloader.GetTitleEntries(wiiudownloader.GetCategoryFromFormattedCategory(category))
|
||||||
mw.updateTitles(mw.titles)
|
mw.updateTitles(mw.titles)
|
||||||
|
mw.filterTitles(mw.lastSearchText)
|
||||||
for _, catButton := range mw.categoryButtons {
|
for _, catButton := range mw.categoryButtons {
|
||||||
catButton.SetActive(false)
|
catButton.SetActive(false)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue