From a86ef242e4f2907ec1399057f194699f2fe28c94 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 19 Feb 2015 14:12:50 +0000 Subject: [PATCH] docs: Link to the GObject how-to from the GType tutorial MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- docs/reference/gobject/tut_gtype.xml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/reference/gobject/tut_gtype.xml b/docs/reference/gobject/tut_gtype.xml index 2acc26311..9dbde9a16 100644 --- a/docs/reference/gobject/tut_gtype.xml +++ b/docs/reference/gobject/tut_gtype.xml @@ -342,11 +342,13 @@ G_DEFINE_TYPE (MamanBar, maman_bar, G_TYPE_OBJECT) 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 gchar, - registered in _g_value_types_init (in gvaluetypes.c). + and are already registered in _g_value_types_init + (in gvaluetypes.c). - 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 GTypeInfo structure with zeros since these types are also most of the time fundamental: @@ -392,6 +394,12 @@ G_DEFINE_TYPE (MamanBar, maman_bar, G_TYPE_OBJECT) Instantiable classed types: objects + + This section covers the theory behind objects. See + for the recommended way to define a + GObject. + + Types which are registered with a class and are declared instantiable are what most closely resembles an object. @@ -657,6 +665,12 @@ void g_type_free_instance (GTypeInstance *instance); Non-instantiable classed types: interfaces + + This section covers the theory behind interfaces. See + for the recommended way to define an + interface. + + GType's interfaces are very similar to Java's interfaces. They allow to describe a common API that several classes will adhere to.