Completely fixed favorited servers. You may want to re-edit them.

This commit is contained in:
Stanislav Nikitin 2016-10-09 01:29:46 +05:00
parent e12bcdd386
commit 64b87d3a8b
2 changed files with 7 additions and 6 deletions

View File

@ -64,6 +64,7 @@ func (c *Cache) FlushServers(data map[string]string) {
new_servers[mapping_item_name].PlayersInfo = s.Server.PlayersInfo
new_servers[mapping_item_name].IsPrivate = s.Server.IsPrivate
new_servers[mapping_item_name].Favorite = s.Server.Favorite
new_servers[mapping_item_name].ProfileToUse = s.Server.ProfileToUse
} else {
cached_servers[mapping_item_name].Ip = s.Server.Ip
cached_servers[mapping_item_name].Port = s.Server.Port
@ -78,6 +79,7 @@ func (c *Cache) FlushServers(data map[string]string) {
cached_servers[mapping_item_name].PlayersInfo = s.Server.PlayersInfo
cached_servers[mapping_item_name].IsPrivate = s.Server.IsPrivate
cached_servers[mapping_item_name].Favorite = s.Server.Favorite
cached_servers[mapping_item_name].ProfileToUse = s.Server.ProfileToUse
}
}

View File

@ -87,8 +87,6 @@ type MainWindow struct {
// Dialogs.
options_dialog *OptionsDialog
// Favorite server editing.
favorite_dialog *FavoriteDialog
// Other
// Old profiles count.
@ -141,7 +139,7 @@ func (m *MainWindow) addToFavorites() {
}
// Getting server from database.
m.favorite_dialog = &FavoriteDialog{}
fd := &FavoriteDialog{}
if len(server_address) > 0 {
servers := []datamodels.Server{}
address := strings.Split(server_address, ":")[0]
@ -150,9 +148,9 @@ func (m *MainWindow) addToFavorites() {
if err1 != nil {
fmt.Println(err1.Error())
}
m.favorite_dialog.InitializeUpdate(&servers[0])
fd.InitializeUpdate(&servers[0])
} else {
m.favorite_dialog.InitializeNew()
fd.InitializeNew()
}
}
@ -264,7 +262,8 @@ func (m *MainWindow) editFavorite() {
if len(server_address) > 0 {
srv := ctx.Cache.Servers[server_address].Server
m.favorite_dialog.InitializeUpdate(srv)
fd := FavoriteDialog{}
fd.InitializeUpdate(srv)
}
}