From 93710a53e75a0aaf86eb7e480c9f7496fcb32a20 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 25 Jun 2019 19:41:55 +0200 Subject: ui: remove clone Signed-off-by: Jason A. Donenfeld --- ui/editdialog.go | 13 +++---------- ui/tunnelspage.go | 21 ++------------------- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/ui/editdialog.go b/ui/editdialog.go index f1d7fac5..f27ab60f 100644 --- a/ui/editdialog.go +++ b/ui/editdialog.go @@ -28,11 +28,11 @@ type EditDialog struct { blockUntunneledTraficCheckGuard bool } -func runTunnelEditDialog(owner walk.Form, tunnel *manager.Tunnel, clone bool) *conf.Config { +func runTunnelEditDialog(owner walk.Form, tunnel *manager.Tunnel) *conf.Config { dlg := &EditDialog{} var title string - if tunnel == nil || clone { + if tunnel == nil { title = "Create new tunnel" } else { title = "Edit tunnel" @@ -44,9 +44,6 @@ func runTunnelEditDialog(owner walk.Form, tunnel *manager.Tunnel, clone bool) *c dlg.config = conf.Config{Interface: conf.Interface{PrivateKey: *pk}} } else { dlg.config, _ = tunnel.StoredConfig() - if clone { - dlg.config.Name += "-copy" - } } layout := walk.NewGridLayout() @@ -113,11 +110,7 @@ func runTunnelEditDialog(owner walk.Form, tunnel *manager.Tunnel, clone bool) *c dlg.syntaxEdit.BlockUntunneledTrafficStateChanged().Attach(dlg.onBlockUntunneledTrafficStateChanged) dlg.syntaxEdit.SetText(dlg.config.ToWgQuick()) - if clone { - dlg.config.Name = "" - } - - if tunnel != nil && !clone { + if tunnel != nil { dlg.nameEdit.SetFocus() // TODO: This works around a walk issue with scrolling in weird ways . We should fix this in walk instead of here. dlg.Starting().Attach(func() { diff --git a/ui/tunnelspage.go b/ui/tunnelspage.go index 26a0a291..64b081de 100644 --- a/ui/tunnelspage.go +++ b/ui/tunnelspage.go @@ -203,10 +203,6 @@ func (tp *TunnelsPage) CreateToolbar() { editAction.Triggered().Attach(tp.onEditTunnel) contextMenu.Actions().Add(editAction) tp.ShortcutActions().Add(editAction) - cloneAction := walk.NewAction() - cloneAction.SetText("Clone selected tunnel...") - cloneAction.Triggered().Attach(tp.onCloneTunnel) - contextMenu.Actions().Add(cloneAction) deleteAction2 := walk.NewAction() deleteAction2.SetText("Remove selected tunnel(s)") deleteAction2.SetShortcut(walk.Shortcut{0, walk.KeyDelete}) @@ -230,7 +226,6 @@ func (tp *TunnelsPage) CreateToolbar() { toggleAction.SetEnabled(selected == 1) selectAllAction.SetEnabled(selected < all) editAction.SetEnabled(selected == 1) - cloneAction.SetEnabled(selected == 1) } tp.listView.SelectedIndexesChanged().Attach(setSelectionOrientedOptions) setSelectionOrientedOptions() @@ -424,7 +419,7 @@ func (tp *TunnelsPage) onEditTunnel() { return } - if config := runTunnelEditDialog(tp.Form(), tunnel, false); config != nil { + if config := runTunnelEditDialog(tp.Form(), tunnel); config != nil { go func() { priorState, err := tunnel.State() tunnel.Delete() @@ -437,20 +432,8 @@ func (tp *TunnelsPage) onEditTunnel() { } } -func (tp *TunnelsPage) onCloneTunnel() { - tunnel := tp.listView.CurrentTunnel() - if tunnel == nil { - return - } - - if config := runTunnelEditDialog(tp.Form(), tunnel, true); config != nil { - // Save new - tp.addTunnel(config) - } -} - func (tp *TunnelsPage) onAddTunnel() { - if config := runTunnelEditDialog(tp.Form(), nil, false); config != nil { + if config := runTunnelEditDialog(tp.Form(), nil); config != nil { // Save new tp.addTunnel(config) } -- cgit v1.2.3-59-g8ed1b