diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-06 18:13:51 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-07 07:30:36 +0200 |
commit | 630504d0190570813fabdfc45d4fd798ffb4d372 (patch) | |
tree | e7fbbd65401176ea338893ff68ccab1d00e0f350 /ui/listview.go | |
parent | ui: confview should be more picky about which tunnel (diff) | |
download | wireguard-windows-630504d0190570813fabdfc45d4fd798ffb4d372.tar.xz wireguard-windows-630504d0190570813fabdfc45d4fd798ffb4d372.zip |
ui: move things out of iconprovider
Diffstat (limited to 'ui/listview.go')
-rw-r--r-- | ui/listview.go | 18 |
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 { |