From: gnome-perl (bugzilla.gnome.o. <bug...@gn...> - 2010-11-08 19:45:53
|
https://bugzilla.gnome.org/show_bug.cgi?id=570792 gnome-perl | Glib | unspecified --- Comment #1 from Kevin Ryde <us...@zi...> 2010-11-08 19:45:42 UTC --- Created an attachment (id=174092) View: https://bugzilla.gnome.org/attachment.cgi?id=174092 Review: https://bugzilla.gnome.org/review?bug=570792&attachment=174092 patch installing properties, but they don't reach GET_PROPERTY/SET_PROPERTY I think saying "interfaces => [ ... ]" could automatically add the interface properties. If you're implementing an interface then that'll be usually what you want. Worry about subtle variations later. I wondered if it was as easy as the gobject manual suggested and you just had to g_object_class_override_property() each of the g_object_interface_list_properties(). I even threw down the attached few lines to that end. However, The pspec which reaches gperl_type_get_property() is the underlying one out of the interface, and its pspec->owner_type is the interface, not the class implementing the interface. This means gperl_type_get_property() doesn't go to the class' GET_PROPERTY. The way g_object_get_property() looks through an override to the underlying can be seen in object_get_property() of gobject.c. I suppose someone thought that was a good idea. I suspect this is another case of the C code being oriented towards individual class funcs such as class->get_property implicitly knowing which class they're for, rather than a generic like gperl_type_get_property(). Perhaps the property_id number could encode something to identify the actual target class. Normally those ids are consecutive 1 to N, but I get the impression it's an arbitrary integer for use by the class in question. Second, I see g_object_class_override_property() looks first in parent classes and then in interfaces for a property of the given name. If a subclass has an interface with an interface property with the same name as a superclass property then g_object_class_override_property() might end up taking the superclass one as the target, not the interface. I suppose that affects C code as well. Unless the gobject manual has something better to say I suspect an explicit pspec = g_param_spec_override (name, iface_pspec); g_object_class_install_property (oclass, property_id, pspec); might be necessary to ensure it's the interface one which is installed. This sort of thing might come up if a subclass re-implements an interface already implemented in a superclass. That's fairly common of course if a subclass wants to do things slightly differently. Eg. I've made various subclasses redoing TreeDragSource to have different answers about draggability. Whether there's any like that with interface properties would be another matter. -- Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. |