Esempio n. 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()))

}
Esempio n. 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
}
Esempio n. 3
0
File: glib.go Progetto: leif/go-gtk
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)
}
Esempio n. 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))
}
Esempio n. 5
0
File: gst.go Progetto: reusee/oplay
func ObjSet(obj *C.GObject, name string, value interface{}) {
	C.g_object_set_property(obj, toGStr(name), toGValue(value))
}
Esempio n. 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
}
Esempio n. 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())
}