Protocols
The following protocols 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 moreBindingProtocol
protocol exposes the methods and properties of an underlyingGBinding
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeBinding
. Alternatively, useBindingRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol BindingProtocol : ObjectProtocol
-
A
GCClosure
is a specialization ofGClosure
for C function callbacks.The
See moreCClosureProtocol
protocol exposes the methods and properties of an underlyingGCClosure
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeCClosure
. Alternatively, useCClosureRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol 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 moreClosureProtocol
protocol exposes the methods and properties of an underlyingGClosure
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeClosure
. Alternatively, useClosureRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ClosureProtocol
-
The
See moreClosureNotifyDataProtocol
protocol exposes the methods and properties of an underlyingGClosureNotifyData
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeClosureNotifyData
. Alternatively, useClosureNotifyDataRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ClosureNotifyDataProtocol
-
The class of an enumeration type holds information about its possible values.
The
See moreEnumClassProtocol
protocol exposes the methods and properties of an underlyingGEnumClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEnumClass
. Alternatively, useEnumClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EnumClassProtocol
-
A structure which contains a single enum value, its name, and its nickname.
The
See moreEnumValueProtocol
protocol exposes the methods and properties of an underlyingGEnumValue
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeEnumValue
. Alternatively, useEnumValueRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol EnumValueProtocol
-
The class of a flags type holds information about its possible values.
The
See moreFlagsClassProtocol
protocol exposes the methods and properties of an underlyingGFlagsClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFlagsClass
. Alternatively, useFlagsClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol FlagsClassProtocol
-
A structure which contains a single flags value, its name, and its nickname.
The
See moreFlagsValueProtocol
protocol exposes the methods and properties of an underlyingGFlagsValue
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeFlagsValue
. Alternatively, useFlagsValueRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol 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 moreInitiallyUnownedProtocol
protocol exposes the methods and properties of an underlyingGInitiallyUnowned
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeInitiallyUnowned
. Alternatively, useInitiallyUnownedRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol InitiallyUnownedProtocol : ObjectProtocol
-
The class structure for the GInitiallyUnowned type.
The
See moreInitiallyUnownedClassProtocol
protocol exposes the methods and properties of an underlyingGInitiallyUnownedClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeInitiallyUnownedClass
. Alternatively, useInitiallyUnownedClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol InitiallyUnownedClassProtocol
-
A structure that provides information to the type system which is used specifically for managing interface types.
The
See moreInterfaceInfoProtocol
protocol exposes the methods and properties of an underlyingGInterfaceInfo
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeInterfaceInfo
. Alternatively, useInterfaceInfoRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol 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 moreObjectClassProtocol
protocol exposes the methods and properties of an underlyingGObjectClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeObjectClass
. Alternatively, useObjectClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ObjectClassProtocol
-
The GObjectConstructParam struct is an auxiliary structure used to hand
GParamSpec
/GValue
pairs to theconstructor
of aGObjectClass
.The
See moreObjectConstructParamProtocol
protocol exposes the methods and properties of an underlyingGObjectConstructParam
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeObjectConstructParam
. Alternatively, useObjectConstructParamRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol 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 moreObjectProtocol
protocol exposes the methods and properties of an underlyingGObject
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeObject
. Alternatively, useObjectRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ObjectProtocol
-
The class structure for the GParamSpec type. Normally, GParamSpec classes are filled by
g_param_type_register_static()
.The
See moreParamSpecClassProtocol
protocol exposes the methods and properties of an underlyingGParamSpecClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecClass
. Alternatively, useParamSpecClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol 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 moreParamSpecPoolProtocol
protocol exposes the methods and properties of an underlyingGParamSpecPool
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecPool
. Alternatively, useParamSpecPoolRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol 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 moreParamSpecTypeInfoProtocol
protocol exposes the methods and properties of an underlyingGParamSpecTypeInfo
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecTypeInfo
. Alternatively, useParamSpecTypeInfoRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecTypeInfoProtocol
-
The GParameter struct is an auxiliary structure used to hand parameter name/value pairs to
g_object_newv()
.The
See moreParameterProtocol
protocol exposes the methods and properties of an underlyingGParameter
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParameter
. Alternatively, useParameterRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol 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 moreParamSpecProtocol
protocol exposes the methods and properties of an underlyingGParamSpec
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpec
. Alternatively, useParamSpecRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for boolean properties.The
See moreParamSpecBooleanProtocol
protocol exposes the methods and properties of an underlyingGParamSpecBoolean
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecBoolean
. Alternatively, useParamSpecBooleanRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecBooleanProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for boxed properties.The
See moreParamSpecBoxedProtocol
protocol exposes the methods and properties of an underlyingGParamSpecBoxed
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecBoxed
. Alternatively, useParamSpecBoxedRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecBoxedProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for character properties.The
See moreParamSpecCharProtocol
protocol exposes the methods and properties of an underlyingGParamSpecChar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecChar
. Alternatively, useParamSpecCharRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecCharProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for double properties.The
See moreParamSpecDoubleProtocol
protocol exposes the methods and properties of an underlyingGParamSpecDouble
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecDouble
. Alternatively, useParamSpecDoubleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecDoubleProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for enum properties.The
See moreParamSpecEnumProtocol
protocol exposes the methods and properties of an underlyingGParamSpecEnum
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecEnum
. Alternatively, useParamSpecEnumRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecEnumProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for flags properties.The
See moreParamSpecFlagsProtocol
protocol exposes the methods and properties of an underlyingGParamSpecFlags
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecFlags
. Alternatively, useParamSpecFlagsRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecFlagsProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for float properties.The
See moreParamSpecFloatProtocol
protocol exposes the methods and properties of an underlyingGParamSpecFloat
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecFloat
. Alternatively, useParamSpecFloatRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecFloatProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data forGType
properties.The
See moreParamSpecGTypeProtocol
protocol exposes the methods and properties of an underlyingGParamSpecGType
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecGType
. Alternatively, useParamSpecGTypeRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecGTypeProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for integer properties.The
See moreParamSpecIntProtocol
protocol exposes the methods and properties of an underlyingGParamSpecInt
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecInt
. Alternatively, useParamSpecIntRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecIntProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for 64bit integer properties.The
See moreParamSpecInt64Protocol
protocol exposes the methods and properties of an underlyingGParamSpecInt64
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecInt64
. Alternatively, useParamSpecInt64Ref
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecInt64Protocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for long integer properties.The
See moreParamSpecLongProtocol
protocol exposes the methods and properties of an underlyingGParamSpecLong
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecLong
. Alternatively, useParamSpecLongRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecLongProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for object properties.The
See moreParamSpecObjectProtocol
protocol exposes the methods and properties of an underlyingGParamSpecObject
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecObject
. Alternatively, useParamSpecObjectRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecObjectProtocol : ParamSpecProtocol
-
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 moreParamSpecOverrideProtocol
protocol exposes the methods and properties of an underlyingGParamSpecOverride
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecOverride
. Alternatively, useParamSpecOverrideRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecOverrideProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data forG_TYPE_PARAM
properties.The
See moreParamSpecParamProtocol
protocol exposes the methods and properties of an underlyingGParamSpecParam
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecParam
. Alternatively, useParamSpecParamRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecParamProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for pointer properties.The
See moreParamSpecPointerProtocol
protocol exposes the methods and properties of an underlyingGParamSpecPointer
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecPointer
. Alternatively, useParamSpecPointerRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecPointerProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for string properties.The
See moreParamSpecStringProtocol
protocol exposes the methods and properties of an underlyingGParamSpecString
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecString
. Alternatively, useParamSpecStringRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecStringProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for unsigned character properties.The
See moreParamSpecUCharProtocol
protocol exposes the methods and properties of an underlyingGParamSpecUChar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecUChar
. Alternatively, useParamSpecUCharRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecUCharProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for unsigned integer properties.The
See moreParamSpecUIntProtocol
protocol exposes the methods and properties of an underlyingGParamSpecUInt
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecUInt
. Alternatively, useParamSpecUIntRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecUIntProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for unsigned 64bit integer properties.The
See moreParamSpecUInt64Protocol
protocol exposes the methods and properties of an underlyingGParamSpecUInt64
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecUInt64
. Alternatively, useParamSpecUInt64Ref
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecUInt64Protocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for unsigned long integer properties.The
See moreParamSpecULongProtocol
protocol exposes the methods and properties of an underlyingGParamSpecULong
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecULong
. Alternatively, useParamSpecULongRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecULongProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data for unichar (unsigned integer) properties.The
See moreParamSpecUnicharProtocol
protocol exposes the methods and properties of an underlyingGParamSpecUnichar
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecUnichar
. Alternatively, useParamSpecUnicharRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecUnicharProtocol : ParamSpecProtocol
-
A
GParamSpec
derived structure that contains the meta data forGValueArray
properties.The
See moreParamSpecValueArrayProtocol
protocol exposes the methods and properties of an underlyingGParamSpecValueArray
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecValueArray
. Alternatively, useParamSpecValueArrayRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecValueArrayProtocol : ParamSpecProtocol
-
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 moreParamSpecVariantProtocol
protocol exposes the methods and properties of an underlyingGParamSpecVariant
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeParamSpecVariant
. Alternatively, useParamSpecVariantRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ParamSpecVariantProtocol : ParamSpecProtocol
-
The
GSignalInvocationHint
structure is used to pass on additional information to callbacks during a signal emission.The
See moreSignalInvocationHintProtocol
protocol exposes the methods and properties of an underlyingGSignalInvocationHint
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSignalInvocationHint
. Alternatively, useSignalInvocationHintRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol SignalInvocationHintProtocol
-
A structure holding in-depth information for a specific signal.
See also:
g_signal_query()
The
See moreSignalQueryProtocol
protocol exposes the methods and properties of an underlyingGSignalQuery
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeSignalQuery
. Alternatively, useSignalQueryRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol 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 moreTypePluginProtocol
protocol exposes the methods and properties of an underlyingGTypePlugin
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTypePlugin
. Alternatively, useTypePluginRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TypePluginProtocol
-
An opaque structure used as the base of all classes.
The
See moreTypeClassProtocol
protocol exposes the methods and properties of an underlyingGTypeClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTypeClass
. Alternatively, useTypeClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TypeClassProtocol
-
A structure that provides information to the type system which is used specifically for managing fundamental types.
The
See moreTypeFundamentalInfoProtocol
protocol exposes the methods and properties of an underlyingGTypeFundamentalInfo
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTypeFundamentalInfo
. Alternatively, useTypeFundamentalInfoRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol 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 moreTypeInfoProtocol
protocol exposes the methods and properties of an underlyingGTypeInfo
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTypeInfo
. Alternatively, useTypeInfoRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TypeInfoProtocol
-
An opaque structure used as the base of all type instances.
The
See moreTypeInstanceProtocol
protocol exposes the methods and properties of an underlyingGTypeInstance
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTypeInstance
. Alternatively, useTypeInstanceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TypeInstanceProtocol
-
An opaque structure used as the base of all interface types.
The
See moreTypeInterfaceProtocol
protocol exposes the methods and properties of an underlyingGTypeInterface
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTypeInterface
. Alternatively, useTypeInterfaceRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TypeInterfaceProtocol
-
In order to implement dynamic loading of types based on
GTypeModule
, theload
andunload
functions inGTypeModuleClass
must be implemented.The
See moreTypeModuleClassProtocol
protocol exposes the methods and properties of an underlyingGTypeModuleClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTypeModuleClass
. Alternatively, useTypeModuleClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TypeModuleClassProtocol
-
The
GTypePlugin
interface is used by the type system in order to handle the lifecycle of dynamically loaded types.The
See moreTypePluginClassProtocol
protocol exposes the methods and properties of an underlyingGTypePluginClass
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTypePluginClass
. Alternatively, useTypePluginClassRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TypePluginClassProtocol
-
A structure holding information for a specific type.
See also:
g_type_query()
The
See moreTypeQueryProtocol
protocol exposes the methods and properties of an underlyingGTypeQuery
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTypeQuery
. Alternatively, useTypeQueryRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TypeQueryProtocol
-
The
GTypeValueTable
provides the functions required by theGValue
implementation, to serve as a container for values of a type.The
See moreTypeValueTableProtocol
protocol exposes the methods and properties of an underlyingGTypeValueTable
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTypeValueTable
. Alternatively, useTypeValueTableRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol 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 moreTypeModuleProtocol
protocol exposes the methods and properties of an underlyingGTypeModule
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTypeModule
. Alternatively, useTypeModuleRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TypeModuleProtocol : ObjectProtocol, TypePluginProtocol
-
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 moreValueProtocol
protocol exposes the methods and properties of an underlyingGValue
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeValue
. Alternatively, useValueRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol ValueProtocol
-
A
GValueArray
contains an array ofGValue
elements.The
See moreValueArrayProtocol
protocol exposes the methods and properties of an underlyingGValueArray
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeValueArray
. Alternatively, useValueArrayRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol 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 moreWeakRefProtocol
protocol exposes the methods and properties of an underlyingGWeakRef
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeWeakRef
. Alternatively, useWeakRefRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol WeakRefProtocol
-
The
See moreTypeCValueProtocol
protocol exposes the methods and properties of an underlyingGTypeCValue
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, seeTypeCValue
. Alternatively, useTypeCValueRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol TypeCValueProtocol
-
The
See more_Value__data__unionProtocol
protocol exposes the methods and properties of an underlying_Value__data__union
instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see_Value__data__union
. Alternatively, use_Value__data__unionRef
as a lighweight,unowned
reference if you already have an instance you just want to use.Declaration
Swift
public protocol _Value__data__unionProtocol
-
Protocol for signal name enums
See moreDeclaration
Swift
public protocol SignalNameProtocol : Hashable
-
Protocol for property name enums
See moreDeclaration
Swift
public protocol PropertyNameProtocol : Hashable
-
This protocol is used to constrain generic argument T of GWeak container for weak references. Wrappers with strong references to underlying GObjects must NOT conform to this protocol.
See moreDeclaration
Swift
public protocol GWeakCapturing