diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-29 21:10:38 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-29 21:10:38 +0200 |
commit | 4ac73ea74b8fb778f1324ceb1eb11b131f2520c1 (patch) | |
tree | e2316076dfb54fd7e610c3b2d1156dd7c1552a92 /ui/tray.go | |
parent | ui: rework tunnel adding logic and fix bugs (diff) | |
download | wireguard-windows-4ac73ea74b8fb778f1324ceb1eb11b131f2520c1.tar.xz wireguard-windows-4ac73ea74b8fb778f1324ceb1eb11b131f2520c1.zip |
ui: show first active tunnels on window popup
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/tray.go')
-rw-r--r-- | ui/tray.go | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -52,7 +52,7 @@ func (tray *Tray) setup() error { tray.MouseDown().Attach(func(x, y int, button walk.MouseButton) { if button == walk.LeftButton { - tray.mtw.Show() + tray.onManageTunnels() } }) @@ -68,7 +68,7 @@ func (tray *Tray) setup() error { {label: "Networks: None", hidden: true}, {separator: true}, {separator: true}, - {label: "&Manage tunnels...", handler: tray.mtw.Show, enabled: true}, + {label: "&Manage tunnels...", handler: tray.onManageTunnels, enabled: true}, {label: "&Import tunnel(s) from file...", handler: tray.mtw.tunnelsPage.onImport, enabled: true}, {separator: true}, {label: "&About WireGuard", handler: func() { onAbout(tray.mtw) }, enabled: true}, @@ -297,3 +297,11 @@ func (tray *Tray) UpdateFound() { tray.ContextMenu().Actions().Insert(tray.ContextMenu().Actions().Len()-2, action) tray.ShowWarning("WireGuard Update Available", "An update to WireGuard is now available. You are advised to update as soon as possible.") } + +func (tray *Tray) onManageTunnels() { + if !tray.mtw.Visible() { + tray.mtw.tunnelsPage.tunnelsView.SelectFirstActiveTunnel() + tray.mtw.tabs.SetCurrentIndex(0) + } + tray.mtw.Show() +} |