// GetStyleProperty is a wrapper around gtk_style_context_get_style_property(). func (v *StyleContext) GetStyleProperty(property string) (interface{}, error) { cstr := (*C.gchar)(C.CString(property)) defer C.free(unsafe.Pointer(cstr)) var gval C.GValue C.gtk_style_context_get_style_property(v.native(), cstr, &gval) val := glib.ValueFromNative(unsafe.Pointer(&gval)) return val.GoValue() }
func sliceFromGValueArray(a *C.GValueArray) GValueArray { n := uint(a.n_values) s := make(GValueArray, n) for i := uint(0); i < n; i++ { cv := C.g_value_array_get_nth(a, C.guint(i)) v, _ := glib.ValueFromNative(unsafe.Pointer(cv)).GoValue() s[i] = v } return s }
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 }