예제 #1
0
파일: gobject_ext.go 프로젝트: reusee/ggir
func Connect(obj unsafe.Pointer, signal string, cb interface{}) uint64 {
	cbp := &cb
	refHolderLock.Lock()
	refHolder = append(refHolder, cbp) //FIXME deref
	refHolderLock.Unlock()
	closure := C.new_closure(unsafe.Pointer(cbp))
	cSignal := (*C.gchar)(unsafe.Pointer(C.CString(signal)))
	defer C.free(unsafe.Pointer(cSignal))
	id := C.g_signal_connect_closure(C.gpointer(obj), cSignal, closure, C.gboolean(0))
	return uint64(id)
}
예제 #2
0
파일: gst.go 프로젝트: reusee/oplay
func ObjConnect(obj *C.GObject, signal string, cb interface{}) C.gulong {
	cbp := &cb
	refHolderLock.Lock()
	refHolder = append(refHolder, cbp) //TODO deref
	refHolderLock.Unlock()
	closure := C.new_closure(unsafe.Pointer(cbp))
	cSignal := (*C.gchar)(unsafe.Pointer(C.CString(signal)))
	defer C.free(unsafe.Pointer(cSignal))
	id := C.g_signal_connect_closure(asGPtr(obj), cSignal, closure, False())
	return id
}