Skip to content

Commit

Permalink
alphabatizing mods when displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
KiameV committed Jul 7, 2023
1 parent a3cb96f commit 8aedd2a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ui/discover/discoverUI.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package discover

import (
"sort"
"strings"

"fyne.io/fyne/v2"
Expand Down Expand Up @@ -60,6 +61,9 @@ func (ui *discoverUI) PreDraw(w fyne.Window, args ...interface{}) (err error) {
ui.mods = append(ui.mods, m)
}
}
sort.Slice(ui.mods, func(i, j int) bool {
return ui.mods[i].Name < ui.mods[j].Name
})
return
}

Expand Down
7 changes: 6 additions & 1 deletion ui/local/localUI.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/kiamev/moogle-mod-manager/ui/util/working"
"github.com/ncruces/zenity"
"os/exec"
"sort"
)

type LocalUI interface {
Expand Down Expand Up @@ -136,7 +137,11 @@ func (ui *localUI) Draw(w fyne.Window) {
}
})

for _, mod := range managed.GetMods(state.CurrentGame) {
m := managed.GetMods(state.CurrentGame)
sort.Slice(m, func(i, j int) bool {
return m[i].DisplayName() < m[j].DisplayName()
})
for _, mod := range m {
ui.addModToList(mod)
}

Expand Down

0 comments on commit 8aedd2a

Please sign in to comment.