diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-05 13:51:26 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-05 13:54:37 +0200 |
commit | 0c16c09ad581259bdbe8a1b1e948e5402e57cb6a (patch) | |
tree | 5d154ce550da59daab00f68e0717b60def94644e | |
parent | ui: syntax: implement trafic blocking semantics (diff) | |
download | wireguard-windows-0c16c09ad581259bdbe8a1b1e948e5402e57cb6a.tar.xz wireguard-windows-0c16c09ad581259bdbe8a1b1e948e5402e57cb6a.zip |
ui: improve update logging and tray logic
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | main.go | 2 | ||||
-rw-r--r-- | ui/aboutdialog.go | 2 | ||||
-rw-r--r-- | ui/managewindow.go | 1 | ||||
-rw-r--r-- | ui/tray.go | 17 | ||||
-rw-r--r-- | ui/tunnelspage.go | 2 |
5 files changed, 19 insertions, 5 deletions
@@ -11,6 +11,7 @@ import ( "golang.zx2c4.com/wireguard/windows/ringlogger" "golang.zx2c4.com/wireguard/windows/service" "golang.zx2c4.com/wireguard/windows/ui" + "log" "os" "strconv" "strings" @@ -174,6 +175,7 @@ func main() { if err != nil { fatal(err) } + log.SetOutput(ringlogger.Global) service.InitializeIPCClient(readPipe, writePipe, eventPipe) ui.RunUI() return diff --git a/ui/aboutdialog.go b/ui/aboutdialog.go index 0b6a294d..da8f7f9f 100644 --- a/ui/aboutdialog.go +++ b/ui/aboutdialog.go @@ -31,7 +31,7 @@ func onAbout(owner walk.Form) { dlg.SetFont(font) iv, _ := walk.NewImageView(dlg) - logo, _ := walk.NewIconFromResourceWithSize("$wireguard.ico", walk.Size{owner.DPI() * 4 / 3, owner.DPI() * 4 / 3}) //TODO: calculate DPI dynamically + logo, _ := walk.NewIconFromResourceWithSize("$wireguard.ico", walk.Size{dlg.DPI() * 4 / 3, dlg.DPI() * 4 / 3}) //TODO: calculate DPI dynamically iv.SetCursor(walk.CursorHand()) iv.MouseUp().Attach(func(x, y int, button walk.MouseButton) { if button == walk.LeftButton { diff --git a/ui/managewindow.go b/ui/managewindow.go index 5e14419a..dd2de7f5 100644 --- a/ui/managewindow.go +++ b/ui/managewindow.go @@ -118,6 +118,7 @@ func (mtw *ManageTunnelsWindow) UpdateFound() { if mtw.updatePage != nil { return } + mtw.SetTitle(mtw.Title() + " (out of date)") updatePage, err := NewUpdatePage() if err == nil { mtw.updatePage = updatePage @@ -73,9 +73,9 @@ func (tray *Tray) setup() error { {separator: true}, {separator: true}, {label: "&Manage tunnels...", handler: tray.onManageTunnels, enabled: true, defawlt: true}, - {label: "&Import tunnel(s) from file...", handler: tray.mtw.tunnelsPage.onImport, enabled: true}, + {label: "&Import tunnel(s) from file...", handler: tray.onImport, enabled: true}, {separator: true}, - {label: "&About WireGuard", handler: func() { onAbout(tray.mtw) }, enabled: true}, + {label: "&About WireGuard", handler: tray.onAbout, enabled: true}, {label: "&Exit", handler: onQuit, enabled: true}, } { var action *walk.Action @@ -320,3 +320,16 @@ func (tray *Tray) onManageTunnels() { } tray.mtw.Show() } + +func (tray *Tray) onAbout() { + if tray.mtw.Visible() { + onAbout(tray.mtw) + } else { + onAbout(nil) + } +} + +func (tray *Tray) onImport() { + tray.mtw.Show() + tray.mtw.tunnelsPage.onImport() +} diff --git a/ui/tunnelspage.go b/ui/tunnelspage.go index dc86d776..a4bbcd79 100644 --- a/ui/tunnelspage.go +++ b/ui/tunnelspage.go @@ -444,8 +444,6 @@ func (tp *TunnelsPage) onDelete() { } func (tp *TunnelsPage) onImport() { - tp.Form().Show() // Since the tray calls us sometimes, always make our parent visible. - dlg := walk.FileDialog{ Filter: "Configuration Files (*.zip, *.conf)|*.zip;*.conf|All Files (*.*)|*.*", Title: "Import tunnel(s) from file...", |