From 51d3dec979fc276073002b7d159567e714b3f250 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 14 May 2019 14:02:33 +0200 Subject: ui: centralize state labels Signed-off-by: Jason A. Donenfeld --- ui/tray.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'ui/tray.go') diff --git a/ui/tray.go b/ui/tray.go index 749748ea..7b5e55ca 100644 --- a/ui/tray.go +++ b/ui/tray.go @@ -234,28 +234,23 @@ func (tray *Tray) updateGlobalState(globalState service.TunnelState) { } } + tray.SetToolTip(fmt.Sprintf("WireGuard: %s", textForState(globalState, true))) + statusAction.SetText(fmt.Sprintf("Status: %s", textForState(globalState, false))) + switch globalState { case service.TunnelStarting: - statusAction.SetText("Status: Activating") setTunnelActionsEnabled(false) - tray.SetToolTip("WireGuard: Activating...") case service.TunnelStarted: activeCIDRsAction.SetVisible(true) - statusAction.SetText("Status: Active") setTunnelActionsEnabled(true) - tray.SetToolTip("WireGuard: Activated") case service.TunnelStopping: - statusAction.SetText("Status: Deactivating") setTunnelActionsEnabled(false) - tray.SetToolTip("WireGuard: Deactivating...") case service.TunnelStopped: activeCIDRsAction.SetVisible(false) - statusAction.SetText("Status: Inactive") setTunnelActionsEnabled(true) - tray.SetToolTip("WireGuard: Deactivated") } } -- cgit v1.2.3-59-g8ed1b