Add functionality which original GObject has.
I propose next changes.
Add one line to GObjectAPI interface:
Pointer g_object_class_list_properties(Pointer oclass, IntByReference size);
Add two methods to GObject implementation:
public List<String> listPropertyNames() {
GObjectAPI.GParamSpec[] lst = listProperties();
List<String> result = new ArrayList<String>(lst.length);
for (int i = 0; i < lst.length; i++) {
result.add(lst[i].g_name);
}
return result;
}
private GObjectAPI.GParamSpec[] listProperties() {
IntByReference len = new IntByReference();
Pointer ptrs = GOBJECT_API.g_object_class_list_properties(handle().getPointer(0), len);
if (ptrs == null)
return null;
GParamSpec[] props = new GParamSpec[len.getValue()];
int offset = 0;
for (int i = 0; i < len.getValue(); i++) {
props[i] = new GObjectAPI.GParamSpec(ptrs.getPointer(offset));
offset += Pointer.SIZE;
}
return props;
}
I have checked this code - it works for me.
Original issue reported on code.google.com by igor.laz...@gmail.com on 20 Nov 2012 at 2:49
Original issue reported on code.google.com by
igor.laz...@gmail.com
on 20 Nov 2012 at 2:49