aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/confview.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-14 14:02:33 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-14 14:02:33 +0200
commit51d3dec979fc276073002b7d159567e714b3f250 (patch)
tree2a4966a13f87385863097b3f1ba2d6cd939f3ece /ui/confview.go
parentui: update progress indicator when created (diff)
downloadwireguard-windows-51d3dec979fc276073002b7d159567e714b3f250.tar.xz
wireguard-windows-51d3dec979fc276073002b7d159567e714b3f250.zip
ui: centralize state labels
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/confview.go')
-rw-r--r--ui/confview.go27
1 files changed, 3 insertions, 24 deletions
diff --git a/ui/confview.go b/ui/confview.go
index 11226cc4..869ba229 100644
--- a/ui/confview.go
+++ b/ui/confview.go
@@ -108,22 +108,7 @@ func (lsl *labelStatusLine) update(state service.TunnelState) {
}
lsl.statusImage.SetImage(img)
s, e := lsl.statusLabel.TextSelection()
- switch state {
- case service.TunnelStarted:
- lsl.statusLabel.SetText("Active")
-
- case service.TunnelStarting:
- lsl.statusLabel.SetText("Activating")
-
- case service.TunnelStopped:
- lsl.statusLabel.SetText("Inactive")
-
- case service.TunnelStopping:
- lsl.statusLabel.SetText("Deactivating")
-
- case service.TunnelUnknown:
- lsl.statusLabel.SetText("Unknown state")
- }
+ lsl.statusLabel.SetText(textForState(state, false))
lsl.statusLabel.SetTextSelection(s, e)
}
@@ -208,16 +193,10 @@ func (tal *toggleActiveLine) update(state service.TunnelState) {
switch state {
case service.TunnelStarted:
text = "Deactivate"
-
- case service.TunnelStarting:
- text = "Activating..."
-
case service.TunnelStopped:
text = "Activate"
-
- case service.TunnelStopping:
- text = "Deactivating..."
-
+ case service.TunnelStarting, service.TunnelStopping:
+ text = textForState(state, true)
default:
text = ""
}