diff options
author | Anthony Dong <aanthony.dong@gmail.com> | 2019-03-25 18:09:50 +0100 |
---|---|---|
committer | Alexander Neumann <alexander.neumann@picos-software.com> | 2019-04-23 11:04:59 +0200 |
commit | 29abe1ba37019c2f43f16c47e8f2794c0037abe1 (patch) | |
tree | 7ed3a496068079b8b4dd3b5e3d157f2b250ba4e0 /ui/ui.go | |
parent | ui: add tunnels tableview (diff) | |
download | wireguard-windows-29abe1ba37019c2f43f16c47e8f2794c0037abe1.tar.xz wireguard-windows-29abe1ba37019c2f43f16c47e8f2794c0037abe1.zip |
ui: add tunnels management view
Signed-off-by: Anthony Dong <aanthony.dong@gmail.com>
Diffstat (limited to 'ui/ui.go')
-rw-r--r-- | ui/ui.go | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -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) + } +} |