Esempio n. 1
0
func NewObject(t Type, params Params) *Object {
	if params == nil || len(params) == 0 {
		return &Object{C.g_object_newv(t.g(), 0, nil)}
	}
	p := make([]C.GParameter, len(params))
	i := 0
	for k, v := range params {
		s := C.CString(k)
		defer C.free(unsafe.Pointer(s))
		p[i].name = (*C.gchar)(s)
		p[i].value = *ValueOf(v).g()
		i++
	}
	return &Object{C.g_object_newv(t.g(), C.guint(i), &p[0])}
}
Esempio n. 2
0
/*
Creates a new instance of a #GObject subtype and sets its properties.

Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY)
which are not explicitly specified are set to their default values.
*/
func ObjectNewv(object_type C.GType, n_parameters uint, parameters *C.GParameter) (return__ *Object) {
	var __cgo__return__ interface{}
	__cgo__return__ = C.g_object_newv(object_type, C.guint(n_parameters), parameters)
	if __cgo__return__ != nil {
		return__ = NewObjectFromCPointer(unsafe.Pointer(reflect.ValueOf(__cgo__return__).Pointer()))
	}
	return
}