mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 09:46:17 +01:00
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:
parent
cd0d605b23
commit
a86ef242e4
@ -342,11 +342,13 @@ G_DEFINE_TYPE (MamanBar, maman_bar, G_TYPE_OBJECT)
|
|||||||
<para>
|
<para>
|
||||||
A lot of types are not instantiable by the type system and do not have
|
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>,
|
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>
|
||||||
|
|
||||||
<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
|
<link linkend="GTypeInfo"><type>GTypeInfo</type></link> structure with zeros since these types are also most of the time
|
||||||
fundamental:
|
fundamental:
|
||||||
<informalexample><programlisting>
|
<informalexample><programlisting>
|
||||||
@ -392,6 +394,12 @@ G_DEFINE_TYPE (MamanBar, maman_bar, G_TYPE_OBJECT)
|
|||||||
<sect1 id="gtype-instantiable-classed">
|
<sect1 id="gtype-instantiable-classed">
|
||||||
<title>Instantiable classed types: objects</title>
|
<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>
|
<para>
|
||||||
Types which are registered with a class and are declared instantiable are
|
Types which are registered with a class and are declared instantiable are
|
||||||
what most closely resembles an <emphasis>object</emphasis>.
|
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">
|
<sect1 id="gtype-non-instantiable-classed">
|
||||||
<title>Non-instantiable classed types: interfaces</title>
|
<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>
|
<para>
|
||||||
GType's interfaces are very similar to Java's interfaces. They allow
|
GType's interfaces are very similar to Java's interfaces. They allow
|
||||||
to describe a common API that several classes will adhere to.
|
to describe a common API that several classes will adhere to.
|
||||||
|
Loading…
Reference in New Issue
Block a user