gobject.c.types

C types for gobject2 library

Types 107

This is the signature of marshaller functions, required to marshall arrays of parameter values to signal emissions into C language callback invocations.

It is merely an alias to #GClosureMarshal since the #GClosure mechanism takes over responsibility of actual function invocation for the signal system.

This is the signature of va_list marshaller functions, an optional marshaller that can be used in some situations to avoid marshalling the signal argument into GValues.

aliasGType = size_t

A numerical value which represents the unique identifier of a registered type.

enumGBindingFlags : uint

Flags to be passed to [gobject.object.ObjectWrap.bindProperty] or [gobject.object.ObjectWrap.bindPropertyFull].

This enumeration can be extended at later date.

Default = 0The default binding; if the source property changes, the target property is updated with its value.
Bidirectional = 1Bidirectional binding; if either the property of the source or the property of the target changes, the other is updated.
SyncCreate = 2Synchronize the values of the source and target properties when creating the binding; the direction of the synchronization is always from the source to the target.
InvertBoolean = 4If the two properties being bound are booleans, setting one to true will result in the other being set to false and vice versa. This flag will only work for boolean properties, and cannot be used w...
enumGConnectFlags : uint

The connection flags are used to specify the behaviour of a signal's connection.

Default = 0Default behaviour (no special flags). Since: 2.74
After = 1If set, the handler should be called after the default handler of the signal. Normally, the handler is called before the default handler.
Swapped = 2If set, the instance and data should be swapped when calling the handler; see gsignalconnect_swapped() for an example.
enumGParamFlags : uint

Through the #GParamFlags flag values, certain aspects of parameters can be configured.

See also: [gobject.types.PARAM_STATIC_STRINGS]

Readable = 1the parameter is readable
Writable = 2the parameter is writable
Readwrite = 3alias for `GPARAMREADABLE` | `GPARAMWRITABLE`
Construct = 4the parameter will be set upon object construction
ConstructOnly = 8the parameter can only be set upon object construction
LaxValidation = 16upon parameter conversion (see [gobject.global.paramValueConvert]) strict validation is not required
StaticName = 32the string used as name when constructing the parameter is guaranteed to remain valid and unmodified for the lifetime of the parameter. Since 2.8
Private = 32internal
StaticNick = 64the string used as nick when constructing the parameter is guaranteed to remain valid and unmmodified for the lifetime of the parameter. Since 2.8
StaticBlurb = 128the string used as blurb when constructing the parameter is guaranteed to remain valid and unmodified for the lifetime of the parameter. Since 2.8
ExplicitNotify = 1073741824calls to [gobject.object.ObjectWrap.setProperty] for this property will not automatically result in a "notify" signal being emitted: the implementation must call [gobject.object.ObjectWrap.notify] ...
Deprecated = 2147483648the parameter is deprecated and will be removed in a future version. A warning will be generated if it is used while running with GENABLEDIAGNOSTIC=1. Since 2.26
enumGSignalFlags : uint

The signal flags are used to specify a signal's behaviour.

RunFirst = 1Invoke the object method handler in the first emission stage.
RunLast = 2Invoke the object method handler in the third emission stage.
RunCleanup = 4Invoke the object method handler in the last emission stage.
NoRecurse = 8Signals being emitted for an object while currently being in emission for this very object will not be emitted recursively, but instead cause the first emission to be restarted.
Detailed = 16This signal supports "::detail" appendices to the signal name upon handler connections and emissions.
Action = 32Action signals are signals that may freely be emitted on alive objects from user code via [gobject.global.signalEmit] and friends, without the need of being embedded into extra code that performs p...
NoHooks = 64No emissions hooks are supported for this signal.
MustCollect = 128Varargs signal emission will always collect the arguments, even if there are no signal handlers connected. Since 2.30.
Deprecated = 256The signal is deprecated and will be removed in a future version. A warning will be generated if it is connected while running with GENABLEDIAGNOSTIC=1. Since 2.32.
AccumulatorFirstRun = 131072Only used in #GSignalAccumulator accumulator functions for the #GSignalInvocationHint::run_type field to mark the first call to the accumulator function for a signal emission. Since 2.68.
enumGSignalMatchType : uint

The match types specify what [gobject.global.signalHandlersBlockMatched], [gobject.global.signalHandlersUnblockMatched] and [gobject.global.signalHandlersDisconnectMatched] match signals by.

Id = 1The signal id must be equal.
Detail = 2The signal detail must be equal.
Closure = 4The closure must be the same.
Func = 8The C closure callback must be the same.
Data = 16The closure data must be the same.
Unblocked = 32Only unblocked signals may be matched.
enumGTypeDebugFlags : uint

These flags used to be passed to [gobject.global.typeInitWithDebugFlags] which is now deprecated.

If you need to enable debugging features, use the GOBJECT_DEBUG environment variable.

Deprecated

[gobject.global.typeInit] is now done automatically
None = 0Print no messages
Objects = 1Print messages about object bookkeeping
Signals = 2Print messages about signal emissions
InstanceCount = 4Keep a count of instances of each type
Mask = 7Mask covering all debug flags
enumGTypeFlags : uint

Bit masks used to check or determine characteristics of a type.

None = 0No special flags. Since: 2.74
Abstract = 16Indicates an abstract type. No instances can be created for an abstract type
ValueAbstract = 32Indicates an abstract value type, i.e. a type that introduces a value table, but can't be used for [gobject.value.Value.init_]
Final = 64Indicates a final type. A final type is a non-derivable leaf node in a deep derivable type hierarchy tree. Since: 2.70
Deprecated = 128The type is deprecated and may be removed in a future version. A warning will be emitted if it is instantiated while running with `GENABLEDIAGNOSTIC=1`. Since 2.76

Bit masks used to check or determine specific characteristics of a fundamental type.

Classed = 1Indicates a classed type
Instantiatable = 2Indicates an instantiatable type (implies classed)
Derivable = 4Indicates a flat derivable type
DeepDerivable = 8Indicates a deep derivable type (implies derivable)
structGBinding

[gobject.object.ObjectWrap] instance (or source) and another property on another [gobject.object.ObjectWrap] instance (or target).

Whenever the source property changes, the same value is applied to the target property; for instance, the following binding:

g_object_bind_property (object1, "property-a",
                         object2, "property-b",
                         G_BINDING_DEFAULT);

will cause the property named "property-b" of @object2 to be updated every time method@GObject.set or the specific accessor changes the value of the property "property-a" of @object1.

It is possible to create a bidirectional binding between two properties of two [gobject.object.ObjectWrap] instances, so that if either property changes, the other is updated as well, for instance:

g_object_bind_property (object1, "property-a",
                         object2, "property-b",
                         G_BINDING_BIDIRECTIONAL);

will keep the two properties in sync.

It is also possible to set a custom transformation function (in both directions, in case of a bidirectional binding) to apply a custom transformation from the source value to the target value before applying it; for instance, the following binding:

g_object_bind_property_full (adjustment1, "value",
                              adjustment2, "value",
                              G_BINDING_BIDIRECTIONAL,
                              celsius_to_fahrenheit,
                              fahrenheit_to_celsius,
                              NULL, NULL);

will keep the "value" property of the two adjustments in sync; the @celsius_to_fahrenheit function will be called whenever the "value" property of @adjustment1 changes and will transform the current value of the property before applying it to the "value" property of @adjustment2.

Vice versa, the @fahrenheit_to_celsius function will be called whenever the "value" property of @adjustment2 changes, and will transform the current value of the property before applying it to the "value" property of @adjustment1.

Note that #GBinding does not resolve cycles by itself; a cycle like

object1:propertyA -> object2:propertyB
 object2:propertyB -> object3:propertyC
 object3:propertyC -> object1:propertyA

might lead to an infinite loop. The loop, in this particular case, can be avoided if the objects emit the GObject::notify signal only if the value has effectively been changed. A binding is implemented using the GObject::notify signal, so it is susceptible to all the various ways of blocking a signal emission, like func@GObject.signal_stop_emission or func@GObject.signal_handler_block.

A binding will be severed, and the resources it allocates freed, whenever either one of the [gobject.object.ObjectWrap] instances it refers to are finalized, or when the #GBinding instance loses its last reference.

Bindings for languages with garbage collection can use [gobject.binding.Binding.unbind] to explicitly release a binding between the source and target properties, instead of relying on the last reference on the binding, source, and target instances to drop.

[gobject.binding_group.BindingGroup] can be used to bind multiple properties from an object collectively.

Use the various methods to bind properties from a single source object to multiple destination objects. Properties can be bound bidirectionally and are connected when the source object is set with [gobject.binding_group.BindingGroup.setSource].

structGCClosure

A #GCClosure is a specialization of #GClosure for C function callbacks.

Fields
GClosure closurethe #GClosure
void * callbackthe callback function
structGClosure

A [gobject.closure.Closure] represents a callback supplied by the programmer.

It will generally comprise a function of some kind and a marshaller used to call it. It is the responsibility of the marshaller to convert the arguments for the invocation from #GValues into a suitable form, perform the callback on the converted arguments, and transform the return value back into a #GValue.

In the case of C programs, a closure usually just holds a pointer to a function and maybe a data argument, and the marshaller converts between #GValue and native C types. The GObject library provides the #GCClosure type for this purpose. Bindings for other languages need marshallers which convert between #GValues and suitable representations in the runtime of the language in order to use functions written in that language as callbacks. Use [gobject.closure.Closure.setMarshal] to set the marshaller on such a custom closure implementation.

Within GObject, closures play an important role in the implementation of signals. When a signal is registered, the @c_marshaller argument to [gobject.global.signalNew] specifies the default C marshaller for any closure which is connected to this signal. GObject provides a number of C marshallers for this purpose, see the g_cclosure_marshal_*() functions. Additional C marshallers can be generated with the [glib-genmarshal][glib-genmarshal] utility. Closures can be explicitly connected to signals with [gobject.global.signalConnectClosure], but it usually more convenient to let GObject create a closure automatically by using one of the g_signal_connect_*() functions which take a callback function/user data pair.

Using closures has a number of important advantages over a simple callback function/data pointer combination:

  • Closures allow the callee to get the types of the callback parameters,

which means that language bindings don't have to write individual glue for each callback type.

  • The reference counting of #GClosure makes it easy to handle reentrancy

right; if a callback is removed while it is being invoked, the closure and its parameters won't be freed until the invocation finishes.

  • [gobject.closure.Closure.invalidate] and invalidation notifiers allow callbacks to be

automatically removed when the objects they point to go away.

Fields
uint refCount
uint metaMarshalNouse
uint nGuards
uint nFnotifiers
uint nInotifiers
uint inInotify
uint floating
uint derivativeFlag
uint inMarshalIndicates whether the closure is currently being invoked with [gobject.closure.Closure.invoke]
uint isInvalidIndicates whether the closure has been invalidated by [gobject.closure.Closure.invalidate]
void function(GClosure * closure, GValue * returnValue, uint nParamValues, const(GValue) * paramValues, void * invocationHint, void * marshalData) marshal
void * data
GClosureNotifyData * notifiers
Fields
void * data

The class of an enumeration type holds information about its possible values.

Fields
GTypeClass gTypeClassthe parent class
int minimumthe smallest possible value.
int maximumthe largest possible value.
uint nValuesthe number of possible values.
GEnumValue * valuesan array of #GEnumValue structs describing the individual values.

A structure which contains a single enum value, its name, and its nickname.

Fields
int valuethe enum value
const(char) * valueNamethe name of the value
const(char) * valueNickthe nickname of the value

The class of a flags type holds information about its possible values.

Fields
GTypeClass gTypeClassthe parent class
uint maska mask covering all possible values.
uint nValuesthe number of possible values.
GFlagsValue * valuesan array of #GFlagsValue structs describing the individual values.

A structure which contains a single flags value, its name, and its nickname.

Fields
uint valuethe flags value
const(char) * valueNamethe name of the value
const(char) * valueNickthe nickname of the value

A type for objects that have an initially floating reference.

All the fields in the [gobject.initially_unowned.InitiallyUnowned] structure are private to the implementation and should never be accessed directly.

Fields
GTypeInstance gTypeInstance
uint refCount
GData * qdata

The class structure for the GInitiallyUnowned type.

Fields
GTypeClass gTypeClassthe parent class
GSList * constructProperties
GObject * function(GType type, uint nConstructProperties, GObjectConstructParam * constructProperties) constructorthe @constructor function is called by gobjectnew () to complete the object initialization after all the construction properties are set. The first thing a @constructor implementation must do is ch...
void function(GObject * object, uint propertyId, const(GValue) * value, GParamSpec * pspec) setPropertythe generic setter for all properties of this type. Should be overridden for every type with properties. If implementations of @set_property don't emit property change notification explicitly, this...
void function(GObject * object, uint propertyId, GValue * value, GParamSpec * pspec) getPropertythe generic getter for all properties of this type. Should be overridden for every type with properties.
void function(GObject * object) disposethe @dispose function is supposed to drop all references to other objects, but keep the instance otherwise intact, so that client method invocations still work. It may be run multiple times (due to...
void function(GObject * object) finalizeinstance finalization function, should finish the finalization of the instance begun in @dispose and chain up to the @finalize method of the parent class.
void function(GObject * object, uint nPspecs, GParamSpec * * pspecs) dispatchPropertiesChangedemits property change notification for a bunch of properties. Overriding @dispatchpropertieschanged should be rarely needed.
void function(GObject * object, GParamSpec * pspec) notifythe class closure for the notify signal
void function(GObject * object) constructedthe @constructed function is called by [gobject.object.ObjectWrap.new_] as the final step of the object creation process. At the point of the call, all construction properties have been set on the...
size_t flags
size_t nConstructProperties
void * pspecs
size_t nPspecs
void *[3] pdummy

A structure that provides information to the type system which is used specifically for managing interface types.

Fields
GInterfaceInitFunc interfaceInitlocation of the interface initialization function
GInterfaceFinalizeFunc interfaceFinalizelocation of the interface finalization function
void * interfaceDatauser-supplied data passed to the interface init/finalize functions

The class structure for the GObject type.

// Example of implementing a singleton using a constructor.
static MySingleton *the_singleton = NULL;

static GObject*
my_singleton_constructor (GType                  type,
                         guint                  n_construct_params,
                         GObjectConstructParam *construct_params)
{
 GObject *object;

 if (!the_singleton)
   {
     object = G_OBJECT_CLASS (parent_class)->constructor (type,
                                                          n_construct_params,
                                                          construct_params);
     the_singleton = MY_SINGLETON (object);
   }
 else
   object = g_object_ref (G_OBJECT (the_singleton));

 return object;
}

Fields
GTypeClass gTypeClassthe parent class
GSList * constructProperties
GObject * function(GType type, uint nConstructProperties, GObjectConstructParam * constructProperties) constructorthe @constructor function is called by gobjectnew () to complete the object initialization after all the construction properties are set. The first thing a @constructor implementation must do is ch...
void function(GObject * object, uint propertyId, const(GValue) * value, GParamSpec * pspec) setPropertythe generic setter for all properties of this type. Should be overridden for every type with properties. If implementations of @set_property don't emit property change notification explicitly, this...
void function(GObject * object, uint propertyId, GValue * value, GParamSpec * pspec) getPropertythe generic getter for all properties of this type. Should be overridden for every type with properties.
void function(GObject * object) disposethe @dispose function is supposed to drop all references to other objects, but keep the instance otherwise intact, so that client method invocations still work. It may be run multiple times (due to...
void function(GObject * object) finalizeinstance finalization function, should finish the finalization of the instance begun in @dispose and chain up to the @finalize method of the parent class.
void function(GObject * object, uint nPspecs, GParamSpec * * pspecs) dispatchPropertiesChangedemits property change notification for a bunch of properties. Overriding @dispatchpropertieschanged should be rarely needed.
void function(GObject * object, GParamSpec * pspec) notifythe class closure for the notify signal
void function(GObject * object) constructedthe @constructed function is called by [gobject.object.ObjectWrap.new_] as the final step of the object creation process. At the point of the call, all construction properties have been set on the...
size_t flags
size_t nConstructProperties
void * pspecs
size_t nPspecs
void *[3] pdummy

The GObjectConstructParam struct is an auxiliary structure used to hand #GParamSpec/#GValue pairs to the @constructor of a #GObjectClass.

Fields
GParamSpec * pspecthe #GParamSpec of the construct parameter
GValue * valuethe value to set the parameter to
structGObject

The base object type.

[gobject.object.ObjectWrap] is the fundamental type providing the common attributes and methods for all object types in GTK, Pango and other libraries based on GObject. The [gobject.object.ObjectWrap] class provides methods for object construction and destruction, property access methods, and signal support. Signals are described in detail [here][gobject-Signals].

For a tutorial on implementing a new [gobject.object.ObjectWrap] class, see How to define and implement a new GObject. For a list of naming conventions for GObjects and their methods, see the

GType conventions. For the high-level concepts

behind GObject, read

Instantiatable classed types: Objects.

Since GLib 2.72, all [gobject.object.ObjectWrap]s are guaranteed to be aligned to at least the alignment of the largest basic GLib type (typically this is [gst.types.ulong] or gdouble). If you need larger alignment for an element in a [gobject.object.ObjectWrap], you should allocate it on the heap (aligned), or arrange for your [gobject.object.ObjectWrap] to be appropriately padded. This guarantee applies to the [gobject.object.ObjectWrap] (or derived) struct, the [gstpbutils.types.ObjectClass] (or derived) struct, and any private data allocated by G_ADD_PRIVATE().

Fields
GTypeInstance gTypeInstance
uint refCount
GData * qdata

[gobject.param_spec.ParamSpec] encapsulates the metadata required to specify parameters, such as [gobject.object.ObjectWrap] properties.

Parameter names

A property name consists of one or more segments consisting of ASCII letters and digits, separated by either the `-` or _ character. The first character of a property name must be a letter. These are the same rules as for signal naming (see func@GObject.signal_new).

When creating and looking up a [gobject.param_spec.ParamSpec], either separator can be used, but they cannot be mixed. Using `-` is considerably more efficient, and is the ‘canonical form’. Using _ is discouraged.

Fields
GTypeInstance gTypeInstanceprivate [gobject.type_instance.TypeInstance] portion
const(char) * namename of this parameter: always an interned string
GParamFlags flags[gobject.types.ParamFlags] flags for this parameter
GType valueTypethe [gobject.value.Value] type for this parameter
GType ownerType`GType` type that uses (introduces) this parameter
char * Nick
char * Blurb
GData * qdata
uint refCount
uint paramId

A #GParamSpec derived structure that contains the meta data for boolean properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
gboolean defaultValuedefault value for the property specified

A #GParamSpec derived structure that contains the meta data for boxed properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion

A #GParamSpec derived structure that contains the meta data for character properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
byte minimumminimum value for the property specified
byte maximummaximum value for the property specified
byte defaultValuedefault value for the property specified

The class structure for the GParamSpec type. Normally, GParamSpec classes are filled by [gobject.global.paramTypeRegisterStatic].

Fields
GTypeClass gTypeClassthe parent class
GType valueTypethe #GValue type for this parameter
void function(GParamSpec * pspec) finalizeThe instance finalization function (optional), should chain up to the finalize method of the parent class.
void function(GParamSpec * pspec, GValue * value) valueSetDefaultResets a @value to the default value for this type (recommended, the default is [gobject.value.Value.reset]), see [gobject.global.paramValueSetDefault].
gboolean function(GParamSpec * pspec, GValue * value) valueValidateEnsures that the contents of @value comply with the specifications set out by this type (optional), see [gobject.global.paramValueValidate].
int function(GParamSpec * pspec, const(GValue) * value1, const(GValue) * value2) valuesCmpCompares @value1 with @value2 according to this type (recommended, the default is memcmp()), see [gobject.global.paramValuesCmp].
gboolean function(GParamSpec * pspec, const(GValue) * value) valueIsValidChecks if contents of @value comply with the specifications set out by this type, without modifying the value. This vfunc is optional. If it isn't set, GObject will use @value_validate. Since 2.74
void *[3] dummy

A #GParamSpec derived structure that contains the meta data for double properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
double minimumminimum value for the property specified
double maximummaximum value for the property specified
double defaultValuedefault value for the property specified
double epsilonvalues closer than @epsilon will be considered identical by [gobject.global.paramValuesCmp]; the default value is 1e-90.

A #GParamSpec derived structure that contains the meta data for enum properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
GEnumClass * enumClassthe #GEnumClass for the enum
int defaultValuedefault value for the property specified

A #GParamSpec derived structure that contains the meta data for flags properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
GFlagsClass * flagsClassthe #GFlagsClass for the flags
uint defaultValuedefault value for the property specified

A #GParamSpec derived structure that contains the meta data for float properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
float minimumminimum value for the property specified
float maximummaximum value for the property specified
float defaultValuedefault value for the property specified
float epsilonvalues closer than @epsilon will be considered identical by [gobject.global.paramValuesCmp]; the default value is 1e-30.

A #GParamSpec derived structure that contains the meta data for #GType properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
GType isATypea #GType whose subtypes can occur as values

A #GParamSpec derived structure that contains the meta data for integer properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
int minimumminimum value for the property specified
int maximummaximum value for the property specified
int defaultValuedefault value for the property specified

A #GParamSpec derived structure that contains the meta data for 64bit integer properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
long minimumminimum value for the property specified
long maximummaximum value for the property specified
long defaultValuedefault value for the property specified

A #GParamSpec derived structure that contains the meta data for long integer properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
glong minimumminimum value for the property specified
glong maximummaximum value for the property specified
glong defaultValuedefault value for the property specified

A #GParamSpec derived structure that contains the meta data for object properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion

A #GParamSpec derived structure that redirects operations to other types of #GParamSpec.

All operations other than getting or setting the value are redirected, including accessing the nick and blurb, validating a value, and so forth.

See [gobject.param_spec.ParamSpec.getRedirectTarget] for retrieving the overridden property. #GParamSpecOverride is used in implementing [gobject.object_class.ObjectClass.overrideProperty], and will not be directly useful unless you are implementing a new base type similar to GObject.

Fields
GParamSpec parentInstance
GParamSpec * overridden

A #GParamSpec derived structure that contains the meta data for G_TYPE_PARAM properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion

A #GParamSpec derived structure that contains the meta data for pointer properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion

A #GParamSpecPool maintains a collection of #GParamSpecs which can be quickly accessed by owner and name.

The implementation of the #GObject property system uses such a pool to store the #GParamSpecs of the properties all object types.

A #GParamSpec derived structure that contains the meta data for string properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
char * defaultValuedefault value for the property specified
char * csetFirsta string containing the allowed values for the first byte
char * csetNtha string containing the allowed values for the subsequent bytes
char substitutorthe replacement byte for bytes which don't match @csetfirst or @csetnth.
uint nullFoldIfEmptyreplace empty string by null
uint ensureNonNullreplace null strings by an empty string

This structure is used to provide the type system with the information required to initialize and destruct (finalize) a parameter's class and instances thereof.

The initialized structure is passed to the [gobject.global.paramTypeRegisterStatic] The type system will perform a deep copy of this structure, so its memory does not need to be persistent across invocation of [gobject.global.paramTypeRegisterStatic].

Fields
ushort instanceSizeSize of the instance (object) structure.
ushort nPreallocsPrior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10, it is ignored, since instances are allocated with th...
void function(GParamSpec * pspec) instanceInitLocation of the instance initialization function (optional).
GType valueTypeThe #GType of values conforming to this #GParamSpec
void function(GParamSpec * pspec) finalizeThe instance finalization function (optional).
void function(GParamSpec * pspec, GValue * value) valueSetDefaultResets a @value to the default value for @pspec (recommended, the default is [gobject.value.Value.reset]), see [gobject.global.paramValueSetDefault].
gboolean function(GParamSpec * pspec, GValue * value) valueValidateEnsures that the contents of @value comply with the specifications set out by @pspec (optional), see [gobject.global.paramValueValidate].
int function(GParamSpec * pspec, const(GValue) * value1, const(GValue) * value2) valuesCmpCompares @value1 with @value2 according to @pspec (recommended, the default is memcmp()), see [gobject.global.paramValuesCmp].

A #GParamSpec derived structure that contains the meta data for unsigned character properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
ubyte minimumminimum value for the property specified
ubyte maximummaximum value for the property specified
ubyte defaultValuedefault value for the property specified

A #GParamSpec derived structure that contains the meta data for unsigned integer properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
uint minimumminimum value for the property specified
uint maximummaximum value for the property specified
uint defaultValuedefault value for the property specified

A #GParamSpec derived structure that contains the meta data for unsigned 64bit integer properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
ulong minimumminimum value for the property specified
ulong maximummaximum value for the property specified
ulong defaultValuedefault value for the property specified

A #GParamSpec derived structure that contains the meta data for unsigned long integer properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
gulong minimumminimum value for the property specified
gulong maximummaximum value for the property specified
gulong defaultValuedefault value for the property specified

A #GParamSpec derived structure that contains the meta data for unichar (unsigned integer) properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
dchar defaultValuedefault value for the property specified

A #GParamSpec derived structure that contains the meta data for #GValueArray properties.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
GParamSpec * elementSpeca #GParamSpec describing the elements contained in arrays of this property, may be null
uint fixedNElementsif greater than 0, arrays of this property will always have this many elements

A #GParamSpec derived structure that contains the meta data for #GVariant properties.

When comparing values with [gobject.global.paramValuesCmp], scalar values with the same type will be compared with [glib.variant.Variant.compare]. Other non-null variants will be checked for equality with [glib.variant.Variant.equal], and their sort order is otherwise undefined. null is ordered before non-null variants. Two null values compare equal.

Fields
GParamSpec parentInstanceprivate #GParamSpec portion
GVariantType * typea #GVariantType, or null
GVariant * defaultValuea #GVariant, or null
void *[4] padding

The GParameter struct is an auxiliary structure used to hand parameter name/value pairs to [gobject.object.ObjectWrap.newv].

Deprecated

This type is not introspectable.
Fields
const(char) * namethe parameter name
GValue valuethe parameter value

[gobject.signal_group.SignalGroup] manages a collection of signals on a [gobject.object.ObjectWrap].

[gobject.signal_group.SignalGroup] simplifies the process of connecting many signals to a [gobject.object.ObjectWrap] as a group. As such there is no API to disconnect a signal from the group.

In particular, this allows you to:

  • Change the target instance, which automatically causes disconnection

of the signals from the old instance and connecting to the new instance.

  • Block and unblock signals as a group
  • Ensuring that blocked state transfers across target instances.

One place you might want to use such a structure is with [gtk.text_view.TextView] and [gtk.text_buffer.TextBuffer]. Often times, you'll need to connect to many signals on [gtk.text_buffer.TextBuffer] from a [gtk.text_view.TextView] subclass. This allows you to create a signal group during instance construction, simply bind the GtkTextView:buffer property to GSignalGroup:target and connect all the signals you need. When the GtkTextView:buffer property changes all of the signals will be transitioned correctly.

The #GSignalInvocationHint structure is used to pass on additional information to callbacks during a signal emission.

Fields
uint signalIdThe signal id of the signal invoking the callback
GQuark detailThe detail passed on for this emission
GSignalFlags runTypeThe stage the signal emission is currently in, this field will contain one of `GSIGNALRUNFIRST`, `GSIGNALRUNLAST` or `GSIGNALRUNCLEANUP` and `GSIGNALACCUMULATORFIRSTRUN`. `GSIGNALACCUMULATORFIRST_R...

A structure holding in-depth information for a specific signal.

See also: [gobject.global.signalQuery]

Fields
uint signalIdThe signal id of the signal being queried, or 0 if the signal to be queried was unknown.
const(char) * signalNameThe signal name.
GType itypeThe interface/instance type that this signal can be emitted for.
GSignalFlags signalFlagsThe signal flags as passed in to [gobject.global.signalNew].
GType returnTypeThe return type for user callbacks.
uint nParamsThe number of parameters that user callbacks take.
const(GType) * paramTypesThe individual parameter types for user callbacks, note that the effective callback signature is: ```c @returntype callback (#gpointer data1, [paramtypes param_names,] gpointer data2); ```

A union holding one collected value.

Fields
int vIntthe field for holding integer values
glong vLongthe field for holding long integer values
long vInt64the field for holding 64 bit integer values
double vDoublethe field for holding floating point values
void * vPointerthe field for holding pointers

An opaque structure used as the base of all classes.

Fields
GType gType

A structure that provides information to the type system which is used specifically for managing fundamental types.

Fields
GTypeFundamentalFlags typeFlags#GTypeFundamentalFlags describing the characteristics of the fundamental type
structGTypeInfo

This structure is used to provide the type system with the information required to initialize and destruct (finalize) a type's class and its instances.

The initialized structure is passed to the [gobject.global.typeRegisterStatic] function (or is copied into the provided #GTypeInfo structure in the [gobject.type_plugin.TypePlugin.completeTypeInfo]). The type system will perform a deep copy of this structure, so its memory does not need to be persistent across invocation of [gobject.global.typeRegisterStatic].

Fields
ushort classSizeSize of the class structure (required for interface, classed and instantiatable types)
GBaseInitFunc baseInitLocation of the base initialization function (optional)
GBaseFinalizeFunc baseFinalizeLocation of the base finalization function (optional)
GClassInitFunc classInitLocation of the class initialization function for classed and instantiatable types. Location of the default vtable inititalization function for interface types. (optional) This function is used bot...
GClassFinalizeFunc classFinalizeLocation of the class finalization function for classed and instantiatable types. Location of the default vtable finalization function for interface types. (optional)
const(void) * classDataUser-supplied data passed to the class init/finalize functions
ushort instanceSizeSize of the instance (object) structure (required for instantiatable types only)
ushort nPreallocsPrior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10 this field is ignored.
GInstanceInitFunc instanceInitLocation of the instance initialization function (optional, for instantiatable types only)
const(GTypeValueTable) * valueTableA #GTypeValueTable function table for generic handling of GValues of this type (usually only useful for fundamental types)

An opaque structure used as the base of all type instances.

Fields
GTypeClass * gClass

An opaque structure used as the base of all interface types.

Fields
GType gType
GType gInstanceType

[gobject.type_module.TypeModule] provides a simple implementation of the [gobject.type_plugin.TypePlugin] interface.

The model of [gobject.type_module.TypeModule] is a dynamically loaded module which implements some number of types and interface implementations.

When the module is loaded, it registers its types and interfaces using [gobject.type_module.TypeModule.registerType] and [gobject.type_module.TypeModule.addInterface]. As long as any instances of these types and interface implementations are in use, the module is kept loaded. When the types and interfaces are gone, the module may be unloaded. If the types and interfaces become used again, the module will be reloaded. Note that the last reference cannot be released from within the module code, since that would lead to the caller's code being unloaded before [gobject.object.ObjectWrap.unref] returns to it.

Keeping track of whether the module should be loaded or not is done by using a use count - it starts at zero, and whenever it is greater than zero, the module is loaded. The use count is maintained internally by the type system, but also can be explicitly controlled by [gobject.type_module.TypeModule.use] and [gobject.type_module.TypeModule.unuse]. Typically, when loading a module for the first type, [gobject.type_module.TypeModule.use] will be used to load it so that it can initialize its types. At some later point, when the module no longer needs to be loaded except for the type implementations it contains, [gobject.type_module.TypeModule.unuse] is called.

[gobject.type_module.TypeModule] does not actually provide any implementation of module loading and unloading. To create a particular module type you must derive from [gobject.type_module.TypeModule] and implement the load and unload functions in [gobject.type_module_class.TypeModuleClass].

Fields
GObject parentInstance
uint useCount
GSList * typeInfos
GSList * interfaceInfos
char * namethe name of the module

In order to implement dynamic loading of types based on #GTypeModule, the @load and @unload functions in #GTypeModuleClass must be implemented.

Fields
GObjectClass parentClassthe parent class
gboolean function(GTypeModule * module_) loadloads the module and registers one or more types using [gobject.type_module.TypeModule.registerType].
void function(GTypeModule * module_) unloadunloads the module
void function() reserved1
void function() reserved2
void function() reserved3
void function() reserved4

An interface that handles the lifecycle of dynamically loaded types.

The GObject type system supports dynamic loading of types. It goes as follows:

  1. The type is initially introduced (usually upon loading the module

the first time, or by your main application that knows what modules introduces what types), like this:

new_type_id = g_type_register_dynamic (parent_type_id,
                                         "TypeName",
                                         new_type_plugin,
                                         type_flags);
where new_type_plugin is an implementation of the [gobject.type_plugin.TypePlugin] interface.

  1. The type's implementation is referenced, e.g. through

[gobject.type_class.TypeClass.ref_] or through func@GObject.type_create_instance (this is being called by [gobject.object.ObjectWrap.new_]) or through one of the above done on a type derived from new_type_id.

  1. This causes the type system to load the type's implementation by calling

[gobject.type_plugin.TypePlugin.use] and [gobject.type_plugin.TypePlugin.completeTypeInfo] on new_type_plugin.

  1. At some point the type's implementation isn't required anymore, e.g. after

[gobject.type_class.TypeClass.unref] or func@GObject.type_free_instance (called when the reference count of an instance drops to zero).

  1. This causes the type system to throw away the information retrieved

from [gobject.type_plugin.TypePlugin.completeTypeInfo] and then it calls [gobject.type_plugin.TypePlugin.unuse] on new_type_plugin.

  1. Things may repeat from the second step.

So basically, you need to implement a [gobject.type_plugin.TypePlugin] type that carries a use_count, once use_count goes from zero to one, you need to load the implementation to successfully handle the upcoming [gobject.type_plugin.TypePlugin.completeTypeInfo] call. Later, maybe after succeeding use/unuse calls, once use_count drops to zero, you can unload the implementation again. The type system makes sure to call [gobject.type_plugin.TypePlugin.use] and [gobject.type_plugin.TypePlugin.completeTypeInfo] again when the type is needed again.

[gobject.type_module.TypeModule] is an implementation of [gobject.type_plugin.TypePlugin] that already implements most of this except for the actual module loading and unloading. It even handles multiple registered types per module.

The #GTypePlugin interface is used by the type system in order to handle the lifecycle of dynamically loaded types.

Fields
GTypeInterface baseIface
GTypePluginUse usePluginIncreases the use count of the plugin.
GTypePluginUnuse unusePluginDecreases the use count of the plugin.
GTypePluginCompleteTypeInfo completeTypeInfoFills in the #GTypeInfo and #GTypeValueTable structs for the type. The structs are initialized with `memset(s, 0, sizeof (s))` before calling this function.
GTypePluginCompleteInterfaceInfo completeInterfaceInfoFills in missing parts of the #GInterfaceInfo for the interface. The structs is initialized with `memset(s, 0, sizeof (s))` before calling this function.

A structure holding information for a specific type.

See also: [gobject.global.typeQuery]

Fields
GType typethe #GType value of the type
const(char) * typeNamethe name of the type
uint classSizethe size of the class structure
uint instanceSizethe size of the instance structure

The #GTypeValueTable provides the functions required by the #GValue implementation, to serve as a container for values of a type.

Fields
GTypeValueInitFunc valueInitFunction to initialize a GValue
GTypeValueFreeFunc valueFreeFunction to free a GValue
GTypeValueCopyFunc valueCopyFunction to copy a GValue
GTypeValuePeekPointerFunc valuePeekPointerFunction to peek the contents of a GValue if they fit into a pointer
const(char) * collectFormatA string format describing how to collect the contents of this value bit-by-bit. Each character in the format represents an argument to be collected, and the characters themselves indicate the type...
GTypeValueCollectFunc collectValueFunction to initialize a GValue from the values collected from variadic arguments
const(char) * lcopyFormatFormat description of the arguments to collect for @lcopyvalue, analogous to @collectformat. Usually, @lcopyformat string consists only of `'p'`s to provide lcopyvalue() with pointers to storage lo...
GTypeValueLCopyFunc lcopyValueFunction to store the contents of a value into the locations collected from variadic arguments
structGValue

An opaque structure used to hold different types of values.

The data within the structure has protected scope: it is accessible only to functions within a #GTypeValueTable structure, or implementations of the g_value_*() API. That is, code portions which implement new fundamental types.

#GValue users cannot make any assumptions about how data is stored within the 2 element @data union, and the @g_type member should only be accessed through the G_VALUE_TYPE() macro.

Fields
GType gType
_Value__data__union[2] data

A [gobject.value_array.ValueArray] is a container structure to hold an array of generic values.

The prime purpose of a [gobject.value_array.ValueArray] is for it to be used as an object property that holds an array of values. A [gobject.value_array.ValueArray] wraps an array of [gobject.value.Value] elements in order for it to be used as a boxed type through G_TYPE_VALUE_ARRAY.

[gobject.value_array.ValueArray] is deprecated in favour of [glib.array.Array] since GLib 2.32. It is possible to create a [glib.array.Array] that behaves like a [gobject.value_array.ValueArray] by using the size of [gobject.value.Value] as the element size, and by setting [gobject.value.Value.unset] as the clear function using [glib.array.Array.setClearFunc], for instance, the following code:

GValueArray *array = g_value_array_new (10);

can be replaced by:

GArray *array = g_array_sized_new (FALSE, TRUE, sizeof (GValue), 10);
 g_array_set_clear_func (array, (GDestroyNotify) g_value_unset);

Deprecated

Use [glib.array.Array] instead, if possible for the given use case,

as described above.

Fields
uint nValuesnumber of values contained in the array
GValue * valuesarray of values
uint nPrealloced
union_Value__data__union
Fields
int vInt
uint vUint
glong vLong
gulong vUlong
long vInt64
ulong vUint64
float vFloat
double vDouble
void * vPointer
structGWeakRef

A structure containing a weak reference to a #GObject.

A [gobject.weak_ref.WeakRef] can either be empty (i.e. point to null), or point to an object for as long as at least one "strong" reference to that object exists. Before the object's #GObjectClass.dispose method is called, every #GWeakRef associated with becomes empty (i.e. points to null).

Like #GValue, #GWeakRef can be statically allocated, stack- or heap-allocated, or embedded in larger structures.

Unlike [gobject.object.ObjectWrap.weakRef] and [gobject.object.ObjectWrap.addWeakPointer], this weak reference is thread-safe: converting a weak pointer to a reference is atomic with respect to invalidation of weak pointers to destroyed objects.

If the object's #GObjectClass.dispose method results in additional references to the object being held (‘re-referencing’), any #GWeakRefs taken before it was disposed will continue to point to null. Any #GWeakRefs taken during disposal and after re-referencing, or after disposal has returned due to the re-referencing, will continue to point to the object until its refcount goes back to zero, at which point they too will be invalidated.

It is invalid to take a #GWeakRef on an object during #GObjectClass.dispose without first having or creating a strong reference to the object.

Fields
PrivType priv
aliasGBaseFinalizeFunc = void function(GTypeClass * gClass)
aliasGBaseInitFunc = void function(GTypeClass * gClass)
aliasGBindingTransformFunc = gboolean function(GBinding * binding, const(GValue) * fromValue, GValue * toValue, void * userData)
aliasGBoxedCopyFunc = void * function(void * boxed)
aliasGBoxedFreeFunc = void function(void * boxed)
aliasGCallback = void function()
aliasGClassFinalizeFunc = void function(GTypeClass * gClass, void * classData)
aliasGClassInitFunc = void function(GTypeClass * gClass, void * classData)
aliasGClosureMarshal = void function(GClosure * closure, GValue * returnValue, uint nParamValues, const(GValue) * paramValues, void * invocationHint, void * marshalData)
aliasGClosureNotify = void function(void * data, GClosure * closure)
aliasGInstanceInitFunc = void function(GTypeInstance * instance, GTypeClass * gClass)
aliasGInterfaceFinalizeFunc = void function(GTypeInterface * gIface, void * ifaceData)
aliasGInterfaceInitFunc = void function(GTypeInterface * gIface, void * ifaceData)
aliasGObjectFinalizeFunc = void function(GObject * object)
aliasGObjectGetPropertyFunc = void function(GObject * object, uint propertyId, GValue * value, GParamSpec * pspec)
aliasGObjectSetPropertyFunc = void function(GObject * object, uint propertyId, const(GValue) * value, GParamSpec * pspec)
aliasGSignalAccumulator = gboolean function(GSignalInvocationHint * ihint, GValue * returnAccu, const(GValue) * handlerReturn, void * data)
aliasGSignalEmissionHook = gboolean function(GSignalInvocationHint * ihint, uint nParamValues, const(GValue) * paramValues, void * data)
aliasGToggleNotify = void function(void * data, GObject * object, gboolean isLastRef)
aliasGTypeClassCacheFunc = gboolean function(void * cacheData, GTypeClass * gClass)
aliasGTypeInterfaceCheckFunc = void function(void * checkData, GTypeInterface * gIface)
aliasGTypePluginCompleteInterfaceInfo = void function(GTypePlugin * plugin, GType instanceType, GType interfaceType, GInterfaceInfo * info)
aliasGTypePluginCompleteTypeInfo = void function(GTypePlugin * plugin, GType gType, GTypeInfo * info, GTypeValueTable * valueTable)
aliasGTypePluginUnuse = void function(GTypePlugin * plugin)
aliasGTypePluginUse = void function(GTypePlugin * plugin)
aliasGTypeValueCollectFunc = char * function(GValue * value, uint nCollectValues, GTypeCValue * collectValues, uint collectFlags)
aliasGTypeValueCopyFunc = void function(const(GValue) * srcValue, GValue * destValue)
aliasGTypeValueFreeFunc = void function(GValue * value)
aliasGTypeValueInitFunc = void function(GValue * value)
aliasGTypeValueLCopyFunc = char * function(const(GValue) * value, uint nCollectValues, GTypeCValue * collectValues, uint collectFlags)
aliasGTypeValuePeekPointerFunc = void * function(const(GValue) * value)
aliasGVaClosureMarshal = void function(GClosure * closure, GValue * returnValue, GTypeInstance * instance, void * args, void * marshalData, int nParams, GType * paramTypes)
aliasGValueTransform = void function(const(GValue) * srcValue, GValue * destValue)
aliasGWeakNotify = void function(void * data, GObject * whereTheObjectWas)