From 47d4ea5f83bbf268d7e5c1d79b799e44db7805eb Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 10 Jun 2004 20:21:59 +0000 Subject: [PATCH] integrate the last changes by Stefan --- docs/reference/gobject/tut_gsignal.xml | 2 +- docs/reference/gobject/tut_gtype.xml | 46 ++++++++++++++++++-------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/docs/reference/gobject/tut_gsignal.xml b/docs/reference/gobject/tut_gsignal.xml index 2a658c857..d1b2f17e7 100644 --- a/docs/reference/gobject/tut_gsignal.xml +++ b/docs/reference/gobject/tut_gsignal.xml @@ -173,7 +173,7 @@ g_cclosure_marshal_VOID__INT (GClosure *closure, GObject's signals have nothing to do with standard UNIX signals: they connect arbitrary application-specific events with any number of listeners. - For example, in GTK, every user event (keystroke or mouse move) is received + For example, in GTK+, every user event (keystroke or mouse move) is received from the X server and generates a GTK+ event under the form of a signal emission on a given object instance. diff --git a/docs/reference/gobject/tut_gtype.xml b/docs/reference/gobject/tut_gtype.xml index fc9d4a26e..59fd5acaa 100644 --- a/docs/reference/gobject/tut_gtype.xml +++ b/docs/reference/gobject/tut_gtype.xml @@ -250,9 +250,10 @@ struct _GTypeValueTable Create a macro named PREFIX_OBJECT (obj) which returns a pointer of type PrefixObject. This macro is used to enforce static type safety by doing explicit casts wherever needed. It also enforces - dynamic type safety by doing runtime checks. It is expected that in production - builds, the dynamic type checks are disabled: they should be used only in - development environments. For example, we would create + dynamic type safety by doing runtime checks. It is possible to disable the dynamic + type checks in production builds (see + http://developer.gnome.org/doc/API/2.0/glib/glib-building.html). + For example, we would create MAMAN_BAR (obj) to keep the previous example. If the type is classed, create a macro named @@ -367,11 +368,20 @@ GType maman_bar_get_type (void) Types which are registered with a class and are declared instantiable are - what most closely resembles an object. The code below - shows how you could register such a type in the type system: + what most closely resembles an object. + Although GObjects (detailed in ) + are the most well known type of instantiable + classed types, other kinds of similar objects used as the base of an inheritance + hierarchy have been externally developped and they are all built on the fundamental + features described below. + + + + For example, the code below shows how you could register + such a fundamental object type in the type system: typedef struct { - Object parent; + GObject parent; /* instance members */ int field_a; } MamanBar; @@ -474,20 +484,21 @@ typedef struct { object instance by doing: B *b; -b->parent.parent_class->g_class.g_type +b->parent.parent.g_class->g_type or, more quickly: B *b; -((GTypeInstance*)b)->g_class.g_type +((GTypeInstance*)b)->g_class->g_type - Instanciation of these types can be done with g_type_create_instance: + Instanciation of these types can be done with + g_type_create_instance: -GTypeInstance* g_type_create_instance (GType type); -void g_type_free_instance (GTypeInstance *instance); +GTypeInstance* g_type_create_instance (GType type); +void g_type_free_instance (GTypeInstance *instance); g_type_create_instance will lookup the type information structure associated to the type requested. Then, the instance size and instanciation @@ -530,9 +541,16 @@ The class initialization process is entirely implemented in - Class destruction (called finalization in Gtype) is the symmetric process of the initialization: - it is implemented in type_data_finalize_class_U (in gtype.c - , as usual...). Interfaces are first destroyed. Then, the most derived + Class destruction + + It is implemented in type_data_finalize_class_U + (in gtype.c. + + + (the concept of destruction is sometimes partly refered to as finalization + in Gtype) is the symmetric process of the initialization: interfaces are + destroyed first. + Then, the most derived class_finalize (ClassFinalizeFunc) function is invoked. The base_class_finalize (GBaseFinalizeFunc) functions are Finally invoked from bottom-most most-derived type to top-most fundamental type and