cl-gtk2-gobject
***************

Introduction
************

GObject is a part of GLib library that implements the type system. The CL-GTK2-GObject is a Common Lisp binding for relevant parts of GObject.

Installation
************

CL-GTK2-GObject comes as a part of CL-GTK2 bindings that are avaiable at its website.

To use the CL-GTK2-GObject, download and install CL-GTK2 bindings and load the ASDF system cl-gtk2-glib.

CL-GTK2-GObject defines two packages: gobject and gobject.ffi. The gobject.ffi package contains definitions for low-level CFFI imports. The gobject package contains symbols for external API of this GObject binding.

GType designator
****************

GObject is an object system based on GType type system. Types in it are identified by an integer value of type GType. In cl-gtk2-gobject, types are identified by GType designators. GType designator is an integer (equal to corresponding GType identifier) or a string (equal to the name of corresponding type). The important difference between GType and GType designator is that GType values may change between program runs (all GTypes except fundamental GTypes will change values), but string GType designators do not change (because names of types do not change). As such, if ever GType must be saved in a code, string GType designator should be preferred.

An example of GType designator is a string "GObject" and the numeric value 80 that corresponds to it.

Some of the types are fundamental and have constant integer values. They are identified by constants:

  * +g-type-invalid+. An invalid GType used as error return value in some functions which return a GType.

  * +g-type-void+. A fundamental type which is used as a replacement for the C void return type.

  * +g-type-interface+. The fundamental type from which all interfaces are derived.

  * +g-type-char+. The fundamental type corresponding to gchar. The type designated by +g-type-char+ is unconditionally an 8-bit signed integer. This may or may not be the same type a the C type gchar.

  * +g-type-uchar+. The fundamental type corresponding to guchar.

  * +g-type-boolean+. The fundamental type corresponding to gboolean.

  * +g-type-int+. The fundamental type corresponding to gint.

  * +g-type-uint+. The fundamental type corresponding to guint.

  * +g-type-long+. The fundamental type corresponding to glong.

  * +g-type-ulong+. The fundamental type corresponding to gulong.

  * +g-type-int64+. The fundamental type corresponding to gint64.

  * +g-type-uint64+. The fundamental type corresponding to guint64.

  * +g-type-enum+. The fundamental type from which all enumeration types are derived.

  * +g-type-flags+. The fundamental type from which all flags types are derived.

  * +g-type-float+. The fundamental type corresponding to gfloat.

  * +g-type-double+. The fundamental type corresponding to gdouble.

  * +g-type-string+. The fundamental type corresponding to null-terminated C strings.

  * +g-type-pointer+. The fundamental type corresponding to gpointer.

  * +g-type-boxed+. The fundamental type from which all boxed types are derived.

  * +g-type-param+. The fundamental type from which all GParamSpec types are derived.

  * +g-type-object+. The fundamental type for GObject.

Functions g-type-string and g-type-numeric return the numeric and string representations of GType designators (given any of them).

Invalid type (the GType that does not exist) is identified as a 0 or NIL.

     (g-type-numeric "GObject") => 80
     (g-type-numeric 80) => 80
     (g-type-string "GObject") => "GObject"
     (g-type-string 80) => "GObject"
     (g-type-numeric "GtkWidget") => 6905648 ;;Will be different on each run

g-type-string
=============

(g-type-string g-type-designator) => name

G-TYPE-DESIGNATOR
     The GType designator for the GType

NAME
     The name of GType

Returns the name of GType.

g-type-numeric
==============

(g-type-numeric g-type-designator) => GType

G-TYPE-DESIGNATOR.
     The GType designator for the GType.

GTYPE
     The numeric identifier of GType

Returns the numeric identifier of GType

Type hierarchy and type relations
*********************************

GTypes are organized into hierarchy. Each GType (except fundamental types) has a parent type and zero or more children types. Parent of GType identified by g-type-parent function and its children are identified by g-type-children function.

There are functions to query some specific information:

  * g-type-fundamental retrieves the fundamental type for given type

  * g-type-depth calculates the depth of the type in type hierarchy

  * g-type-next-base calculates the first step in the path from base type to descendent type

g-type-children
===============

(g-type-children type) => children

TYPE
     A GType designator

CHILDREN
     A list of GType designators

Returns the list of descendent types.

Example:

     (g-type-children "GtkButton")
     =>
     ("GtkToggleButton" "GtkColorButton" "GtkFontButton" "GtkLinkButton" "GtkScaleButton")

g-type-parent
=============

(g-type-parent type) => parent

TYPE
     A GType designator

PARENT
     A GType designator

Returns the parent of type.

Example:

     (g-type-parent "GtkToggleButton")
     =>
     "GtkButton"

g-type-fundamental
==================

(g-type-fundamental type) => fundamental-type

TYPE
     A GType designator

FUNDAMENTAL-TYPE
     A GType designator for one of the fundamental types

Returns the fundamental type that is the ancestor of type.

Example:

     (g-type-fundamental "GtkButton") => "GObject"

     (g-type-fundamental "GtkWindowType") => "GEnum"

     (g-type-fundamental "GdkEvent") => "GBoxed"

g-type-depth
============

(g-type-depth type) => depth

TYPE
     A GType designator

DEPTH
     An integer

Returns the depth of the type. Depth is the number of types between the type and its fundamental types (including both type and its fundamental type). Depth of a fundamental type equals to 1.

Example:

     (g-type-depth "GObject") => 1
     (g-type-depth "GInitiallyUnowned") => 2

g-type-next-base
================

(g-type-next-base leaf-type root-type) => base-type

LEAF-TYPE
     A GType designator

ROOT-TYPE
     A GType designator

BASE-TYPE
     A GType designator

Returns the next type that should be traversed from root-type in order to reach leaf-type. E.g., given type hierarchy:

     + GObject
      \
       + GInitiallyUnowned
        \
         + GtkObject
         |\
         | + GtkAdjustment
          \
           + GtkWidget
            \
             + GtkContainer
              \
               + GtkTable

the following will be returned:

     (g-type-next-base "GtkTable" "GObject") => "GInitiallyUnowned"
     (g-type-next-base "GtkTable" "GInitiallyUnowned") => "GtkObject"
     (g-type-next-base "GtkTable" "GtkObject") => "GtkWidget"
     (g-type-next-base "GtkTable" "GtkWidget") => "GtkContainer"
     (g-type-next-base "GtkTable" "GtkContainer") => "GtkTable"

Object types information
************************

GObject classes and interfaces have properties that can be queried with class-properties, class-property-info and interface-properties. These functions represent information about properties with instances of g-class-property-definition structure.

Information about signals can be queries with type-signals, parse-signal-name and query-signal-info functions. Information is returned within instances of signal-info structures.

g-class-property-definition
===========================

     (defstruct g-class-property-definition
       name
       type
       readable
       writable
       constructor
       constructor-only
       owner-type)

NAME
     A string that names the property

TYPE
     A GType designator. Identifies the type of the property

READABLE
     A boolean. Identifies whether the property can be read

WRITABLE
     A boolean. Identifies whether the property can be assigned

CONSTRUCTOR
     A boolean. Identifies whether constructor of object accepts this property

CONSTRUCTOR-ONLY
     A boolean. Identifies whether this property may only be set in constructor, not in property setter

OWNER-TYPE
     A GType designator. Identifies the type on which the property was defined.

This structure identifies a single property. Its field specify attributes of a property.

Structures of this type have shortened print syntax:

     #<PROPERTY gchararray GtkButton.label (flags: readable writable constructor)>

(When *print-readably* is T, usual defstruct print syntax is used)

This syntax specifies:

  * type of property

  * the owner type of property

  * name of property

  * additional flags of property

class-properties
================

(class-properties type) => properties

TYPE
     A GType designator. Specifies the object type (class)

PROPERTIES
     A list of g-property-definition structures.

This function returns the list of properties that are available in class type.

Example:

     (class-properties "GtkWidget")
     =>
     (#<PROPERTY gpointer GtkObject.user-data (flags: readable writable)>
      #<PROPERTY gchararray GtkWidget.name (flags: readable writable)>
      #<PROPERTY GtkContainer GtkWidget.parent (flags: readable writable)>
      #<PROPERTY gint GtkWidget.width-request (flags: readable writable)>
      #<PROPERTY gint GtkWidget.height-request (flags: readable writable)>
      #<PROPERTY gboolean GtkWidget.visible (flags: readable writable)>
      #<PROPERTY gboolean GtkWidget.sensitive (flags: readable writable)>
      #<PROPERTY gboolean GtkWidget.app-paintable (flags: readable writable)>
      #<PROPERTY gboolean GtkWidget.can-focus (flags: readable writable)>
      #<PROPERTY gboolean GtkWidget.has-focus (flags: readable writable)>
      #<PROPERTY gboolean GtkWidget.is-focus (flags: readable writable)>
      #<PROPERTY gboolean GtkWidget.can-default (flags: readable writable)>
      #<PROPERTY gboolean GtkWidget.has-default (flags: readable writable)>
      #<PROPERTY gboolean GtkWidget.receives-default (flags: readable writable)>
      #<PROPERTY gboolean GtkWidget.composite-child (flags: readable)>
      #<PROPERTY GtkStyle GtkWidget.style (flags: readable writable)>
      #<PROPERTY GdkEventMask GtkWidget.events (flags: readable writable)>
      #<PROPERTY GdkExtensionMode GtkWidget.extension-events (flags: readable writable)>
      #<PROPERTY gboolean GtkWidget.no-show-all (flags: readable writable)>
      #<PROPERTY gboolean GtkWidget.has-tooltip (flags: readable writable)>
      #<PROPERTY gchararray GtkWidget.tooltip-markup (flags: readable writable)>
      #<PROPERTY gchararray GtkWidget.tooltip-text (flags: readable writable)>
      #<PROPERTY GdkWindow GtkWidget.window (flags: readable)>)

class-property-info
===================

(class-property-info type property-name) => property

TYPE
     A GType designator

PROPERTY-NAME
     A string naming the property

PROPERTY
     An instance of g-property-definition structure

Returns the property information for a single property.

Example:

     (class-property-info "GtkButton" "label")
     =>
     #<PROPERTY gchararray GtkButton.label (flags: readable writable constructor)>

interface-properties
====================

(interface-properties type) => properties

TYPE
     A GType designator

PROPERTIES
     A list of g-property-definition structures

This function returns the list of properties that are available in interface type.

Example:

     (interface-properties "GtkFileChooser")
     =>
     (#<PROPERTY GtkWidget GtkFileChooser.extra-widget (flags: readable writable)>
      #<PROPERTY gboolean GtkFileChooser.use-preview-label (flags: readable writable)>
      #<PROPERTY gboolean GtkFileChooser.preview-widget-active (flags: readable writable)>
      #<PROPERTY gboolean GtkFileChooser.show-hidden (flags: readable writable)>
      #<PROPERTY gchararray GtkFileChooser.file-system-backend (flags: writable constructor-only)>
      #<PROPERTY GtkFileChooserAction GtkFileChooser.action (flags: readable writable)>
      #<PROPERTY GtkFileFilter GtkFileChooser.filter (flags: readable writable)>
      #<PROPERTY gboolean GtkFileChooser.select-multiple (flags: readable writable)>
      #<PROPERTY GtkWidget GtkFileChooser.preview-widget (flags: readable writable)>
      #<PROPERTY gboolean GtkFileChooser.local-only (flags: readable writable)>
      #<PROPERTY gboolean GtkFileChooser.do-overwrite-confirmation (flags: readable writable)>)

signal-info
===========

     (defstruct signal-info
       id
       name
       owner-type
       flags
       return-type
       param-types
       detail)

ID
     An integer - the identifier of a signal

NAME
     Name of a signal

OWNER-TYPE
     A GType designator identifying the type on which the signal was defined

FLAGS
     A list of keywords of type '(member :run-first :run-last :run-cleanup :no-recurse :detailed :action :no-hooks). Specifies the attributes of a signals

RETURN-TYPE
     The return type of a signal (and signal handlers)

PARAM-TYPES
     A list of GType designators that specify the types of signal parameters

DETAIL
     A string. Specifies the "detail" part of a signal name. E.g., "label" for signal "notify::label".

When *print-readably* is nil, the following print syntax is used:

     #<Signal [#1] void GObject.notify::label(GParam) [RUN-FIRST, NO-RECURSE, DETAILED, ACTION, NO-HOOKS]>
     #<Signal [#54] gboolean GtkWidget.proximity-in-event(GdkEvent) [RUN-LAST]>
     #<Signal [#64] void GtkWidget.drag-data-received(GdkDragContext, gint, gint, GtkSelectionData, guint, guint) [RUN-LAST]>
     #<Signal [#8] void GtkObject.destroy() [RUN-CLEANUP, NO-RECURSE, NO-HOOKS]>

This syntax specifies:

  * the signal id

  * signal return type

  * owner type

  * signal name

  * detail

  * list of types of parameters

  * flags

type-signals
============

(type-signals type &key (include-inherited t)) => signals

TYPE
     A GType designator

SIGNALS
     A list of signal-info structures

INCLUDE-INHERITED
     A boolean that specifies whether to include signals defined on this type or also on ancestor types.

Returns the list of signals that are available in type type.

Example:

     (type-signals "GtkLabel" :include-inherited nil)
     =>
     (#<Signal [#138] void GtkLabel.move-cursor(GtkMovementStep, gint, gboolean) [RUN-LAST, ACTION]>
      #<Signal [#139] void GtkLabel.copy-clipboard() [RUN-LAST, ACTION]>
      #<Signal [#140] void GtkLabel.populate-popup(GtkMenu) [RUN-LAST]>)

parse-signal-name
=================

(parse-signal-name type signal-name) => signal

TYPE
     A GType designator that has the signal.

SIGNAL-NAME
     A string that identifies the signal.

SIGNAL
     A list signal-info structures.

Parses the signal name and returns the corresponding information. signal-name may include the detail part.

Example:

     (parse-signal-name "GObject" "notify::label")
     =>
     #<Signal [#1] void GObject.notify::label(GParam) [RUN-FIRST, NO-RECURSE, DETAILED, ACTION, NO-HOOKS]>

query-signal-info
=================

(query-signal-info signal-id) => signal

SIGNAL-ID
     An integer identifying the signal

SIGNAL
     An instance of signal-info structure

Retrieves the signal information by its id.

Example:

     (query-signal-info 73)
     =>
     #<Signal [#73] gboolean GtkWidget.show-help(GtkWidgetHelpType) [RUN-LAST, ACTION]>

g-type-interfaces
=================

(g-type-interfaces type) => interfaces

TYPE
     A GType designator

INTERFACES
     A list of GType designators

Returns the list of interfaces that type implements.

Example:

     (g-type-interfaces "GtkButton")
     =>
     ("AtkImplementorIface" "GtkBuildable" "GtkActivatable")

g-type-interface-prerequisites
==============================

(g-type-interface-prerequisites type) => types

TYPE
     A GType designator of interface

TYPES
     A list of GType designators specifying the interface prerequisites

Returns the prerequisites of an interface type. Prerequisite is a type that should be an ancestor of a type implementing interface type.

Example:

     (g-type-interface-prerequisites "GtkCellEditable")
     =>
     ("GtkObject" "GtkWidget")

Enum types information
**********************

Enum types have items that can be listed with get-enum-items function. This information is exposed within instances of enum-item structure.

Flags types (flags is a kind of enum whose values can be combined) have items that can be queried with get-flags-items function. This information is exposed within instances of flags-item structure.

enum-item
=========

     (defstruct enum-item
       name value nick)

NAME
     A string - name of enum item

VALUE
     An integer - numeric value of enum item

NICK
     A string - short name of an enum item

Structure enum-item represents a single item of an enumeration type.

Example:

     #S(ENUM-ITEM :NAME "GTK_WINDOW_TOPLEVEL" :VALUE 0 :NICK "toplevel")

flags-item
==========

     (defstruct flags-item
       name value nick)

NAME
     A string - name of flags item

VALUE
     An integer - numeric value of flags item

NICK
     A string - short name of an flags item

Structure flags-item represents a single item of an flags type.

Example:

     #S(FLAGS-ITEM
        :NAME "GDK_POINTER_MOTION_HINT_MASK"
        :VALUE 8
        :NICK "pointer-motion-hint-mask")

get-enum-items
==============

(get-enum-items type) => items

TYPE
     A GType designator of an enum type

ITEMS
     A list of enum-item structures

Returns a list of items in an enumeration

Example:

     (get-enum-items "GtkScrollType")
     =>
     (#S(ENUM-ITEM :NAME "GTK_SCROLL_NONE" :VALUE 0 :NICK "none")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_JUMP" :VALUE 1 :NICK "jump")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_STEP_BACKWARD" :VALUE 2 :NICK "step-backward")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_STEP_FORWARD" :VALUE 3 :NICK "step-forward")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_PAGE_BACKWARD" :VALUE 4 :NICK "page-backward")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_PAGE_FORWARD" :VALUE 5 :NICK "page-forward")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_STEP_UP" :VALUE 6 :NICK "step-up")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_STEP_DOWN" :VALUE 7 :NICK "step-down")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_PAGE_UP" :VALUE 8 :NICK "page-up")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_PAGE_DOWN" :VALUE 9 :NICK "page-down")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_STEP_LEFT" :VALUE 10 :NICK "step-left")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_STEP_RIGHT" :VALUE 11 :NICK "step-right")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_PAGE_LEFT" :VALUE 12 :NICK "page-left")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_PAGE_RIGHT" :VALUE 13 :NICK "page-right")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_START" :VALUE 14 :NICK "start")
      #S(ENUM-ITEM :NAME "GTK_SCROLL_END" :VALUE 15 :NICK "end"))

get-flags-items
===============

(get-flags-items type) => items

TYPE
     A GType designator of an flags type

ITEMS
     A list of flags-item structures

Returns a list of items in an flags type

Example:

     (get-flags-items "GtkAttachOptions")
     =>
     (#S(FLAGS-ITEM :NAME "GTK_EXPAND" :VALUE 1 :NICK "expand")
      #S(FLAGS-ITEM :NAME "GTK_SHRINK" :VALUE 2 :NICK "shrink")
      #S(FLAGS-ITEM :NAME "GTK_FILL" :VALUE 4 :NICK "fill"))

Using GValues
*************

GValue is a generic container for arbitrary value of type supported by GType system. Refer to GObject documentation for more detailed information.

CL-GTK2-GOBJECT works with GValue as a foreign type g-value. Functions g-value-zero, g-value-type, g-value-init, parse-g-value, set-g-value are used to inspect and assign GValues. g-value is a CFFI foreign type that is used by all these functions. Pointer to foreign instance of this type is passed to them.

GValue is used whenever a value of unkown type should be passed. It is used in:

  * Closure marshal functions

  * Property get and set functions

Example of usage:

     (cffi:with-foreign-object (gval 'g-value)
       (set-g-value gval "Hello" "gchararray" :zero-g-value t)
       (format t "~S~%" (parse-g-value gval))
       (g-value-unset gval))
     =>
     "Hello"

g-value-zero
============

(g-value-zero g-value)

G-VALUE
     A foreign pointer to GValue structure.

Initializes the GValue to "unset" state. Equivalent of the following initializer in C:

     GValue value = { 0 };

Must be called before other functions that work with GValue (except set-g-value with keyword argument :zero-g-value set to true).

g-value-init
============

(g-value-init value type)

VALUE
     A foreign pointer to GValue structure

TYPE
     A GType designator

Initializes the GValue to store instances of type type. Must be called before other functions operate on GValue (except g-value-zero and set-g-value with keyword argument :g-value-init set to true).

g-value-unset
=============

(g-value-unset value)

VALUE
     A foreign pointer to GValue structure.

Unsets the GValue. This frees all resources associated with GValue.

parse-g-value
=============

(parse-g-value value) => object

VALUE
     A foreign pointer to GValue structure

OBJECT
     A Lisp object

Retrieves the object from GValue structure.

set-g-value
===========

(set-g-value gvalue object type &key zero-g-value unset-g-value (g-value-init t))

GVALUE
     A foreign pointer to GValue structure

OBJECT
     An object that is to be assigned to gvalue

TYPE
     A GType designator specifying what GType should be set

UNSET-G-VALUE
     A boolean specifying whether to call g-value-unset before assigment.

ZERO-G-VALUE
     A boolean specifying whether to call g-value-zero before assignment

G-VALUE-INIT
     A boolean specifying whether to call g-value-init before assignment

Assigns the object to the gvalue. When GValue is not used, call g-value-unset to deinitialize the GValue.

Stable pointers
***************

Sometimes it is necessary to pass arbitrary Lisp object to C code and then receive it back. Stable pointer serve to this purpose. Stable pointer is an integer (that is passed to C code as a void* pointer) that is created on Lisp side by call to allocate-stable-pointer and can be dereferenced by Lisp side at any time by calling stable-pointer-value. Stable pointer exists and does not change its value until explicitly freed by calling free-stable-poitner. Convenience macro with-stable-pointer binds the stable pointer for the duration of its body.

allocate-stable-pointer
=======================

(allocate-stable-pointer thing) => stable-pointer

THING
     An arbitrary Lisp object

STABLE-POINTER
     A foreign pointer

Allocates a stable pointer to thing.

(Note: STABLE-POINTER should not be dereferenced with cffi:mem-ref. It should only be dereferenced with stable-pointer-value)

Example:

     (allocate-stable-pointer (lambda (x) (+ x 10)))
     =>
     #.(SB-SYS:INT-SAP #X00000002)

     (stable-pointer-value *)
     =>
     #<FUNCTION (LAMBDA (X)) {1004D016F9}>

     (free-stable-pointer **)
     =>
     NIL

free-stable-pointer
===================

(free-stable-pointer stable-pointer)

STABLE-POINTER
     A foreign pointer that was created with allocate-stable-pointer.

Frees the stable pointer, enabling the garbage collector to reclaim the object.

Example:

     (allocate-stable-pointer (lambda (x) (+ x 10)))
     =>
     #.(SB-SYS:INT-SAP #X00000002)

     (stable-pointer-value *)
     =>
     #<FUNCTION (LAMBDA (X)) {1004D016F9}>

     (free-stable-pointer **)
     =>
     NIL

stable-pointer-value
====================

(stable-pointer-value stable-pointer) => thing

(setf (stable-pointer-value stable-pointer) thing)

STABLE-POINTER
     A foreign pointer created by allocate-stable-pointer

THING
     A Lisp object

Dereferences a stable-pointer, returning the stable pointer value. stable-pointer-value is a SETFable form, SETFing it sets the stable pointer's value to new value.

with-stable-pointer
===================

(with-stable-pointer (ptr expr) &body body)

PTR
     A variable that will be bound to the stable pointer

EXPR
     An expression that will be evaluated once and its value will be bound to stable pointer's value

Executes the body with the ptr variable being bound to a stable pointer whose value is determined by expr.

Example:

     (with-stable-pointer (ptr (lambda (x) (+ x 10)))
       (print (stable-pointer-value ptr)))
     ;;Prints:
     #<FUNCTION (LAMBDA (X)) {1004807E79}>

Closures
********

Closure are anonymous functions that capture their lexical environment.

GObject supports using closures (as instances of type GClosure) as signal handlers and in some other places where a function is expected. Function create-g-closure create closure from lisp function. The GClosure is finalized automatically when GObject no longer needs it (e.g., when GClosure is disconnected from signal).

create-g-closure
================

(create-g-closure fn) => closure

FN
     A function that will be called by closure invokation

CLOSURE
     A foreign pointer to allocated closure

Allocates the closure. The closure is destroyed automatically by GObject.

Example:

     (create-g-closure (lambda (x) (+ x 10)))
     =>
     #.(SB-SYS:INT-SAP #X006D7B20)

Example of usage from GObject binding code:

     (defun connect-signal (object signal handler &key after)
       (g-signal-connect-closure (ensure-object-pointer object)
                                 signal
                                 (create-g-closure handler)
                                 after))

(TODO: GObject defines finer closure API: g_closure_ref, g_closure_unref, g_closure_invoke. It should be bound.)

GObject low-level
*****************

GObject low-level support includes facilities for working with objects as foreign pointers and using explicit function to get and set properties.

Function g-type-from-object identifies the type of the object. Function g-object-call-get-property retrieves the value of the property and function g-object-call-set-property sets the value of the property. Function g-object-call-constructor calls the constructor of the GObject type.

g-type-from-object
==================

g-object-call-get-property
==========================

g-object-call-set-property
==========================

g-object-call-constructor
=========================

GObject high-level
******************

Subclassing GObjects and implementing GInterfaces
*************************************************

GBoxed
******

Generating type definitions by introspection
********************************************