aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/manage_tunnels.go
diff options
context:
space:
mode:
Diffstat (limited to 'ui/manage_tunnels.go')
-rw-r--r--ui/manage_tunnels.go24
1 files changed, 9 insertions, 15 deletions
diff --git a/ui/manage_tunnels.go b/ui/manage_tunnels.go
index 4568d394..6ab20873 100644
--- a/ui/manage_tunnels.go
+++ b/ui/manage_tunnels.go
@@ -61,10 +61,16 @@ func (mtw *ManageTunnelsWindow) setup() error {
tunnelsContainer, _ := walk.NewComposite(splitter)
tunnelsContainer.SetLayout(walk.NewVBoxLayout())
+ splitter.SetFixed(tunnelsContainer, true)
+
mtw.tunnelsView, _ = NewTunnelsView(tunnelsContainer)
mtw.tunnelsView.ItemActivated().Attach(mtw.onEditTunnel)
mtw.tunnelsView.CurrentIndexChanged().Attach(mtw.updateConfView)
+ service.IPCClientRegisterTunnelChange(func(tunnel *service.Tunnel, state service.TunnelState, err error) {
+ mtw.tunnelsView.Invalidate()
+ })
+
// ToolBar actions
{
// HACK: Because of https://github.com/lxn/walk/issues/481
@@ -168,19 +174,7 @@ func (mtw *ManageTunnelsWindow) updateConfView() {
return
}
- currentTunnel := mtw.tunnelsView.CurrentTunnel()
- if currentTunnel == nil {
- // TODO: config must be non-nil right now
- // mtw.confView.SetConfiguration(nil)
- return
- }
-
- config, err := currentTunnel.RuntimeConfig()
- if err != nil {
- return
- }
-
- mtw.confView.SetConfiguration(&config)
+ mtw.confView.SetTunnel(mtw.tunnelsView.CurrentTunnel())
}
func (mtw *ManageTunnelsWindow) runTunnelEdit(tunnel *service.Tunnel) *conf.Config {
@@ -199,7 +193,7 @@ func (mtw *ManageTunnelsWindow) runTunnelEdit(tunnel *service.Tunnel) *conf.Conf
} else {
title = "Edit tunnel"
name = tunnel.Name
- config, _ = tunnel.RuntimeConfig()
+ config, _ = tunnel.StoredConfig()
}
dlg, _ := walk.NewDialog(mtw)
@@ -416,7 +410,7 @@ func (mtw *ManageTunnelsWindow) addTunnel(config *conf.Config) {
}
}
- mtw.confView.SetConfiguration(config)
+ mtw.confView.SetTunnel(&tunnel)
}
func (mtw *ManageTunnelsWindow) deleteTunnel(tunnel *service.Tunnel) {