diff options
| author | Pietro Gagliardi <[email protected]> | 2014-07-08 12:04:51 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-07-08 12:04:51 -0400 |
| commit | 60d0953fe9f16726958f709007402ea4c8b89fc6 (patch) | |
| tree | d3704828dad002c1144626aaec1f3e5cc5560041 /redo/uitask.go | |
| parent | be56707c51a411c5e8228a78d663c91df4636128 (diff) | |
Implemented the Window OnClosing() event on GTK+. It works!
Diffstat (limited to 'redo/uitask.go')
| -rw-r--r-- | redo/uitask.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/redo/uitask.go b/redo/uitask.go index 76908fb..462a24b 100644 --- a/redo/uitask.go +++ b/redo/uitask.go @@ -45,10 +45,23 @@ type event struct { lock sync.Mutex } +// do should never be nil; TODO should we make setters panic instead? + +func newEvent() *event { + return &event{ + do: func(c Doer) bool { + return false + }, + } +} + func (e *event) set(f func(Doer)) { e.lock.Lock() defer e.lock.Unlock() + if f == nil { + f = func(c Doer) {} + } e.do = func(c Doer) bool { f(c) return false @@ -59,6 +72,11 @@ func (e *event) setbool(f func(Doer) bool) { e.lock.Lock() defer e.lock.Unlock() + if f == nil { + f = func(c Doer) bool { + return false + } + } e.do = f } |
