예제 #1
0
파일: gobject_ext.go 프로젝트: reusee/ggir
func fromGValue(v *C.GValue) (ret interface{}) {
	valueType := C.gvalue_get_type(v)
	fundamentalType := C.gtype_get_fundamental(valueType)
	switch fundamentalType {
	case C.G_TYPE_OBJECT:
		ret = unsafe.Pointer(C.g_value_get_object(v))
	case C.G_TYPE_STRING:
		ret = fromGStr(C.g_value_get_string(v))
	case C.G_TYPE_UINT:
		ret = int(C.g_value_get_uint(v))
	case C.G_TYPE_BOXED:
		ret = unsafe.Pointer(C.g_value_get_boxed(v))
	case C.G_TYPE_BOOLEAN:
		ret = C.g_value_get_boolean(v) == C.gboolean(1)
	default:
		fmt.Printf("from type %s %T\n", fromGStr(C.g_type_name(fundamentalType)), v)
		panic("FIXME") //TODO
	}
	return
}
예제 #2
0
파일: gst.go 프로젝트: reusee/oplay
func ValueGetType(v *C.GValue) C.GType {
	return C.gvalue_get_type(v)
}