aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui
diff options
context:
space:
mode:
authorAlexander Neumann <alexander.neumann@picos-software.com>2019-04-08 15:30:10 +0200
committerAlexander Neumann <alexander.neumann@picos-software.com>2019-04-23 11:04:59 +0200
commit83b2bf92ac4c398eeaec740e1b0ae5ad0bc2a1b0 (patch)
tree18b418b2aeab9850cc19d4b2d9bdf3af44a9c5ea /ui
parentui: update status and active CIDRs menu items (diff)
downloadwireguard-windows-83b2bf92ac4c398eeaec740e1b0ae5ad0bc2a1b0.tar.xz
wireguard-windows-83b2bf92ac4c398eeaec740e1b0ae5ad0bc2a1b0.zip
ui: replace PrivateKeyEvent with walk.StringEvent
Signed-off-by: Alexander Neumann <alexander.neumann@picos-software.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/syntax/syntaxedit.go39
1 files changed, 2 insertions, 37 deletions
diff --git a/ui/syntax/syntaxedit.go b/ui/syntax/syntaxedit.go
index 95cf576c..5598d7a8 100644
--- a/ui/syntax/syntaxedit.go
+++ b/ui/syntax/syntaxedit.go
@@ -18,45 +18,10 @@ import (
// #include "syntaxedit.h"
import "C"
-type PrivateKeyHandler func(privateKey string)
-type PrivateKeyEvent struct {
- handlers []PrivateKeyHandler
-}
-
-func (e *PrivateKeyEvent) Attach(handler PrivateKeyHandler) int {
- for i, h := range e.handlers {
- if h == nil {
- e.handlers[i] = handler
- return i
- }
- }
-
- e.handlers = append(e.handlers, handler)
- return len(e.handlers) - 1
-}
-func (e *PrivateKeyEvent) Detach(handle int) {
- e.handlers[handle] = nil
-}
-
-type PrivateKeyPublisher struct {
- event PrivateKeyEvent
-}
-
-func (p *PrivateKeyPublisher) Event() *PrivateKeyEvent {
- return &p.event
-}
-func (p *PrivateKeyPublisher) Publish(privateKey string) {
- for _, handler := range p.event.handlers {
- if handler != nil {
- handler(privateKey)
- }
- }
-}
-
type SyntaxEdit struct {
walk.WidgetBase
textChangedPublisher walk.EventPublisher
- privateKeyPublisher PrivateKeyPublisher
+ privateKeyPublisher walk.StringEventPublisher
}
func (se *SyntaxEdit) LayoutFlags() walk.LayoutFlags {
@@ -94,7 +59,7 @@ func (se *SyntaxEdit) TextChanged() *walk.Event {
return se.textChangedPublisher.Event()
}
-func (se *SyntaxEdit) PrivateKeyChanged() *PrivateKeyEvent {
+func (se *SyntaxEdit) PrivateKeyChanged() *walk.StringEvent {
return se.privateKeyPublisher.Event()
}