aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAlexander Neumann <alexander.neumann@picos-software.com>2019-04-01 16:40:30 +0200
committerAlexander Neumann <alexander.neumann@picos-software.com>2019-04-23 11:04:59 +0200
commit1acdecafd8da20ce74384ee132022702093d7498 (patch)
tree257cf78cac0357b5a2062e3078a7bb12cd089df7
parentui: add delete action to tool bar (diff)
downloadwireguard-windows-1acdecafd8da20ce74384ee132022702093d7498.tar.xz
wireguard-windows-1acdecafd8da20ce74384ee132022702093d7498.zip
ui: only enable edit button if a tunnel is selected
Signed-off-by: Alexander Neumann <alexander.neumann@picos-software.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r--ui/manage_tunnels.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/ui/manage_tunnels.go b/ui/manage_tunnels.go
index b9b9cb90..badbdbbb 100644
--- a/ui/manage_tunnels.go
+++ b/ui/manage_tunnels.go
@@ -139,8 +139,11 @@ func (mtw *ManageTunnelsWindow) setup() error {
walk.NewHSpacer(controlsContainer)
- // TODO: Disable when nothing is selected
editTunnel, _ := walk.NewPushButton(controlsContainer)
+ editTunnel.SetEnabled(false)
+ mtw.tunnelsView.CurrentIndexChanged().Attach(func() {
+ editTunnel.SetEnabled(mtw.tunnelsView.CurrentIndex() > -1)
+ })
editTunnel.SetText("Edit")
editTunnel.Clicked().Attach(mtw.onEditTunnel)