Next: , Previous: , Up: Working with GObjects   [Contents][Index]


2.5.4 GObject Properties

GObject objects may have one or more properties, which are variables attached to the object that may be gotten or set. GObject properties usually have C-like types. Remember that GObject objects are instances of a class that may have a parent class, and each parent class may one or more properties. So, for example, if the object is a radio button, you may get or set properties that apply specifically to radio buttons, or generic buttons, or generic widgets.

In Guile-GI, properties come in two flavours. The basic building block are objects derived from G_TYPE_PARAM alias <GParam>. These can be created via introspected methods found in the GObject library. They are enhanced so that they can work as procedures with setter. Given an arbitrary property prop, (prop obj) will fetch the corresponding property, whereas (set! (prop obj) val) will set it.

The other flavour are GOOPS accessors. These are used for introspected properties, so that the name may also overlap with a method or a signal of a different type. Other than that, they behave no different from <GParam>s – in fact, they work by constructing a <GParam> and using their getters and setters.