Next: , Previous: gnome gobject, Up: Top


3 (gnome gobject gtype)

3.1 Overview

Base support for the GLib type system.

The GLib runtime type system is broken into a number of modules, of which GType is the base. A GType is a simply a named type. Some types are fundamental and cannot be subclassed, such as integers. Others can form the root of complicated object hierarchies, such as <gobject>.

One can obtain the class for a type if you know its name. For example,

       (gtype-name->class "guint64") ⇒ #<<gvalue-class> <guint64>>
     

A more detailed reference on the GLib type system may be had at http://library.gnome.org/devel/gobject/stable/.

3.2 Usage

— Class: <gtype-class>

The metaclass of all GType classes. Ensures that GType classes have a gtype slot, which records the primitive GType information for this class.

— Class: <gtype-instance>

The root class of all instantiatable GType classes. Adds a slot, gtype-instance, to instances, which holds a pointer to the C value.

— Primitive: gtype-name->class name

Return the <gtype-class> associated with the GType, name.

— Function: class-name->gtype-name class-name

Convert the name of a class into a suitable name for a GType. For example:

           (class-name->gtype-name '<foo-bar>) ⇒ "FooBar"

— Function: gruntime-error format-string . args

Signal a runtime error. The error will be thrown to the key gruntime-error.

— Primitive: gtype-instance-destroy! instance

Release all references that the Scheme wrapper instance has on the underlying C value, and release pointers associated with the C value that point back to Scheme.

Normally, you don't need to call this function, because garbage collection will take care of resource management. However some <gtype-class> instances have semantics that require this function. The canonical example is that when a <gtk-object> emits the destroy signal, all code should drop their references to the object. This is, of course, handled internally in the (gnome gtk) module.