diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2021-06-16 19:17:27 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2021-08-05 17:47:29 +0100 |
commit | 3ec400b09fb15c9f7392b77b0c3fb324ee08beed (patch) | |
tree | 39776e85364d56a1b13c1a8773af6b771b6c14b3 /giscanner/girwriter.py | |
parent | 700e8776b7942b204b86748d266c895b08d59823 (diff) | |
download | gobject-introspection-3ec400b09fb15c9f7392b77b0c3fb324ee08beed.tar.gz |
Add new annotations for property accessors
We introduce two new annotations:
- (set-property PROPERTY_NAME)
- (get-property PROPERTY_NAME)
These annotations are valid inside function blocks for methods on
objects and interfaces, and define whether a function is a property
accessor, e.g.:
/**
* gtk_widget_set_name: (set-property name)
* @self: ...
* @name: ...
*
* ...
*/
/**
* gtk_widget_get_name: (get-property name)
* @self: ...
*
* ...
*
* Returns: ...
*/
The annotations are transformed into the GIR data as attributes:
- glib:set-property="PROPERTY_NAME"
- glib:get-property="PROPERTY_NAME"
The underlying typelib data has had flags for setter and getter
functions for a while, but they have never been plugged into the GIR
data or the introspection scanner. Now they are; you can retrieve the
GIPropertyInfo from a GIFunctionInfo that has the GI_FUNCTION_IS_SETTER
or GI_FUNCTION_IS_GETTER flags set.
Fixes: #13
Diffstat (limited to 'giscanner/girwriter.py')
-rw-r--r-- | giscanner/girwriter.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py index d276e923..9551f18f 100644 --- a/giscanner/girwriter.py +++ b/giscanner/girwriter.py @@ -224,6 +224,10 @@ class GIRWriter(XMLWriter): attrs.append(('shadows', func.shadows)) if func.moved_to is not None: attrs.append(('moved-to', func.moved_to)) + if func.set_property is not None: + attrs.append(('glib:set-property', func.set_property)) + if func.get_property is not None: + attrs.append(('glib:get-property', func.get_property)) self._write_callable(func, tag_name, attrs) def _write_function_macro(self, macro): |