From 1bcbce414287a9eecfd291522f4a8e2dd0c28102 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 16 Feb 2014 17:09:58 -0500 Subject: Cleaned up the idle callback code. --- uitask_unix.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'uitask_unix.go') 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...))} -- cgit v1.2.3