diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-04 00:36:44 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-04 00:41:12 +0200 |
commit | e1754d6fe872bb20189a5e93f7bca0f8547e167a (patch) | |
tree | e47ebaf2ff5d4e98a02d1e70d511bf2f6899bc10 /ui | |
parent | version: expose OsVersion for firewall (diff) | |
download | wireguard-windows-e1754d6fe872bb20189a5e93f7bca0f8547e167a.tar.xz wireguard-windows-e1754d6fe872bb20189a5e93f7bca0f8547e167a.zip |
ui: specify default action in tray
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/tray.go | 5 | ||||
-rw-r--r-- | ui/tunnelspage.go | 1 |
2 files changed, 4 insertions, 2 deletions
@@ -63,12 +63,13 @@ func (tray *Tray) setup() error { enabled bool hidden bool separator bool + defawlt bool }{ {label: "Status: Unknown"}, {label: "Networks: None", hidden: true}, {separator: true}, {separator: true}, - {label: "&Manage tunnels...", handler: tray.onManageTunnels, enabled: true}, + {label: "&Manage tunnels...", handler: tray.onManageTunnels, enabled: true, defawlt: 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}, @@ -82,6 +83,7 @@ func (tray *Tray) setup() error { action.SetText(item.label) action.SetEnabled(item.enabled) action.SetVisible(!item.hidden) + action.SetDefault(item.defawlt) if item.handler != nil { action.Triggered().Attach(item.handler) } @@ -292,7 +294,6 @@ func (tray *Tray) UpdateFound() { if icon, err := iconProvider.UpdateAvailableImage(); err == nil { action.SetImage(icon) } - //TODO: Make bold action.Triggered().Attach(func() { tray.mtw.Show() tray.mtw.tabs.SetCurrentIndex(2) diff --git a/ui/tunnelspage.go b/ui/tunnelspage.go index 18e9e255..dc86d776 100644 --- a/ui/tunnelspage.go +++ b/ui/tunnelspage.go @@ -134,6 +134,7 @@ func (tp *TunnelsPage) CreateToolbar() { importActionImage, _ := walk.NewBitmapFromIcon(importActionIcon, imageSize) importAction.SetImage(importActionImage) importAction.SetShortcut(walk.Shortcut{walk.ModControl, walk.KeyO}) + importAction.SetDefault(true) importAction.Triggered().Attach(tp.onImport) addAction := walk.NewAction() addAction.SetText("Add empty tunnel") |