Beispiel #1
0
func SetProperty(obj ObjectLike, propName string, value interface{}) {
	cpn := GString(propName)
	defer cpn.Free()
	v := ConvertToC(value)
	defer v.Free()

	C.g_object_set_property(C.to_GObject(obj.ToNative()), (*C.gchar)(cpn.GetPtr()),
		(*C.GValue)(v.ToCGValue()))

}
Beispiel #2
0
// SetProperty is a wrapper around g_object_set_property().
func (v *Object) SetProperty(name string, value interface{}) error {
	cstr := C.CString(name)
	defer C.free(unsafe.Pointer(cstr))

	if _, ok := value.(Object); ok {
		value = value.(Object).GObject
	}

	p, err := GValue(value)
	if err != nil {
		return errors.New("Unable to perform type conversion")
	}
	C.g_object_set_property(v.GObject, (*C.gchar)(cstr), p.native())
	return nil
}
Beispiel #3
0
func (v *GObject) SetProperty(name string, val *GValue) {
	str := C.CString(name)
	defer C.free_string(str)
	C.g_object_set_property(C.to_GObject(v.Object), C.to_gcharptr(str), &val.Value)
}
Beispiel #4
0
func ObjSet(o interface{}, name string, value interface{}) {
	obj := (*C.GObject)(unsafe.Pointer(reflect.ValueOf(o).Pointer()))
	C.g_object_set_property(obj, toGStr(name), toGValue(value))
}
Beispiel #5
0
func ObjSet(obj *C.GObject, name string, value interface{}) {
	C.g_object_set_property(obj, toGStr(name), toGValue(value))
}
Beispiel #6
0
/*
Sets a property on an object.
*/
func (self *TraitObject) SetProperty(property_name string, value *C.GValue) {
	__cgo__property_name := (*C.gchar)(unsafe.Pointer(C.CString(property_name)))
	C.g_object_set_property(self.CPointer, __cgo__property_name, value)
	C.free(unsafe.Pointer(__cgo__property_name))
	return
}
Beispiel #7
0
func (o *Object) SetProperty(name string, val interface{}) {
	s := C.CString(name)
	defer C.free(unsafe.Pointer(s))
	C.g_object_set_property(o.g(), (*C.gchar)(s),
		ValueOf(val).g())
}