aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/iconprovider.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/iconprovider.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/iconprovider.go')
-rw-r--r--ui/iconprovider.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/ui/iconprovider.go b/ui/iconprovider.go
index 3b3fd13d..52150a46 100644
--- a/ui/iconprovider.go
+++ b/ui/iconprovider.go
@@ -101,6 +101,28 @@ func iconForState(state service.TunnelState, size int) (icon *walk.Icon, err err
return
}
+func textForState(state service.TunnelState, withEllipsis bool) (text string) {
+ switch state {
+ case service.TunnelStarted:
+ text = "Active"
+ case service.TunnelStarting:
+ text = "Activating"
+ case service.TunnelStopped:
+ text = "Inactive"
+ case service.TunnelStopping:
+ text = "Deactivating"
+ case service.TunnelUnknown:
+ text = "Unknown state"
+ }
+ if withEllipsis {
+ switch state {
+ case service.TunnelStarting, service.TunnelStopping:
+ text += "..."
+ }
+ }
+ return
+}
+
var cachedSystemIconsForWidthAndDllIdx = make(map[widthAndDllIdx]*walk.Icon)
func loadSystemIcon(dll string, index int32, size int) (icon *walk.Icon, err error) {