Contents
This a C language namespace extension to the Core namespace.
C-specific meta data
The C part of the meta data adds C-specific information about interface elements. To use it, you need to declare it in the XML header:
<?xml version='1.0' xmlns="http://www.gtk.org/introspection/1.0/core" xmlns:c="http://www.gtk.org/introspection/1.0/lang/c" ?>
Additions usable for most tags
- To specify the full C name of an abstract symbol, use "c:identifier". For example:
<class name="Window" parent="Widget" c:identifier="GtkWindow"> .... </class>
Additions usable for <type>
Use <c:typename> to specify the C identifier of a type. Use <c:pointer> to denote pointers.
<parameter name="src"> <type name="String"> <c:pointer const="1"> <c:type name="xmlChar"/> <c:pointer> </type> </parameter>
Additions usable for <parameter> and <return-value>
- To specify who owns a parameter or a return value, use "c:owner". Allowed values: caller, callee. For example:
<parameter name="protocol" direction="out" c:owner="caller"/> <type name="String"> </parameter>
- To specify that a parameter or a return value is to be freed with a special free function, use "c:free-function".
<return-value> <type name="String" c:owner="caller" c:free-function="xml_string_free"> <c:pointer const="1"> <c:type name="xmlChar"/> <c:pointer> </type> </return-value>
- To specify how an abstract callback parameter maps to C types, use c:user-data and c:destroy-notification along with c:parameter-index. For example:
<parameter name="callback"> <type name="LoadIconFunction"> <c:user-data name="user_data" c:parameter-index="2"/> <c:destroy-notification name="destroy_notify" c:parameter-index="3"/> </type> </parameter>
Examples
A method with a default value which may be NULL
<method name="set_title"> <c:identifier name="gtk_window_set_title" /> <parameter name="title"> <type name="String"> <none-allowed/> <c:pointer const="1"> <c:type name name="gchar" /> </c:pointer> <default value="hello world" /> </type> </parameter> </method>
A typedef
<c:typedef name="GCallback"> <c:pointer> <c:function> <c:return> <c:basictype name="void"/> <!-- return type -->/ </c:return> <c:parameters> <c:symbol name="some_parameter"> <c:basictype name="int"> </c:symbol> </c:paramters> </c:function> </c:pointer> </c:typedef>