From eee09ee4c25346987fd3090ed2339ec1a7a08f70 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Mon, 1 Apr 2019 14:24:27 +0200 Subject: ui: work around a bug in walk to have our own tool bar below the tunnels list Signed-off-by: Alexander Neumann Signed-off-by: Jason A. Donenfeld --- ui/manage_tunnels.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ui/manage_tunnels.go b/ui/manage_tunnels.go index c7673776..14c5afe9 100644 --- a/ui/manage_tunnels.go +++ b/ui/manage_tunnels.go @@ -61,11 +61,18 @@ func (mtw *ManageTunnelsWindow) setup() error { tunnelsContainer, _ := walk.NewComposite(splitter) tunnelsContainer.SetLayout(walk.NewVBoxLayout()) + mtw.tunnelsView, _ = NewTunnelsView(tunnelsContainer) + mtw.tunnelsView.ItemActivated().Attach(mtw.onEditTunnel) + mtw.tunnelsView.CurrentIndexChanged().Attach(mtw.updateConfView) + // ToolBar actions { - // TODO: Currently hijacking the window ToolBar, - // Adding the toolbar to the bottom of the control may be better - tunnelsToolBar := mtw.ToolBar() + // HACK: Because of https://github.com/lxn/walk/issues/481 + // we need to put the ToolBar into its own Composite. + toolBarContainer, _ := walk.NewComposite(tunnelsContainer) + toolBarContainer.SetLayout(walk.NewHBoxLayout()) + + tunnelsToolBar, _ := walk.NewToolBar(toolBarContainer) importAction := walk.NewAction() importAction.SetText("Import tunnels from file...") @@ -102,10 +109,6 @@ func (mtw *ManageTunnelsWindow) setup() error { settingsMenuAction.SetText("Export") } - mtw.tunnelsView, _ = NewTunnelsView(tunnelsContainer) - mtw.tunnelsView.ItemActivated().Attach(mtw.onEditTunnel) - mtw.tunnelsView.CurrentIndexChanged().Attach(mtw.updateConfView) - currentTunnelContainer, _ := walk.NewComposite(splitter) currentTunnelContainer.SetLayout(walk.NewVBoxLayout()) -- cgit v1.2.3-59-g8ed1b