diff options
| author | Pietro Gagliardi <[email protected]> | 2014-02-16 15:55:51 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-02-16 15:55:51 -0500 |
| commit | 21c1ec6f83fb2d5cb80c02c0cd7ed51bb4e06e3a (patch) | |
| tree | 754d4e8e6cffb459b1eed11a9acd46b676f6a090 /uitask_unix.go | |
| parent | 3a99ee65697ba39397b437c5545530b0b948ce4e (diff) | |
Added the beginning of the Unix (GTK+) implementation.
Diffstat (limited to 'uitask_unix.go')
| -rw-r--r-- | uitask_unix.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/uitask_unix.go b/uitask_unix.go new file mode 100644 index 0000000..0c0152f --- /dev/null +++ b/uitask_unix.go @@ -0,0 +1,37 @@ +// +build !windows,!darwin,!plan9 + +// 16 february 2014 +//package ui +package main + +import ( + "fmt" + "runtime" +) + +var uitask chan func() + +func ui(initDone chan error) { + runtime.LockOSThread() + + uitask = make(chan func()) + if gtk_init() != true { + initDone <- fmt.Errorf("gtk_init failed (reason unknown; TODO)") + return + } + initDone <- nil + + 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...))} |
