aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--ui/managewindow.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/ui/managewindow.go b/ui/managewindow.go
index cd42e58a..a1f9aa83 100644
--- a/ui/managewindow.go
+++ b/ui/managewindow.go
@@ -23,8 +23,7 @@ type ManageTunnelsWindow struct {
logPage *LogPage
updatePage *UpdatePage
- tunnelChangedCB *service.TunnelChangeCallback
- taskbarButtonCreated bool
+ tunnelChangedCB *service.TunnelChangeCallback
}
const (
@@ -142,17 +141,18 @@ func (mtw *ManageTunnelsWindow) updateProgressIndicator(globalState service.Tunn
default:
pi.SetState(walk.PINoProgress)
}
+ if icon, err := iconForState(globalState, mtw.DPI()/6); err == nil { //TODO: calculate DPI dynamically
+ if globalState == service.TunnelStopped {
+ icon = nil
+ }
+ pi.SetOverlayIcon(icon, textForState(globalState, false))
+ }
}
func (mtw *ManageTunnelsWindow) onTunnelChange(tunnel *service.Tunnel, state service.TunnelState, globalState service.TunnelState, err error) {
mtw.Synchronize(func() {
mtw.updateProgressIndicator(globalState)
- icon, err2 := iconWithOverlayForState(globalState, mtw.DPI()/3) //TODO: calculate DPI dynamically
- if err2 == nil {
- mtw.SetIcon(icon)
- }
-
if err != nil && mtw.Visible() {
errMsg := err.Error()
if len(errMsg) > 0 && errMsg[len(errMsg)-1] != '.' {
@@ -204,13 +204,14 @@ func (mtw *ManageTunnelsWindow) WndProc(hwnd win.HWND, msg uint32, wParam, lPara
return 0
case taskbarButtonCreatedMsg:
ret := mtw.FormBase.WndProc(hwnd, msg, wParam, lParam)
- if !mtw.taskbarButtonCreated {
- mtw.taskbarButtonCreated = true
+ go func() {
globalState, err := service.IPCClientGlobalState()
if err == nil {
- mtw.updateProgressIndicator(globalState)
+ mtw.Synchronize(func() {
+ mtw.updateProgressIndicator(globalState)
+ })
}
- }
+ }()
return ret
}