aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/listview.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-06 18:13:51 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-07 07:30:36 +0200
commit317e0df0e466356fd2787aea547e90b3fb1adf08 (patch)
treee7fbbd65401176ea338893ff68ccab1d00e0f350 /ui/listview.go
parentui: confview should be more picky about which tunnel (diff)
downloadwireguard-windows-317e0df0e466356fd2787aea547e90b3fb1adf08.tar.xz
wireguard-windows-317e0df0e466356fd2787aea547e90b3fb1adf08.zip
ui: move things out of iconprovider
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r--ui/listview.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/ui/listview.go b/ui/listview.go
index 2e9ee3a7..814a799b 100644
--- a/ui/listview.go
+++ b/ui/listview.go
@@ -122,10 +122,22 @@ func (tv *ListView) StyleCell(style *walk.CellStyle) {
b.Width -= b.Height
canvas.DrawText(tunnel.Name, tv.Font(), 0, b, walk.TextVCenter|walk.TextSingleLine)
- b.X = 0
+ //TODO: don't make an IPC call from the drawing thread like this!
+ state, err := tunnel.State()
+ if err != nil {
+ return
+ }
+ margin := tv.DPI() / 48 //TODO: Do some sort of dynamic DPI calculation here
+ b.X = margin
+ b.Y += margin
+ b.Height -= margin * 2
b.Width = b.Height
-
- iconProvider.PaintForTunnel(tunnel, canvas, b)
+ icon, err := iconProvider.IconForState(state)
+ if err != nil {
+ return
+ }
+ canvas.DrawImageStretched(icon, b)
+ icon.Dispose()
}
func (tv *ListView) CurrentTunnel() *service.Tunnel {