From 3537b05dce0012cfdf15b46e2a329ee60b2b725e Mon Sep 17 00:00:00 2001 From: pztrn Date: Tue, 11 Oct 2016 00:14:00 +0500 Subject: [PATCH] Moved windows actions to mainwindow_init_win.go. --- ui/mainwindow.go | 6 ++++++ ui/mainwindow_init_win.go | 4 ++++ urtrator.go | 8 -------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ui/mainwindow.go b/ui/mainwindow.go index c70b0fa..ae90d65 100644 --- a/ui/mainwindow.go +++ b/ui/mainwindow.go @@ -12,6 +12,7 @@ package ui import ( // stdlib "fmt" + "runtime" "strconv" "strings" @@ -193,6 +194,11 @@ func (m *MainWindow) Close() { ctx.Cfg.Cfg["/mainwindow/fav_servers/" + fav_servers_columns[i].GetTitle() + "_width"] = strconv.Itoa(fav_servers_columns[i].GetWidth()) } + // Additional actions should be taken on Windows. + if runtime.GOOS == "windows" { + m.closeWin() + } + ctx.Close() } diff --git a/ui/mainwindow_init_win.go b/ui/mainwindow_init_win.go index 10daf68..db998d3 100644 --- a/ui/mainwindow_init_win.go +++ b/ui/mainwindow_init_win.go @@ -10,6 +10,10 @@ import ( "github.com/couchbase/goutils/platform" ) +func (m *MainWindow) closeWin() { + platform.HideConsole(false) +} + func (m *MainWindow) initializeWin() { platform.HideConsole(true) diff --git a/urtrator.go b/urtrator.go index a379689..b0f1d36 100644 --- a/urtrator.go +++ b/urtrator.go @@ -18,9 +18,6 @@ import ( // stdlib "fmt" "runtime" - - // other - "github.com/couchbase/goutils/platform" ) func main() { @@ -29,11 +26,6 @@ func main() { numCPUs := runtime.NumCPU() runtime.GOMAXPROCS(numCPUs) - if runtime.GOOS == "windows" { - platform.HideConsole(true) - defer platform.HideConsole(false) - } - ctx := context.New() ctx.Initialize()