This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

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

<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>

<parameter name="protocol" direction="out" c:owner="caller"/>
  <type name="String">
</parameter>

<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>

<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>

2024-10-23 11:36