diff --git a/cache/cache_servers.go b/cache/cache_servers.go index 0fbe961..d0d301c 100644 --- a/cache/cache_servers.go +++ b/cache/cache_servers.go @@ -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 } } diff --git a/ui/mainwindow.go b/ui/mainwindow.go index 8ea0cd3..a995069 100644 --- a/ui/mainwindow.go +++ b/ui/mainwindow.go @@ -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) } }