diff --git a/ui/mainwindow.go b/ui/mainwindow.go index 7d8e057..009f81f 100644 --- a/ui/mainwindow.go +++ b/ui/mainwindow.go @@ -308,7 +308,6 @@ func (m *MainWindow) hideOfflineFavoriteServers() { func (m *MainWindow) loadAllServers(data map[string]string) { fmt.Println("Loading all servers...") - // ToDo: do it without clearing. for _, server := range ctx.Cache.Servers { iter := new(gtk.TreeIter) ping, _ := strconv.Atoi(server.Server.Ping) @@ -321,7 +320,7 @@ func (m *MainWindow) loadAllServers(data map[string]string) { } if m.all_servers_hide_offline.GetActive() && (server.Server.Players == "" && server.Server.Maxplayers == "" || ping > 9000) { - if server.AllServersIterInList { + if server.AllServersIterInList && server.AllServersIterSet { m.all_servers_store.Remove(iter) server.AllServersIterInList = false } diff --git a/ui/mainwindow_init.go b/ui/mainwindow_init.go index 955bbd2..c7f71fb 100644 --- a/ui/mainwindow_init.go +++ b/ui/mainwindow_init.go @@ -11,6 +11,7 @@ import ( "github.com/pztrn/urtrator/common" // Other + "github.com/mattn/go-gtk/gdk" "github.com/mattn/go-gtk/gdkpixbuf" "github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/gtk" @@ -18,6 +19,10 @@ import ( // Main window initialization. func (m *MainWindow) Initialize() { + + gdk.ThreadsInit() + gdk.ThreadsEnter() + gtk.Init(nil) m.initializeStorages() @@ -165,6 +170,7 @@ func (m *MainWindow) Initialize() { ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "URTrator is ready."}) gtk.Main() + gdk.ThreadsLeave() } // Events initialization.