Protocols

The following protocols are available globally.

Binding Class

  • GBinding is the representation of a binding between a property on a GObject instance (or source) and another property on another GObject 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 time g_object_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 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 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 g_signal_stop_emission() or g_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 the GBinding 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.26

    The BindingProtocol protocol exposes the methods and properties of an underlying GBinding 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 Binding. Alternatively, use BindingRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol BindingProtocol : ObjectProtocol

CClosure Record

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

    The CClosureProtocol protocol exposes the methods and properties of an underlying GCClosure 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 CClosure. Alternatively, use CClosureRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol CClosureProtocol

Closure Record

  • 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 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 g_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 to g_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 with g_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 ClosureProtocol protocol exposes the methods and properties of an underlying GClosure 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 Closure. Alternatively, use ClosureRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ClosureProtocol

ClosureNotifyData Record

  • The ClosureNotifyDataProtocol protocol exposes the methods and properties of an underlying GClosureNotifyData 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 ClosureNotifyData. Alternatively, use ClosureNotifyDataRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ClosureNotifyDataProtocol

EnumClass Record

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

    The EnumClassProtocol protocol exposes the methods and properties of an underlying GEnumClass 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 EnumClass. Alternatively, use EnumClassRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol EnumClassProtocol

EnumValue Record

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

    The EnumValueProtocol protocol exposes the methods and properties of an underlying GEnumValue 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 EnumValue. Alternatively, use EnumValueRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol EnumValueProtocol

FlagsClass Record

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

    The FlagsClassProtocol protocol exposes the methods and properties of an underlying GFlagsClass 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 FlagsClass. Alternatively, use FlagsClassRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol FlagsClassProtocol

FlagsValue Record

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

    The FlagsValueProtocol protocol exposes the methods and properties of an underlying GFlagsValue 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 FlagsValue. Alternatively, use FlagsValueRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol FlagsValueProtocol

InitiallyUnowned Class

  • 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 InitiallyUnownedProtocol protocol exposes the methods and properties of an underlying GInitiallyUnowned 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 InitiallyUnowned. Alternatively, use InitiallyUnownedRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol InitiallyUnownedProtocol : ObjectProtocol

InitiallyUnownedClass Record

  • The class structure for the GInitiallyUnowned type.

    The InitiallyUnownedClassProtocol protocol exposes the methods and properties of an underlying GInitiallyUnownedClass 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 InitiallyUnownedClass. Alternatively, use InitiallyUnownedClassRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol InitiallyUnownedClassProtocol

InterfaceInfo Record

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

    The InterfaceInfoProtocol protocol exposes the methods and properties of an underlying GInterfaceInfo 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 InterfaceInfo. Alternatively, use InterfaceInfoRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol InterfaceInfoProtocol

ObjectClass Record

  • 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 ObjectClassProtocol protocol exposes the methods and properties of an underlying GObjectClass 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 ObjectClass. Alternatively, use ObjectClassRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ObjectClassProtocol

ObjectConstructParam Record

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

    The ObjectConstructParamProtocol protocol exposes the methods and properties of an underlying GObjectConstructParam 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 ObjectConstructParam. Alternatively, use ObjectConstructParamRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ObjectConstructParamProtocol

Object Class

  • The base object type.

    All the fields in the GObject structure are private to the implementation and should never be accessed directly.

    The ObjectProtocol protocol exposes the methods and properties of an underlying GObject 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 Object. Alternatively, use ObjectRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ObjectProtocol

ParamSpecClass Record

  • The class structure for the GParamSpec type. Normally, GParamSpec classes are filled by g_param_type_register_static().

    The ParamSpecClassProtocol protocol exposes the methods and properties of an underlying GParamSpecClass 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 ParamSpecClass. Alternatively, use ParamSpecClassRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecClassProtocol

ParamSpecPool Record

  • 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.

    The ParamSpecPoolProtocol protocol exposes the methods and properties of an underlying GParamSpecPool 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 ParamSpecPool. Alternatively, use ParamSpecPoolRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecPoolProtocol

ParamSpecTypeInfo Record

  • 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 of g_param_type_register_static().

    The ParamSpecTypeInfoProtocol protocol exposes the methods and properties of an underlying GParamSpecTypeInfo 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 ParamSpecTypeInfo. Alternatively, use ParamSpecTypeInfoRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecTypeInfoProtocol

Parameter Record

  • The GParameter struct is an auxiliary structure used to hand parameter name/value pairs to g_object_newv().

    The ParameterProtocol protocol exposes the methods and properties of an underlying GParameter 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 Parameter. Alternatively, use ParameterRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParameterProtocol

ParamSpec Class

  • 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 (see g_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 ParamSpecProtocol protocol exposes the methods and properties of an underlying GParamSpec 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 ParamSpec. Alternatively, use ParamSpecRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecProtocol

ParamSpecBoolean Class

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

    The ParamSpecBooleanProtocol protocol exposes the methods and properties of an underlying GParamSpecBoolean 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 ParamSpecBoolean. Alternatively, use ParamSpecBooleanRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecBooleanProtocol : ParamSpecProtocol

ParamSpecBoxed Class

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

    The ParamSpecBoxedProtocol protocol exposes the methods and properties of an underlying GParamSpecBoxed 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 ParamSpecBoxed. Alternatively, use ParamSpecBoxedRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecBoxedProtocol : ParamSpecProtocol

ParamSpecChar Class

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

    The ParamSpecCharProtocol protocol exposes the methods and properties of an underlying GParamSpecChar 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 ParamSpecChar. Alternatively, use ParamSpecCharRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecCharProtocol : ParamSpecProtocol

ParamSpecDouble Class

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

    The ParamSpecDoubleProtocol protocol exposes the methods and properties of an underlying GParamSpecDouble 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 ParamSpecDouble. Alternatively, use ParamSpecDoubleRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecDoubleProtocol : ParamSpecProtocol

ParamSpecEnum Class

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

    The ParamSpecEnumProtocol protocol exposes the methods and properties of an underlying GParamSpecEnum 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 ParamSpecEnum. Alternatively, use ParamSpecEnumRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecEnumProtocol : ParamSpecProtocol

ParamSpecFlags Class

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

    The ParamSpecFlagsProtocol protocol exposes the methods and properties of an underlying GParamSpecFlags 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 ParamSpecFlags. Alternatively, use ParamSpecFlagsRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecFlagsProtocol : ParamSpecProtocol

ParamSpecFloat Class

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

    The ParamSpecFloatProtocol protocol exposes the methods and properties of an underlying GParamSpecFloat 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 ParamSpecFloat. Alternatively, use ParamSpecFloatRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecFloatProtocol : ParamSpecProtocol

ParamSpecGType Class

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

    The ParamSpecGTypeProtocol protocol exposes the methods and properties of an underlying GParamSpecGType 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 ParamSpecGType. Alternatively, use ParamSpecGTypeRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecGTypeProtocol : ParamSpecProtocol

ParamSpecInt Class

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

    The ParamSpecIntProtocol protocol exposes the methods and properties of an underlying GParamSpecInt 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 ParamSpecInt. Alternatively, use ParamSpecIntRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecIntProtocol : ParamSpecProtocol

ParamSpecInt64 Class

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

    The ParamSpecInt64Protocol protocol exposes the methods and properties of an underlying GParamSpecInt64 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 ParamSpecInt64. Alternatively, use ParamSpecInt64Ref as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecInt64Protocol : ParamSpecProtocol

ParamSpecLong Class

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

    The ParamSpecLongProtocol protocol exposes the methods and properties of an underlying GParamSpecLong 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 ParamSpecLong. Alternatively, use ParamSpecLongRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecLongProtocol : ParamSpecProtocol

ParamSpecObject Class

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

    The ParamSpecObjectProtocol protocol exposes the methods and properties of an underlying GParamSpecObject 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 ParamSpecObject. Alternatively, use ParamSpecObjectRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecObjectProtocol : ParamSpecProtocol

ParamSpecOverride Class

  • 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 g_param_spec_get_redirect_target() for retrieving the overridden property. GParamSpecOverride is used in implementing g_object_class_override_property(), and will not be directly useful unless you are implementing a new base type similar to GObject.

    The ParamSpecOverrideProtocol protocol exposes the methods and properties of an underlying GParamSpecOverride 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 ParamSpecOverride. Alternatively, use ParamSpecOverrideRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecOverrideProtocol : ParamSpecProtocol

ParamSpecParam Class

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

    The ParamSpecParamProtocol protocol exposes the methods and properties of an underlying GParamSpecParam 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 ParamSpecParam. Alternatively, use ParamSpecParamRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecParamProtocol : ParamSpecProtocol

ParamSpecPointer Class

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

    The ParamSpecPointerProtocol protocol exposes the methods and properties of an underlying GParamSpecPointer 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 ParamSpecPointer. Alternatively, use ParamSpecPointerRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecPointerProtocol : ParamSpecProtocol

ParamSpecString Class

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

    The ParamSpecStringProtocol protocol exposes the methods and properties of an underlying GParamSpecString 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 ParamSpecString. Alternatively, use ParamSpecStringRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecStringProtocol : ParamSpecProtocol

ParamSpecUChar Class

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

    The ParamSpecUCharProtocol protocol exposes the methods and properties of an underlying GParamSpecUChar 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 ParamSpecUChar. Alternatively, use ParamSpecUCharRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecUCharProtocol : ParamSpecProtocol

ParamSpecUInt Class

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

    The ParamSpecUIntProtocol protocol exposes the methods and properties of an underlying GParamSpecUInt 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 ParamSpecUInt. Alternatively, use ParamSpecUIntRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecUIntProtocol : ParamSpecProtocol

ParamSpecUInt64 Class

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

    The ParamSpecUInt64Protocol protocol exposes the methods and properties of an underlying GParamSpecUInt64 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 ParamSpecUInt64. Alternatively, use ParamSpecUInt64Ref as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecUInt64Protocol : ParamSpecProtocol

ParamSpecULong Class

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

    The ParamSpecULongProtocol protocol exposes the methods and properties of an underlying GParamSpecULong 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 ParamSpecULong. Alternatively, use ParamSpecULongRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecULongProtocol : ParamSpecProtocol

ParamSpecUnichar Class

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

    The ParamSpecUnicharProtocol protocol exposes the methods and properties of an underlying GParamSpecUnichar 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 ParamSpecUnichar. Alternatively, use ParamSpecUnicharRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecUnicharProtocol : ParamSpecProtocol

ParamSpecValueArray Class

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

    The ParamSpecValueArrayProtocol protocol exposes the methods and properties of an underlying GParamSpecValueArray 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 ParamSpecValueArray. Alternatively, use ParamSpecValueArrayRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecValueArrayProtocol : ParamSpecProtocol

ParamSpecVariant Class

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

    When comparing values with g_param_values_cmp(), scalar values with the same type will be compared with g_variant_compare(). Other non-nil variants will be checked for equality with g_variant_equal(), and their sort order is otherwise undefined. nil is ordered before non-nil variants. Two nil values compare equal.

    The ParamSpecVariantProtocol protocol exposes the methods and properties of an underlying GParamSpecVariant 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 ParamSpecVariant. Alternatively, use ParamSpecVariantRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ParamSpecVariantProtocol : ParamSpecProtocol

SignalInvocationHint Record

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

    The SignalInvocationHintProtocol protocol exposes the methods and properties of an underlying GSignalInvocationHint 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 SignalInvocationHint. Alternatively, use SignalInvocationHintRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol SignalInvocationHintProtocol

SignalQuery Record

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

    See also: g_signal_query()

    The SignalQueryProtocol protocol exposes the methods and properties of an underlying GSignalQuery 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 SignalQuery. Alternatively, use SignalQueryRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol SignalQueryProtocol

TypePlugin Interface

  • 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:

    (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 the GTypePlugin interface.

    1. The type’s implementation is referenced, e.g. through g_type_class_ref() or through g_type_create_instance() (this is being called by g_object_new()) or through one of the above done on a type derived from new_type_id.

    2. This causes the type system to load the type’s implementation by calling g_type_plugin_use() and g_type_plugin_complete_type_info() on new_type_plugin.

    3. At some point the type’s implementation isn’t required anymore, e.g. after g_type_class_unref() or g_type_free_instance() (called when the reference count of an instance drops to zero).

    4. This causes the type system to throw away the information retrieved from g_type_plugin_complete_type_info() and then it calls g_type_plugin_unuse() on new_type_plugin.

    5. 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 upcoming g_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 call g_type_plugin_use() and g_type_plugin_complete_type_info() again when the type is needed again.

    GTypeModule is an implementation of GTypePlugin that already implements most of this except for the actual module loading and unloading. It even handles multiple registered types per module.

    The TypePluginProtocol protocol exposes the methods and properties of an underlying GTypePlugin 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 TypePlugin. Alternatively, use TypePluginRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol TypePluginProtocol

TypeClass Record

  • An opaque structure used as the base of all classes.

    The TypeClassProtocol protocol exposes the methods and properties of an underlying GTypeClass 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 TypeClass. Alternatively, use TypeClassRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol TypeClassProtocol

TypeFundamentalInfo Record

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

    The TypeFundamentalInfoProtocol protocol exposes the methods and properties of an underlying GTypeFundamentalInfo 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 TypeFundamentalInfo. Alternatively, use TypeFundamentalInfoRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol TypeFundamentalInfoProtocol

TypeInfo Record

  • 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 provided GTypeInfo structure in the g_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 of g_type_register_static().

    The TypeInfoProtocol protocol exposes the methods and properties of an underlying GTypeInfo 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 TypeInfo. Alternatively, use TypeInfoRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol TypeInfoProtocol

TypeInstance Record

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

    The TypeInstanceProtocol protocol exposes the methods and properties of an underlying GTypeInstance 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 TypeInstance. Alternatively, use TypeInstanceRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol TypeInstanceProtocol

TypeInterface Record

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

    The TypeInterfaceProtocol protocol exposes the methods and properties of an underlying GTypeInterface 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 TypeInterface. Alternatively, use TypeInterfaceRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol TypeInterfaceProtocol

TypeModuleClass Record

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

    The TypeModuleClassProtocol protocol exposes the methods and properties of an underlying GTypeModuleClass 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 TypeModuleClass. Alternatively, use TypeModuleClassRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol TypeModuleClassProtocol

TypePluginClass Record

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

    The TypePluginClassProtocol protocol exposes the methods and properties of an underlying GTypePluginClass 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 TypePluginClass. Alternatively, use TypePluginClassRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol TypePluginClassProtocol

TypeQuery Record

  • A structure holding information for a specific type.

    See also: g_type_query()

    The TypeQueryProtocol protocol exposes the methods and properties of an underlying GTypeQuery 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 TypeQuery. Alternatively, use TypeQueryRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol TypeQueryProtocol

TypeValueTable Record

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

    The TypeValueTableProtocol protocol exposes the methods and properties of an underlying GTypeValueTable 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 TypeValueTable. Alternatively, use TypeValueTableRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol TypeValueTableProtocol

TypeModule Class

  • GTypeModule provides a simple implementation of the GTypePlugin 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() and g_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 before g_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() and g_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 from GTypeModule and implement the load and unload functions in GTypeModuleClass.

    The TypeModuleProtocol protocol exposes the methods and properties of an underlying GTypeModule 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 TypeModule. Alternatively, use TypeModuleRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol TypeModuleProtocol : ObjectProtocol, TypePluginProtocol

Value Record

  • 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.

    The ValueProtocol protocol exposes the methods and properties of an underlying GValue 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. Alternatively, use ValueRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ValueProtocol

ValueArray Record

  • A GValueArray contains an array of GValue elements.

    The ValueArrayProtocol protocol exposes the methods and properties of an underlying GValueArray 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 ValueArray. Alternatively, use ValueArrayRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol ValueArrayProtocol

WeakRef Record

  • A structure containing a weak reference to a GObject.

    A GWeakRef can either be empty (i.e. point to nil), 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 nil).

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

    Unlike g_object_weak_ref() and g_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’), any GWeakRefs taken before it was disposed will continue to point to nil. 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.

    The WeakRefProtocol protocol exposes the methods and properties of an underlying GWeakRef 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 WeakRef. Alternatively, use WeakRefRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol WeakRefProtocol

TypeCValue Union

  • The TypeCValueProtocol protocol exposes the methods and properties of an underlying GTypeCValue 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 TypeCValue. Alternatively, use TypeCValueRef as a lighweight, unowned reference if you already have an instance you just want to use.

    See more

    Declaration

    Swift

    public protocol TypeCValueProtocol

Valuedata_union Union