Proper sorting by server name.

This commit is contained in:
Stanislav Nikitin 2016-11-22 11:53:54 +05:00
parent 4f5bf90dbe
commit 1fe49871f1
2 changed files with 5 additions and 5 deletions

View File

@ -21,17 +21,17 @@ type Colorizer struct {
colors map[string]string
}
func (c *Colorizer) Clear(data string) string {
func (c *Colorizer) ClearFromMarkup(data string) string {
var result string = ""
data = html.EscapeString(data)
data_splitted := strings.Split(data, "^")
data_splitted := strings.Split(data, ">")
if len(data_splitted) > 1 {
for item := range data_splitted {
if len(data_splitted[item]) > 0 {
result += data_splitted[item]
result += strings.Split(data_splitted[item], "<")[0]
}
}
} else {

View File

@ -25,8 +25,8 @@ func (m *MainWindow) sortServersByName(model *gtk.TreeModel, a *gtk.TreeIter, b
return 0
}
name1 := ctx.Colorizer.Clear(name1_raw.GetString())
name2 := ctx.Colorizer.Clear(name2_raw.GetString())
name1 := ctx.Colorizer.ClearFromMarkup(name1_raw.GetString())
name2 := ctx.Colorizer.ClearFromMarkup(name2_raw.GetString())
if name1 < name2 {
return -1