Structures
The following structures are available globally.
-
GBinding
is the representation of a binding between a property on aGObject
instance (or source) and another property on anotherGObject
instance (or target).Whenever the source property changes, the same value is applied to the target property; for instance, the following binding:
(C Language Example):
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 timeg_object_set()
or the specific accessor changes the value of the property “property-a” ofobject1
.It is possible to create a bidirectional binding between two properties of two
GObject
instances, so that if either property changes, the other is updated as well, for instance:(C Language Example):
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:
(C Language Example):
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 ofadjustment1
changes and will transform the current value of the property before applying it to the “value” property ofadjustment2
.Vice versa, the
fahrenheit_to_celsius
function will be called whenever the “value” property ofadjustment2
changes, and will transform the current value of the property before applying it to the “value” property ofadjustment1
.Note that
GBinding
does not resolve cycles by itself; a cycle likeobject1: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 theGObject::notify
signal, so it is susceptible to all the various ways of blocking a signal emission, likeg_signal_stop_emission()
org_signal_handler_block()
.A binding will be severed, and the resources it allocates freed, whenever either one of the
GObject
instances it refers to are finalized, or when theGBinding
instance loses its last reference.Bindings for languages with garbage collection can use
g_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.GBinding
is available since GObject 2.26The
See moreBindingRef
type acts as a lightweight Swift reference to an underlyingGBinding
instance. It exposes methods that can operate on this data type throughBindingProtocol
conformance. UseBindingRef
only as anunowned
reference to an existingGBinding
instance.Declaration
Swift
public struct BindingRef : BindingProtocol, GWeakCapturing
-
A
GCClosure
is a specialization ofGClosure
for C function callbacks.The
See moreCClosureRef
type acts as a lightweight Swift reference to an underlyingGCClosure
instance. It exposes methods that can operate on this data type throughCClosureProtocol
conformance. UseCClosureRef
only as anunowned
reference to an existingGCClosure
instance.Declaration
Swift
public struct CClosureRef : CClosureProtocol
-
A
GClosure
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 aGValue
.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 theGCClosure
type for this purpose. Bindings for other languages need marshallers which convert betweenGValues
and suitable representations in the runtime of the language in order to use functions written in that language as callbacks. Useg_closure_set_marshal()
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 tog_signal_new()
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 utility. Closures can be explicitly connected to signals withg_signal_connect_closure()
, 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.g_closure_invalidate()
and invalidation notifiers allow callbacks to be automatically removed when the objects they point to go away.
The
See moreClosureRef
type acts as a lightweight Swift reference to an underlyingGClosure
instance. It exposes methods that can operate on this data type throughClosureProtocol
conformance. UseClosureRef
only as anunowned
reference to an existingGClosure
instance.Declaration
Swift
public struct ClosureRef : ClosureProtocol
-
The
See moreClosureNotifyDataRef
type acts as a lightweight Swift reference to an underlyingGClosureNotifyData
instance. It exposes methods that can operate on this data type throughClosureNotifyDataProtocol
conformance. UseClosureNotifyDataRef
only as anunowned
reference to an existingGClosureNotifyData
instance.Declaration
Swift
public struct ClosureNotifyDataRef : ClosureNotifyDataProtocol
-
The class of an enumeration type holds information about its possible values.
The
See moreEnumClassRef
type acts as a lightweight Swift reference to an underlyingGEnumClass
instance. It exposes methods that can operate on this data type throughEnumClassProtocol
conformance. UseEnumClassRef
only as anunowned
reference to an existingGEnumClass
instance.Declaration
Swift
public struct EnumClassRef : EnumClassProtocol
-
A structure which contains a single enum value, its name, and its nickname.
The
See moreEnumValueRef
type acts as a lightweight Swift reference to an underlyingGEnumValue
instance. It exposes methods that can operate on this data type throughEnumValueProtocol
conformance. UseEnumValueRef
only as anunowned
reference to an existingGEnumValue
instance.Declaration
Swift
public struct EnumValueRef : EnumValueProtocol
-
The class of a flags type holds information about its possible values.
The
See moreFlagsClassRef
type acts as a lightweight Swift reference to an underlyingGFlagsClass
instance. It exposes methods that can operate on this data type throughFlagsClassProtocol
conformance. UseFlagsClassRef
only as anunowned
reference to an existingGFlagsClass
instance.Declaration
Swift
public struct FlagsClassRef : FlagsClassProtocol
-
A structure which contains a single flags value, its name, and its nickname.
The
See moreFlagsValueRef
type acts as a lightweight Swift reference to an underlyingGFlagsValue
instance. It exposes methods that can operate on this data type throughFlagsValueProtocol
conformance. UseFlagsValueRef
only as anunowned
reference to an existingGFlagsValue
instance.Declaration
Swift
public struct FlagsValueRef : FlagsValueProtocol
-
A type for objects that have an initially floating reference.
All the fields in the
GInitiallyUnowned
structure are private to the implementation and should never be accessed directly.The
See moreInitiallyUnownedRef
type acts as a lightweight Swift reference to an underlyingGInitiallyUnowned
instance. It exposes methods that can operate on this data type throughInitiallyUnownedProtocol
conformance. UseInitiallyUnownedRef
only as anunowned
reference to an existingGInitiallyUnowned
instance.Declaration
Swift
public struct InitiallyUnownedRef : InitiallyUnownedProtocol, GWeakCapturing
-
The class structure for the GInitiallyUnowned type.
The
See moreInitiallyUnownedClassRef
type acts as a lightweight Swift reference to an underlyingGInitiallyUnownedClass
instance. It exposes methods that can operate on this data type throughInitiallyUnownedClassProtocol
conformance. UseInitiallyUnownedClassRef
only as anunowned
reference to an existingGInitiallyUnownedClass
instance.Declaration
Swift
public struct InitiallyUnownedClassRef : InitiallyUnownedClassProtocol
-
A structure that provides information to the type system which is used specifically for managing interface types.
The
See moreInterfaceInfoRef
type acts as a lightweight Swift reference to an underlyingGInterfaceInfo
instance. It exposes methods that can operate on this data type throughInterfaceInfoProtocol
conformance. UseInterfaceInfoRef
only as anunowned
reference to an existingGInterfaceInfo
instance.Declaration
Swift
public struct InterfaceInfoRef : InterfaceInfoProtocol
-
The class structure for the GObject type.
(C Language Example):
// 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; }
The
See moreObjectClassRef
type acts as a lightweight Swift reference to an underlyingGObjectClass
instance. It exposes methods that can operate on this data type throughObjectClassProtocol
conformance. UseObjectClassRef
only as anunowned
reference to an existingGObjectClass
instance.Declaration
Swift
public struct ObjectClassRef : ObjectClassProtocol
-
The GObjectConstructParam struct is an auxiliary structure used to hand
GParamSpec
/GValue
pairs to theconstructor
of aGObjectClass
.The
See moreObjectConstructParamRef
type acts as a lightweight Swift reference to an underlyingGObjectConstructParam
instance. It exposes methods that can operate on this data type throughObjectConstructParamProtocol
conformance. UseObjectConstructParamRef
only as anunowned
reference to an existingGObjectConstructParam
instance.Declaration
Swift
public struct ObjectConstructParamRef : ObjectConstructParamProtocol
-
The base object type.
All the fields in the
GObject
structure are private to the implementation and should never be accessed directly.The
See moreObjectRef
type acts as a lightweight Swift reference to an underlyingGObject
instance. It exposes methods that can operate on this data type throughObjectProtocol
conformance. UseObjectRef
only as anunowned
reference to an existingGObject
instance.Declaration
Swift
public struct ObjectRef : ObjectProtocol, GWeakCapturing
-
The class structure for the GParamSpec type. Normally, GParamSpec classes are filled by
g_param_type_register_static()
.The
See moreParamSpecClassRef
type acts as a lightweight Swift reference to an underlyingGParamSpecClass
instance. It exposes methods that can operate on this data type throughParamSpecClassProtocol
conformance. UseParamSpecClassRef
only as anunowned
reference to an existingGParamSpecClass
instance.Declaration
Swift
public struct ParamSpecClassRef : ParamSpecClassProtocol
-
A
GParamSpecPool
maintains a collection ofGParamSpecs
which can be quickly accessed by owner and name.The implementation of the
GObject
property system uses such a pool to store theGParamSpecs
of the properties all object types.The
See moreParamSpecPoolRef
type acts as a lightweight Swift reference to an underlyingGParamSpecPool
instance. It exposes methods that can operate on this data type throughParamSpecPoolProtocol
conformance. UseParamSpecPoolRef
only as anunowned
reference to an existingGParamSpecPool
instance.Declaration
Swift
public struct ParamSpecPoolRef : ParamSpecPoolProtocol
-
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
g_param_type_register_static()
The type system will perform a deep copy of this structure, so its memory does not need to be persistent across invocation ofg_param_type_register_static()
.The
See moreParamSpecTypeInfoRef
type acts as a lightweight Swift reference to an underlyingGParamSpecTypeInfo
instance. It exposes methods that can operate on this data type throughParamSpecTypeInfoProtocol
conformance. UseParamSpecTypeInfoRef
only as anunowned
reference to an existingGParamSpecTypeInfo
instance.Declaration
Swift
public struct ParamSpecTypeInfoRef : ParamSpecTypeInfoProtocol
-
The GParameter struct is an auxiliary structure used to hand parameter name/value pairs to
g_object_newv()
.The
See moreParameterRef
type acts as a lightweight Swift reference to an underlyingGParameter
instance. It exposes methods that can operate on this data type throughParameterProtocol
conformance. UseParameterRef
only as anunowned
reference to an existingGParameter
instance.Declaration
Swift
public struct ParameterRef : ParameterProtocol
-
GParamSpec
is an object structure that encapsulates the metadata required to specify parameters, such as e.g.GObject
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 (seeg_signal_new()
).When creating and looking up a
GParamSpec
, either separator can be used, but they cannot be mixed. Using-
is considerably more efficient, and is the ‘canonical form’. Using_
is discouraged.The
See moreParamSpecRef
type acts as a lightweight Swift reference to an underlyingGParamSpec
instance. It exposes methods that can operate on this data type throughParamSpecProtocol
conformance. UseParamSpecRef
only as anunowned
reference to an existingGParamSpec
instance.Declaration
Swift
public struct ParamSpecRef : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for boolean properties.The
See moreParamSpecBooleanRef
type acts as a lightweight Swift reference to an underlyingGParamSpecBoolean
instance. It exposes methods that can operate on this data type throughParamSpecBooleanProtocol
conformance. UseParamSpecBooleanRef
only as anunowned
reference to an existingGParamSpecBoolean
instance.Declaration
Swift
public struct ParamSpecBooleanRef : ParamSpecBooleanProtocol
-
A
GParamSpec
derived structure that contains the meta data for boxed properties.The
See moreParamSpecBoxedRef
type acts as a lightweight Swift reference to an underlyingGParamSpecBoxed
instance. It exposes methods that can operate on this data type throughParamSpecBoxedProtocol
conformance. UseParamSpecBoxedRef
only as anunowned
reference to an existingGParamSpecBoxed
instance.Declaration
Swift
public struct ParamSpecBoxedRef : ParamSpecBoxedProtocol
-
A
GParamSpec
derived structure that contains the meta data for character properties.The
See moreParamSpecCharRef
type acts as a lightweight Swift reference to an underlyingGParamSpecChar
instance. It exposes methods that can operate on this data type throughParamSpecCharProtocol
conformance. UseParamSpecCharRef
only as anunowned
reference to an existingGParamSpecChar
instance.Declaration
Swift
public struct ParamSpecCharRef : ParamSpecCharProtocol
-
A
GParamSpec
derived structure that contains the meta data for double properties.The
See moreParamSpecDoubleRef
type acts as a lightweight Swift reference to an underlyingGParamSpecDouble
instance. It exposes methods that can operate on this data type throughParamSpecDoubleProtocol
conformance. UseParamSpecDoubleRef
only as anunowned
reference to an existingGParamSpecDouble
instance.Declaration
Swift
public struct ParamSpecDoubleRef : ParamSpecDoubleProtocol
-
A
GParamSpec
derived structure that contains the meta data for enum properties.The
See moreParamSpecEnumRef
type acts as a lightweight Swift reference to an underlyingGParamSpecEnum
instance. It exposes methods that can operate on this data type throughParamSpecEnumProtocol
conformance. UseParamSpecEnumRef
only as anunowned
reference to an existingGParamSpecEnum
instance.Declaration
Swift
public struct ParamSpecEnumRef : ParamSpecEnumProtocol
-
A
GParamSpec
derived structure that contains the meta data for flags properties.The
See moreParamSpecFlagsRef
type acts as a lightweight Swift reference to an underlyingGParamSpecFlags
instance. It exposes methods that can operate on this data type throughParamSpecFlagsProtocol
conformance. UseParamSpecFlagsRef
only as anunowned
reference to an existingGParamSpecFlags
instance.Declaration
Swift
public struct ParamSpecFlagsRef : ParamSpecFlagsProtocol
-
A
GParamSpec
derived structure that contains the meta data for float properties.The
See moreParamSpecFloatRef
type acts as a lightweight Swift reference to an underlyingGParamSpecFloat
instance. It exposes methods that can operate on this data type throughParamSpecFloatProtocol
conformance. UseParamSpecFloatRef
only as anunowned
reference to an existingGParamSpecFloat
instance.Declaration
Swift
public struct ParamSpecFloatRef : ParamSpecFloatProtocol
-
A
GParamSpec
derived structure that contains the meta data forGType
properties.The
See moreParamSpecGTypeRef
type acts as a lightweight Swift reference to an underlyingGParamSpecGType
instance. It exposes methods that can operate on this data type throughParamSpecGTypeProtocol
conformance. UseParamSpecGTypeRef
only as anunowned
reference to an existingGParamSpecGType
instance.Declaration
Swift
public struct ParamSpecGTypeRef : ParamSpecGTypeProtocol
-
A
GParamSpec
derived structure that contains the meta data for integer properties.The
See moreParamSpecIntRef
type acts as a lightweight Swift reference to an underlyingGParamSpecInt
instance. It exposes methods that can operate on this data type throughParamSpecIntProtocol
conformance. UseParamSpecIntRef
only as anunowned
reference to an existingGParamSpecInt
instance.Declaration
Swift
public struct ParamSpecIntRef : ParamSpecIntProtocol
-
A
GParamSpec
derived structure that contains the meta data for 64bit integer properties.The
See moreParamSpecInt64Ref
type acts as a lightweight Swift reference to an underlyingGParamSpecInt64
instance. It exposes methods that can operate on this data type throughParamSpecInt64Protocol
conformance. UseParamSpecInt64Ref
only as anunowned
reference to an existingGParamSpecInt64
instance.Declaration
Swift
public struct ParamSpecInt64Ref : ParamSpecInt64Protocol
-
A
GParamSpec
derived structure that contains the meta data for long integer properties.The
See moreParamSpecLongRef
type acts as a lightweight Swift reference to an underlyingGParamSpecLong
instance. It exposes methods that can operate on this data type throughParamSpecLongProtocol
conformance. UseParamSpecLongRef
only as anunowned
reference to an existingGParamSpecLong
instance.Declaration
Swift
public struct ParamSpecLongRef : ParamSpecLongProtocol
-
A
GParamSpec
derived structure that contains the meta data for object properties.The
See moreParamSpecObjectRef
type acts as a lightweight Swift reference to an underlyingGParamSpecObject
instance. It exposes methods that can operate on this data type throughParamSpecObjectProtocol
conformance. UseParamSpecObjectRef
only as anunowned
reference to an existingGParamSpecObject
instance.Declaration
Swift
public struct ParamSpecObjectRef : ParamSpecObjectProtocol
-
A
GParamSpec
derived structure that redirects operations to other types ofGParamSpec
.All operations other than getting or setting the value are redirected, including accessing the nick and blurb, validating a value, and so forth.
See
g_param_spec_get_redirect_target()
for retrieving the overridden property.GParamSpecOverride
is used in implementingg_object_class_override_property()
, and will not be directly useful unless you are implementing a new base type similar to GObject.The
See moreParamSpecOverrideRef
type acts as a lightweight Swift reference to an underlyingGParamSpecOverride
instance. It exposes methods that can operate on this data type throughParamSpecOverrideProtocol
conformance. UseParamSpecOverrideRef
only as anunowned
reference to an existingGParamSpecOverride
instance.Declaration
Swift
public struct ParamSpecOverrideRef : ParamSpecOverrideProtocol
-
A
GParamSpec
derived structure that contains the meta data forG_TYPE_PARAM
properties.The
See moreParamSpecParamRef
type acts as a lightweight Swift reference to an underlyingGParamSpecParam
instance. It exposes methods that can operate on this data type throughParamSpecParamProtocol
conformance. UseParamSpecParamRef
only as anunowned
reference to an existingGParamSpecParam
instance.Declaration
Swift
public struct ParamSpecParamRef : ParamSpecParamProtocol
-
A
GParamSpec
derived structure that contains the meta data for pointer properties.The
See moreParamSpecPointerRef
type acts as a lightweight Swift reference to an underlyingGParamSpecPointer
instance. It exposes methods that can operate on this data type throughParamSpecPointerProtocol
conformance. UseParamSpecPointerRef
only as anunowned
reference to an existingGParamSpecPointer
instance.Declaration
Swift
public struct ParamSpecPointerRef : ParamSpecPointerProtocol
-
A
GParamSpec
derived structure that contains the meta data for string properties.The
See moreParamSpecStringRef
type acts as a lightweight Swift reference to an underlyingGParamSpecString
instance. It exposes methods that can operate on this data type throughParamSpecStringProtocol
conformance. UseParamSpecStringRef
only as anunowned
reference to an existingGParamSpecString
instance.Declaration
Swift
public struct ParamSpecStringRef : ParamSpecStringProtocol
-
A
GParamSpec
derived structure that contains the meta data for unsigned character properties.The
See moreParamSpecUCharRef
type acts as a lightweight Swift reference to an underlyingGParamSpecUChar
instance. It exposes methods that can operate on this data type throughParamSpecUCharProtocol
conformance. UseParamSpecUCharRef
only as anunowned
reference to an existingGParamSpecUChar
instance.Declaration
Swift
public struct ParamSpecUCharRef : ParamSpecUCharProtocol
-
A
GParamSpec
derived structure that contains the meta data for unsigned integer properties.The
See moreParamSpecUIntRef
type acts as a lightweight Swift reference to an underlyingGParamSpecUInt
instance. It exposes methods that can operate on this data type throughParamSpecUIntProtocol
conformance. UseParamSpecUIntRef
only as anunowned
reference to an existingGParamSpecUInt
instance.Declaration
Swift
public struct ParamSpecUIntRef : ParamSpecUIntProtocol
-
A
GParamSpec
derived structure that contains the meta data for unsigned 64bit integer properties.The
See moreParamSpecUInt64Ref
type acts as a lightweight Swift reference to an underlyingGParamSpecUInt64
instance. It exposes methods that can operate on this data type throughParamSpecUInt64Protocol
conformance. UseParamSpecUInt64Ref
only as anunowned
reference to an existingGParamSpecUInt64
instance.Declaration
Swift
public struct ParamSpecUInt64Ref : ParamSpecUInt64Protocol
-
A
GParamSpec
derived structure that contains the meta data for unsigned long integer properties.The
See moreParamSpecULongRef
type acts as a lightweight Swift reference to an underlyingGParamSpecULong
instance. It exposes methods that can operate on this data type throughParamSpecULongProtocol
conformance. UseParamSpecULongRef
only as anunowned
reference to an existingGParamSpecULong
instance.Declaration
Swift
public struct ParamSpecULongRef : ParamSpecULongProtocol
-
A
GParamSpec
derived structure that contains the meta data for unichar (unsigned integer) properties.The
See moreParamSpecUnicharRef
type acts as a lightweight Swift reference to an underlyingGParamSpecUnichar
instance. It exposes methods that can operate on this data type throughParamSpecUnicharProtocol
conformance. UseParamSpecUnicharRef
only as anunowned
reference to an existingGParamSpecUnichar
instance.Declaration
Swift
public struct ParamSpecUnicharRef : ParamSpecUnicharProtocol
-
A
GParamSpec
derived structure that contains the meta data forGValueArray
properties.The
See moreParamSpecValueArrayRef
type acts as a lightweight Swift reference to an underlyingGParamSpecValueArray
instance. It exposes methods that can operate on this data type throughParamSpecValueArrayProtocol
conformance. UseParamSpecValueArrayRef
only as anunowned
reference to an existingGParamSpecValueArray
instance.Declaration
Swift
public struct ParamSpecValueArrayRef : ParamSpecValueArrayProtocol
-
A
GParamSpec
derived structure that contains the meta data forGVariant
properties.When comparing values with
g_param_values_cmp()
, scalar values with the same type will be compared withg_variant_compare()
. Other non-nil
variants will be checked for equality withg_variant_equal()
, and their sort order is otherwise undefined.nil
is ordered before non-nil
variants. Twonil
values compare equal.The
See moreParamSpecVariantRef
type acts as a lightweight Swift reference to an underlyingGParamSpecVariant
instance. It exposes methods that can operate on this data type throughParamSpecVariantProtocol
conformance. UseParamSpecVariantRef
only as anunowned
reference to an existingGParamSpecVariant
instance.Declaration
Swift
public struct ParamSpecVariantRef : ParamSpecVariantProtocol
-
The
GSignalInvocationHint
structure is used to pass on additional information to callbacks during a signal emission.The
See moreSignalInvocationHintRef
type acts as a lightweight Swift reference to an underlyingGSignalInvocationHint
instance. It exposes methods that can operate on this data type throughSignalInvocationHintProtocol
conformance. UseSignalInvocationHintRef
only as anunowned
reference to an existingGSignalInvocationHint
instance.Declaration
Swift
public struct SignalInvocationHintRef : SignalInvocationHintProtocol
-
A structure holding in-depth information for a specific signal.
See also:
g_signal_query()
The
See moreSignalQueryRef
type acts as a lightweight Swift reference to an underlyingGSignalQuery
instance. It exposes methods that can operate on this data type throughSignalQueryProtocol
conformance. UseSignalQueryRef
only as anunowned
reference to an existingGSignalQuery
instance.Declaration
Swift
public struct SignalQueryRef : SignalQueryProtocol
-
An interface that handles the lifecycle of dynamically loaded types.
The GObject type system supports dynamic loading of types. It goes as follows:
- 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:
(C Language Example):
new_type_id = g_type_register_dynamic (parent_type_id, "TypeName", new_type_plugin, type_flags);
where
new_type_plugin
is an implementation of theGTypePlugin
interface.The type’s implementation is referenced, e.g. through
g_type_class_ref()
or throughg_type_create_instance()
(this is being called byg_object_new()
) or through one of the above done on a type derived fromnew_type_id
.This causes the type system to load the type’s implementation by calling
g_type_plugin_use()
andg_type_plugin_complete_type_info()
onnew_type_plugin
.At some point the type’s implementation isn’t required anymore, e.g. after
g_type_class_unref()
org_type_free_instance()
(called when the reference count of an instance drops to zero).This causes the type system to throw away the information retrieved from
g_type_plugin_complete_type_info()
and then it callsg_type_plugin_unuse()
onnew_type_plugin
.Things may repeat from the second step.
So basically, you need to implement a
GTypePlugin
type that carries a use_count, once use_count goes from zero to one, you need to load the implementation to successfully handle the upcomingg_type_plugin_complete_type_info()
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 callg_type_plugin_use()
andg_type_plugin_complete_type_info()
again when the type is needed again.GTypeModule
is an implementation ofGTypePlugin
that already implements most of this except for the actual module loading and unloading. It even handles multiple registered types per module.The
See moreTypePluginRef
type acts as a lightweight Swift reference to an underlyingGTypePlugin
instance. It exposes methods that can operate on this data type throughTypePluginProtocol
conformance. UseTypePluginRef
only as anunowned
reference to an existingGTypePlugin
instance.Declaration
Swift
public struct TypePluginRef : TypePluginProtocol
-
An opaque structure used as the base of all classes.
The
See moreTypeClassRef
type acts as a lightweight Swift reference to an underlyingGTypeClass
instance. It exposes methods that can operate on this data type throughTypeClassProtocol
conformance. UseTypeClassRef
only as anunowned
reference to an existingGTypeClass
instance.Declaration
Swift
public struct TypeClassRef : TypeClassProtocol
-
A structure that provides information to the type system which is used specifically for managing fundamental types.
The
See moreTypeFundamentalInfoRef
type acts as a lightweight Swift reference to an underlyingGTypeFundamentalInfo
instance. It exposes methods that can operate on this data type throughTypeFundamentalInfoProtocol
conformance. UseTypeFundamentalInfoRef
only as anunowned
reference to an existingGTypeFundamentalInfo
instance.Declaration
Swift
public struct TypeFundamentalInfoRef : TypeFundamentalInfoProtocol
-
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
g_type_register_static()
function (or is copied into the providedGTypeInfo
structure in theg_type_plugin_complete_type_info()
). The type system will perform a deep copy of this structure, so its memory does not need to be persistent across invocation ofg_type_register_static()
.The
See moreTypeInfoRef
type acts as a lightweight Swift reference to an underlyingGTypeInfo
instance. It exposes methods that can operate on this data type throughTypeInfoProtocol
conformance. UseTypeInfoRef
only as anunowned
reference to an existingGTypeInfo
instance.Declaration
Swift
public struct TypeInfoRef : TypeInfoProtocol
-
An opaque structure used as the base of all type instances.
The
See moreTypeInstanceRef
type acts as a lightweight Swift reference to an underlyingGTypeInstance
instance. It exposes methods that can operate on this data type throughTypeInstanceProtocol
conformance. UseTypeInstanceRef
only as anunowned
reference to an existingGTypeInstance
instance.Declaration
Swift
public struct TypeInstanceRef : TypeInstanceProtocol
-
An opaque structure used as the base of all interface types.
The
See moreTypeInterfaceRef
type acts as a lightweight Swift reference to an underlyingGTypeInterface
instance. It exposes methods that can operate on this data type throughTypeInterfaceProtocol
conformance. UseTypeInterfaceRef
only as anunowned
reference to an existingGTypeInterface
instance.Declaration
Swift
public struct TypeInterfaceRef : TypeInterfaceProtocol
-
In order to implement dynamic loading of types based on
GTypeModule
, theload
andunload
functions inGTypeModuleClass
must be implemented.The
See moreTypeModuleClassRef
type acts as a lightweight Swift reference to an underlyingGTypeModuleClass
instance. It exposes methods that can operate on this data type throughTypeModuleClassProtocol
conformance. UseTypeModuleClassRef
only as anunowned
reference to an existingGTypeModuleClass
instance.Declaration
Swift
public struct TypeModuleClassRef : TypeModuleClassProtocol
-
The
GTypePlugin
interface is used by the type system in order to handle the lifecycle of dynamically loaded types.The
See moreTypePluginClassRef
type acts as a lightweight Swift reference to an underlyingGTypePluginClass
instance. It exposes methods that can operate on this data type throughTypePluginClassProtocol
conformance. UseTypePluginClassRef
only as anunowned
reference to an existingGTypePluginClass
instance.Declaration
Swift
public struct TypePluginClassRef : TypePluginClassProtocol
-
A structure holding information for a specific type.
See also:
g_type_query()
The
See moreTypeQueryRef
type acts as a lightweight Swift reference to an underlyingGTypeQuery
instance. It exposes methods that can operate on this data type throughTypeQueryProtocol
conformance. UseTypeQueryRef
only as anunowned
reference to an existingGTypeQuery
instance.Declaration
Swift
public struct TypeQueryRef : TypeQueryProtocol
-
The
GTypeValueTable
provides the functions required by theGValue
implementation, to serve as a container for values of a type.The
See moreTypeValueTableRef
type acts as a lightweight Swift reference to an underlyingGTypeValueTable
instance. It exposes methods that can operate on this data type throughTypeValueTableProtocol
conformance. UseTypeValueTableRef
only as anunowned
reference to an existingGTypeValueTable
instance.Declaration
Swift
public struct TypeValueTableRef : TypeValueTableProtocol
-
GTypeModule
provides a simple implementation of theGTypePlugin
interface.The model of
GTypeModule
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
g_type_module_register_type()
andg_type_module_add_interface()
. 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 beforeg_object_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
g_type_module_use()
andg_type_module_unuse()
. Typically, when loading a module for the first type,g_type_module_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,g_type_module_unuse()
is called.GTypeModule
does not actually provide any implementation of module loading and unloading. To create a particular module type you must derive fromGTypeModule
and implement the load and unload functions inGTypeModuleClass
.The
See moreTypeModuleRef
type acts as a lightweight Swift reference to an underlyingGTypeModule
instance. It exposes methods that can operate on this data type throughTypeModuleProtocol
conformance. UseTypeModuleRef
only as anunowned
reference to an existingGTypeModule
instance.Declaration
Swift
public struct TypeModuleRef : TypeModuleProtocol, GWeakCapturing
-
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 elementdata
union, and theg_type
member should only be accessed through theG_VALUE_TYPE()
macro.The
See moreValueRef
type acts as a lightweight Swift reference to an underlyingGValue
instance. It exposes methods that can operate on this data type throughValueProtocol
conformance. UseValueRef
only as anunowned
reference to an existingGValue
instance.Declaration
Swift
public struct ValueRef : ValueProtocol
-
A
GValueArray
contains an array ofGValue
elements.The
See moreValueArrayRef
type acts as a lightweight Swift reference to an underlyingGValueArray
instance. It exposes methods that can operate on this data type throughValueArrayProtocol
conformance. UseValueArrayRef
only as anunowned
reference to an existingGValueArray
instance.Declaration
Swift
public struct ValueArrayRef : ValueArrayProtocol
-
A structure containing a weak reference to a
GObject
.A
GWeakRef
can either be empty (i.e. point tonil
), or point to an object for as long as at least one “strong” reference to that object exists. Before the object’sGObjectClass.dispose
method is called, everyGWeakRef
associated with becomes empty (i.e. points tonil
).Like
GValue
,GWeakRef
can be statically allocated, stack- or heap-allocated, or embedded in larger structures.Unlike
g_object_weak_ref()
andg_object_add_weak_pointer()
, 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’), anyGWeakRefs
taken before it was disposed will continue to point tonil
. AnyGWeakRefs
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 duringGObjectClass.dispose
without first having or creating a strong reference to the object.The
See moreWeakRefRef
type acts as a lightweight Swift reference to an underlyingGWeakRef
instance. It exposes methods that can operate on this data type throughWeakRefProtocol
conformance. UseWeakRefRef
only as anunowned
reference to an existingGWeakRef
instance.Declaration
Swift
public struct WeakRefRef : WeakRefProtocol
-
Flags to be passed to
g_object_bind_property()
org_object_bind_property_full()
.This enumeration can be extended at later date.
See moreDeclaration
Swift
public struct BindingFlags : OptionSet
-
The connection flags are used to specify the behaviour of a signal’s connection.
See moreDeclaration
Swift
public struct ConnectFlags : OptionSet
-
Through the
GParamFlags
flag values, certain aspects of parameters can be configured.See also:
See moreG_PARAM_STATIC_STRINGS
Declaration
Swift
public struct ParamFlags : OptionSet
-
The signal flags are used to specify a signal’s behaviour.
See moreDeclaration
Swift
public struct SignalFlags : OptionSet
-
The match types specify what
See moreg_signal_handlers_block_matched()
,g_signal_handlers_unblock_matched()
andg_signal_handlers_disconnect_matched()
match signals by.Declaration
Swift
public struct SignalMatchType : OptionSet
-
These flags used to be passed to
g_type_init_with_debug_flags()
which is now deprecated.If you need to enable debugging features, use the GOBJECT_DEBUG environment variable.
TypeDebugFlags is deprecated: g_type_init() is now done automatically
See moreDeclaration
Swift
public struct TypeDebugFlags : OptionSet
-
Bit masks used to check or determine characteristics of a type.
See moreDeclaration
Swift
public struct TypeFlags : OptionSet
-
Bit masks used to check or determine specific characteristics of a fundamental type.
See moreDeclaration
Swift
public struct TypeFundamentalFlags : OptionSet
-
The
See moreTypeCValueRef
type acts as a lightweight Swift reference to an underlyingGTypeCValue
instance. It exposes methods that can operate on this data type throughTypeCValueProtocol
conformance. UseTypeCValueRef
only as anunowned
reference to an existingGTypeCValue
instance.Declaration
Swift
public struct TypeCValueRef : TypeCValueProtocol
-
The
See more_Value__data__unionRef
type acts as a lightweight Swift reference to an underlying_Value__data__union
instance. It exposes methods that can operate on this data type through_Value__data__unionProtocol
conformance. Use_Value__data__unionRef
only as anunowned
reference to an existing_Value__data__union
instance.Declaration
Swift
public struct _Value__data__unionRef : _Value__data__unionProtocol
-
Type representing the name of a property
See moreDeclaration
Swift
public struct PropertyName
extension PropertyName: PropertyNameProtocol
extension PropertyName: ExpressibleByStringLiteral