Пример #1
0
func (v *GObject) SetData(s string, p unsafe.Pointer) {
	ptr := C.CString(s)
	defer C.free_string(ptr)
	C.g_object_set_data((*C.GObject)(v.Object), C.to_gcharptr(ptr), (C.gpointer)(p))
}
Пример #2
0
/*
Each object carries around a table of associations from
strings to pointers.  This function lets you set an association.

If the object already had an association with that name,
the old association will be destroyed.
*/
func (self *TraitObject) SetData(key string, data unsafe.Pointer) {
	__cgo__key := (*C.gchar)(unsafe.Pointer(C.CString(key)))
	C.g_object_set_data(self.CPointer, __cgo__key, (C.gpointer)(data))
	C.free(unsafe.Pointer(__cgo__key))
	return
}