GNOME Bugzilla – Bug 641781
Using [CCode (cname = "…")] with property getters doesn't work
Last modified: 2011-02-08 17:08:08 UTC
The following Vala code: public GLib.List<Backend> enabled_backends { owned get { var backends = new GLib.List<Backend> (); foreach (var backend in this._prepared_backends.values) backends.prepend (backend); return backends; } private set {} } results in the following C declaration: GList* folks_backend_store_get_enabled_backends (FolksBackendStore* self); If a CCode attribute is added to the getter as follows: public GLib.List<Backend> enabled_backends { [CCode (cname = "folks_backend_store_dup_enabled_backends")] owned get { … the following C declaration is (correctly) generated: GList* folks_backend_store_dup_enabled_backends (FolksBackendStore* self); However, the get_property method for the class still refers to the property getter by its old name: static void _vala_folks_backend_store_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { FolksBackendStore * self; self = FOLKS_BACKEND_STORE (object); switch (property_id) { case FOLKS_BACKEND_STORE_ENABLED_BACKENDS: g_value_set_pointer (value, folks_backend_store_get_enabled_backends (self)); break; Everything else seems to use the new name of the C getter function correctly, though.
commit b0a3014bbe40b96ea543853060d4faeb41f75cf0 Author: Jürg Billeter <j@bitron.ch> Date: Tue Feb 8 09:06:09 2011 +0100 codegen: Fix property accessor definitions with custom cname Fixes bug 641781.