Ejemplo n.º 1
0
Archivo: gobj.go Proyecto: hwch/go-gtk
func ObjectWrap(c unsafe.Pointer, grab bool) unsafe.Pointer {
	if c == nil {
		return nil
	}
	obj := (*Object)(C.g_object_get_qdata((*C.GObject)(c), C.GQuark(go_repr)))
	if obj != nil {
		return unsafe.Pointer(obj)
	}
	obj = &Object{c}
	if grab {
		C.g_object_ref_sink(C.gpointer(obj.C))
	}
	setObjectFinalizer(obj)
	C.g_object_set_qdata((*C.GObject)(obj.C),
		C.GQuark(go_repr), unsafe.Pointer(obj))
	return unsafe.Pointer(obj)
}
Ejemplo n.º 2
0
/*
This function gets back user data pointers stored via
g_object_set_qdata().
*/
func (self *TraitObject) GetQdata(quark C.GQuark) (return__ unsafe.Pointer) {
	var __cgo__return__ C.gpointer
	__cgo__return__ = C.g_object_get_qdata(self.CPointer, quark)
	return__ = unsafe.Pointer(__cgo__return__)
	return
}