After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 688014 - Impossible to find a GParamSpecOverride
Impossible to find a GParamSpecOverride
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gobject
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-11-09 21:42 UTC by Youness Alaoui
Modified: 2018-05-24 14:48 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Youness Alaoui 2012-11-09 21:42:22 UTC
I'm currently having an issue in finding the right GParamSpec for an overridden proprety. The GParamSpec needs to have a valid param_id, but it's only possible to get the redirect target which has param_id = 0.

The situation is the following. I'm implementing a GStreamer source element that implements the GstPhotography interface (http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-plugins/html/GstPhotography.html). So, I need to override the interface's property by calling g_object_class_override_property.
This will cause a new GParamSpecOverride to be created internally and added to the object type's GParamSpecPool.
Now, at the same time, I also want to implement the GstPropertyProbe interface (http://www.freedesktop.org/software/gstreamer-sdk/data/docs/latest/gst-plugins-base-libs-0.10/gst-plugins-base-libs-gstpropertyprobe.html) which allows us to probe for valid values of a property (useful for listing which devices are available, or in my case which zoom levels are supported by the camera).

The GstPropertyProbe interface will expect me to return a list of GParamSpec for the properties that support 'probing'. When a user probes the property, it will call my function with the property_id of the GParamSpec I gave it (pspec->param_id).

If I use g_object_class_find_property, I will get the overriden property which has param_id set to 0. If I call g_param_spec_get_redirect_target, it returns NULL since its purpose is to find the target of a GParamSpecOverride and not the other way around.
If I call g_object_class_list_properties, then the list will also have the GParamSpecs with param_id=0, since the list gets pruned and the overriden and redirected specs are removed from the list.
I've looked at the gparam.c and gobject.c code and couldn't find any way to get the property override or the param_id of an overriden property.

This forces me to either g_strcmp0 on the property name, or to store the result of the g_object_class_find_property and if/else over them. I cannot use a simple switch/case on the property id anymore.

Could we get the inverse function of g_param_spec_get_redirect_target? or a way to retreive the param_id of an overriden property for a specific owner_type? or to just be able to list all of the GParamSpec without the redirects being removed from the list?

Thanks.
Comment 1 Stefan Sauer (gstreamer, gtkdoc dev) 2015-02-04 20:28:35 UTC
See also bug #744011
Comment 2 GNOME Infrastructure Team 2018-05-24 14:48:42 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/627.