From 3019716120e97bfa1b2333af61451cdc3aeb99bd Mon Sep 17 00:00:00 2001 From: Anthony Dong Date: Mon, 25 Mar 2019 18:09:50 +0100 Subject: ui: add tunnels management view Signed-off-by: Anthony Dong Signed-off-by: Jason A. Donenfeld --- ui/ui.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'ui/ui.go') diff --git a/ui/ui.go b/ui/ui.go index d3bd7b54..633fc19b 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -7,15 +7,16 @@ package ui import ( "fmt" + "os" + "runtime" + "time" + "github.com/lxn/walk" "github.com/lxn/win" "golang.zx2c4.com/wireguard/windows/conf" "golang.zx2c4.com/wireguard/windows/ringlogger" "golang.zx2c4.com/wireguard/windows/service" "golang.zx2c4.com/wireguard/windows/ui/syntax" - "os" - "runtime" - "time" ) const testInterfaceName = "test" @@ -195,11 +196,7 @@ func RunUI() { quitAction.SetText("Exit") quit = func() { tray.Dispose() - _, err := service.IPCClientQuit(true) - if err != nil { - walk.MsgBox(nil, "Error Exiting WireGuard", fmt.Sprintf("Unable to exit service due to: %s. You may want to stop WireGuard from the service manager.", err), walk.MsgBoxIconError) - os.Exit(1) - } + onQuit() } quitAction.Triggered().Attach(quit) tray.ContextMenu().Actions().Add(quitAction) @@ -293,3 +290,11 @@ func RunUI() { mw.Run() } + +func onQuit() { + _, err := service.IPCClientQuit(true) + if err != nil { + walk.MsgBox(nil, "Error Exiting WireGuard", fmt.Sprintf("Unable to exit service due to: %s. You may want to stop WireGuard from the service manager.", err), walk.MsgBoxIconError) + os.Exit(1) + } +} -- cgit v1.2.3-59-g8ed1b