summaryrefslogtreecommitdiff
path: root/uitask_unix.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-16 17:09:58 -0500
committerPietro Gagliardi <[email protected]>2014-02-16 17:09:58 -0500
commit1bcbce414287a9eecfd291522f4a8e2dd0c28102 (patch)
tree865fe3950f4c37545748f1f6429bea5f951689bc /uitask_unix.go
parentf5652737ebbd44310a7a19815c88f7f83d67a3a9 (diff)
Cleaned up the idle callback code.
Diffstat (limited to 'uitask_unix.go')
-rw-r--r--uitask_unix.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/uitask_unix.go b/uitask_unix.go
index 0c0152f..67d815e 100644
--- a/uitask_unix.go
+++ b/uitask_unix.go
@@ -21,17 +21,18 @@ func ui(initDone chan error) {
}
initDone <- nil
+ // thanks to tristan in irc.gimp.net/#gtk
+ gdk_threads_add_idle(func() bool {
+ select {
+ case f := <-uitask:
+ f()
+ default: // do not block
+ }
+ return true // don't destroy the callback
+ })
gtk_main()
}
-func uistep() {
- select {
- case f := <-uitask:
- f()
- default: // do not block
- }
-}
-
// temporary
func MsgBox(string, string, ...interface{}) {}
func MsgBoxError(title string, text string, args ...interface{}) {panic(title+"\n"+fmt.Sprintf(text,args...))}