2014-07-17 22:50:14 -05:00
|
|
|
// +build !windows,!darwin
|
2014-07-08 15:47:28 -05:00
|
|
|
|
2014-07-07 20:04:44 -05:00
|
|
|
// 7 july 2014
|
|
|
|
|
|
|
|
package ui
|
|
|
|
|
|
|
|
import (
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
// #cgo pkg-config: gtk+-3.0
|
|
|
|
// #include "gtk_unix.h"
|
|
|
|
// extern gboolean doissue(gpointer data);
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
func uiinit() error {
|
2014-07-07 21:46:23 -05:00
|
|
|
// TODO replace with the error-checking version
|
|
|
|
C.gtk_init(nil, nil)
|
2014-07-07 20:04:44 -05:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func uimsgloop() {
|
|
|
|
C.gtk_main()
|
|
|
|
}
|
|
|
|
|
2014-07-13 19:31:08 -05:00
|
|
|
func uistop() {
|
|
|
|
C.gtk_main_quit()
|
|
|
|
}
|
|
|
|
|
2014-07-07 20:04:44 -05:00
|
|
|
func issue(req *Request) {
|
|
|
|
C.gdk_threads_add_idle(C.GSourceFunc(C.doissue), C.gpointer(unsafe.Pointer(req)))
|
|
|
|
}
|
|
|
|
|
|
|
|
//export doissue
|
|
|
|
func doissue(data C.gpointer) C.gboolean {
|
|
|
|
req := (*Request)(unsafe.Pointer(data))
|
2014-07-07 23:29:43 -05:00
|
|
|
perform(req)
|
2014-07-07 20:04:44 -05:00
|
|
|
return C.FALSE // don't repeat
|
|
|
|
}
|