doc: Interface for derivable object

This commit is contained in:
Pavlo Solntsev 2018-05-24 23:32:00 -05:00
parent d9df5d72e1
commit 9e62a425bd

View File

@ -1069,6 +1069,20 @@ viewer_file_init (ViewerFile *self)
{
/* Instance variable initialisation code. */
}
</programlisting></informalexample>
</para>
<para>
If the object is not of final type, e.g. was declared using
<function><link linkend="G-DECLARE-DERIVABLE-TYPE:CAPS">G_DECLARE_DERIVABLE_TYPE</link></function>
then
<function><link linkend="G-ADD-PRIVATE:CAPS">G_ADD_PRIVATE</link></function>
macro should be added. The private structure should be declared exactly
as for a normal derivable object, see <xref linkend="howto-gobject-code"/>.
<informalexample><programlisting>
G_DEFINE_TYPE_WITH_CODE (ViewerFile, viewer_file, G_TYPE_OBJECT,
G_ADD_PRIVATE (ViewerFile)
G_IMPLEMENT_INTERFACE (VIEWER_TYPE_EDITABLE,
viewer_file_editable_interface_init))
</programlisting></informalexample>
</para>
</sect1>