docs: Link to the GObject how-to from the GType tutorial

So that first-time users don’t fall into the trap of reading about the
gory memory layout details of GType and GObject when all they wanted to
do was derive a class.

https://bugzilla.gnome.org/show_bug.cgi?id=744060
This commit is contained in:
Philip Withnall 2015-02-19 14:12:50 +00:00
parent cd0d605b23
commit a86ef242e4

View File

@ -342,11 +342,13 @@ G_DEFINE_TYPE (MamanBar, maman_bar, G_TYPE_OBJECT)
<para>
A lot of types are not instantiable by the type system and do not have
a class. Most of these types are fundamental trivial types such as <emphasis>gchar</emphasis>,
registered in <function>_g_value_types_init</function> (in <filename>gvaluetypes.c</filename>).
and are already registered in <function>_g_value_types_init</function>
(in <filename>gvaluetypes.c</filename>).
</para>
<para>
To register such a type in the type system, you just need to fill the
In the rare case of needing to register such a type in the type
system, fill a
<link linkend="GTypeInfo"><type>GTypeInfo</type></link> structure with zeros since these types are also most of the time
fundamental:
<informalexample><programlisting>
@ -392,6 +394,12 @@ G_DEFINE_TYPE (MamanBar, maman_bar, G_TYPE_OBJECT)
<sect1 id="gtype-instantiable-classed">
<title>Instantiable classed types: objects</title>
<para>
This section covers the theory behind objects. See
<xref linkend="howto-gobject"/> for the recommended way to define a
GObject.
</para>
<para>
Types which are registered with a class and are declared instantiable are
what most closely resembles an <emphasis>object</emphasis>.
@ -657,6 +665,12 @@ void g_type_free_instance (GTypeInstance *instance);
<sect1 id="gtype-non-instantiable-classed">
<title>Non-instantiable classed types: interfaces</title>
<para>
This section covers the theory behind interfaces. See
<xref linkend="howto-interface"/> for the recommended way to define an
interface.
</para>
<para>
GType's interfaces are very similar to Java's interfaces. They allow
to describe a common API that several classes will adhere to.