示例#1
0
func (v *Structure) fromGstStructure(s *C.GstStructure) {
	v.Name = C.GoString((*C.char)(C.gst_structure_get_name(s)))
	n := uint(C.gst_structure_n_fields(s))
	v.Data = make(map[string]interface{})
	for i := uint(0); i < n; i++ {
		fn := C.gst_structure_nth_field_name(s, C.guint(i))
		fv := glib.ValueFromNative(unsafe.Pointer(C.gst_structure_id_get_value(s, C.g_quark_from_string(fn))))
		val, _ := fv.GoValue()
		v.Data[C.GoString((*C.char)(fn))] = val
	}
	return
}
示例#2
0
文件: gobj.go 项目: hwch/go-gtk
func NewQuarkFromString(s string) Quark {
	cs := _GString(s)
	quark := C.g_quark_from_string(cs)
	_GFree(unsafe.Pointer(cs))
	return Quark(quark)
}