## Writing API docs

The API documentation for most of the GLib, GObject, GTK+ and GNOME libraries is built with a combination of complex tools. Typically, the part of the documentation which describes the behavior of each function is extracted from the specially-formatted source code comments by a tool named gtk-doc which generates DocBook XML and merges this DocBook XML with a set of master XML DocBook files. These XML DocBook files are finally processed with xsltproc (a small program part of the libxslt library) to generate the final HTML output. Other tools can be used to generate PDF output from the source XML. The following code excerpt shows what these comments look like.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13

    /**
     * gtk_widget_freeze_child_notify:
     * @widget: a #GtkWidget
     *
     * Stops emission of "child-notify" signals on @widget. The signals are
     * queued until gtk_widget_thaw_child_notify() is called on @widget.
     *
     * This is the analogue of g_object_freeze_notify() for child properties.
     **/
    void
    gtk_widget_freeze_child_notify (GtkWidget *widget)
    {
    ...

Thorough documentation on how to set up and use gtk-doc in your project is provided on the GNOME developer website.