GObject¶
API reference for the GObject namespace (version 2.0), generated from GObject-Introspection.
Classes¶
- Binding —
GObjectinstance (or source) and another property on anotherGObjectinstance (or target). Whenever the source property changes, the… - BindingGroup —
GBindingGroupcan be used to bind multiple properties from an object collectively. Use the various methods to bind properties from a… - CClosure — A CClosure is a specialization of Closure for C function callbacks.
- Closure — A
GClosurerepresents a callback supplied by the programmer. It will generally comprise a function of some kind and a marshaller used to… - ClosureNotifyData
- EnumClass — The class of an enumeration type holds information about its possible values.
- EnumValue — A structure which contains a single enum value, its name, and its nickname.
- FlagsClass — The class of a flags type holds information about its possible values.
- FlagsValue — A structure which contains a single flags value, its name, and its nickname.
- InitiallyUnowned — A type for objects that have an initially floating reference. All the fields in the
GInitiallyUnownedstructure are private to the… - InitiallyUnownedClass — The class structure for the GInitiallyUnowned type.
- InterfaceInfo — A structure that provides information to the type system which is used specifically for managing interface types.
- Object — The base object type.
GObjectis the fundamental type providing the common attributes and methods for all object types in GTK, Pango and… - ObjectClass — The class structure for the GObject type. ``` // Example of implementing a singleton using a constructor. static MySingleton *the_singleton…
- ObjectConstructParam — The GObjectConstructParam struct is an auxiliary structure used to hand ParamSpec/Value pairs to the
constructorof a ObjectClass. - ParamSpec —
GParamSpecencapsulates the metadata required to specify parameters, such asGObjectproperties. #### Parameter names A property name… - ParamSpecBoolean — A ParamSpec derived structure that contains the meta data for boolean properties.
- ParamSpecBoxed — A ParamSpec derived structure that contains the meta data for boxed properties.
- ParamSpecChar — A ParamSpec derived structure that contains the meta data for character properties.
- ParamSpecClass — The class structure for the GParamSpec type. Normally, GParamSpec classes are filled by param_type_register_static.
- ParamSpecDouble — A ParamSpec derived structure that contains the meta data for double properties.
- ParamSpecEnum — A ParamSpec derived structure that contains the meta data for enum properties.
- ParamSpecFlags — A ParamSpec derived structure that contains the meta data for flags properties.
- ParamSpecFloat — A ParamSpec derived structure that contains the meta data for float properties.
- ParamSpecGType — A ParamSpec derived structure that contains the meta data for
GTypeproperties. - ParamSpecInt — A ParamSpec derived structure that contains the meta data for integer properties.
- ParamSpecInt64 — A ParamSpec derived structure that contains the meta data for 64bit integer properties.
- ParamSpecLong — A ParamSpec derived structure that contains the meta data for long integer properties.
- ParamSpecObject — A ParamSpec derived structure that contains the meta data for object properties.
- ParamSpecOverride — A ParamSpec derived structure that redirects operations to other types of ParamSpec. All operations other than getting or setting the value…
- ParamSpecParam — A ParamSpec derived structure that contains the meta data for
G_TYPE_PARAMproperties. - ParamSpecPointer — A ParamSpec derived structure that contains the meta data for pointer properties.
- ParamSpecPool — A ParamSpecPool maintains a collection of
GParamSpecswhich can be quickly accessed by owner and name. The implementation of the Object… - ParamSpecString — A ParamSpec derived structure that contains the meta data for string properties.
- ParamSpecTypeInfo — This structure is used to provide the type system with the information required to initialize and destruct (finalize) a parameter's class…
- ParamSpecUChar — A ParamSpec derived structure that contains the meta data for unsigned character properties.
- ParamSpecUInt — A ParamSpec derived structure that contains the meta data for unsigned integer properties.
- ParamSpecUInt64 — A ParamSpec derived structure that contains the meta data for unsigned 64bit integer properties.
- ParamSpecULong — A ParamSpec derived structure that contains the meta data for unsigned long integer properties.
- ParamSpecUnichar — A ParamSpec derived structure that contains the meta data for unichar (unsigned integer) properties.
- ParamSpecValueArray — A ParamSpec derived structure that contains the meta data for ValueArray properties.
- ParamSpecVariant — A ParamSpec derived structure that contains the meta data for GLib.Variant properties. When comparing values with param_values_cmp, scalar…
- Parameter — The GParameter struct is an auxiliary structure used to hand parameter name/value pairs to Object.newv.
- SignalGroup —
GSignalGroupmanages a collection of signals on aGObject.GSignalGroupsimplifies the process of connecting many signals to a… - SignalInvocationHint — The SignalInvocationHint structure is used to pass on additional information to callbacks during a signal emission.
- SignalQuery — A structure holding in-depth information for a specific signal. See also: signal_query
- TypeCValue — A union holding one collected value.
- TypeClass — An opaque structure used as the base of all classes.
- TypeFundamentalInfo — A structure that provides information to the type system which is used specifically for managing fundamental types.
- TypeInfo — This structure is used to provide the type system with the information required to initialize and destruct (finalize) a type's class and…
- TypeInstance — An opaque structure used as the base of all type instances.
- TypeInterface — An opaque structure used as the base of all interface types.
- TypeModule —
GTypeModuleprovides a simple implementation of theGTypePlugininterface. The model ofGTypeModuleis a dynamically loaded module… - TypeModuleClass — In order to implement dynamic loading of types based on TypeModule, the
loadandunloadfunctions in TypeModuleClass must be… - TypePlugin — An interface that handles the lifecycle of dynamically loaded types. The GObject type system supports dynamic loading of types. It goes as…
- TypePluginClass — The TypePlugin interface is used by the type system in order to handle the lifecycle of dynamically loaded types.
- TypeQuery — A structure holding information for a specific type. See also: type_query
- TypeValueTable — -
'i': Integers, passed ascollect_values[].v_int-'l': Longs, passed ascollect_values[].v_long-'d': Doubles, passed as… - Value — An opaque structure used to hold different types of values. Before it can be used, a
GValuehas to be initialized to a specific type by… - ValueArray — A
GValueArrayis a container structure to hold an array of generic values. The prime purpose of aGValueArrayis for it to be used as… - WeakRef — A structure containing a weak reference to a Object. A
GWeakRefcan either be empty (i.e. point toNone), or point to an object for as… - _Value__data__union
Functions¶
boxed_copy¶
Provide a copy of a boxed structure src_boxed which is of type boxed_type.
Parameters:
boxed_type— The type ofsrc_boxed.src_boxed— The boxed structure to be copied.
boxed_free¶
Free the boxed structure boxed which is of type boxed_type.
Parameters:
boxed_type— The type ofboxed.boxed— The boxed structure to be freed.
boxed_type_register_static¶
def boxed_type_register_static(name: str, boxed_copy: BoxedCopyFunc, boxed_free: BoxedFreeFunc) -> type | Type
This function creates a new G_TYPE_BOXED derived type id for a new
boxed type with name name.
Boxed type handling functions have to be provided to copy and free opaque boxed structures of this type.
For the general case, it is recommended to use G_DEFINE_BOXED_TYPE()
instead of calling boxed_type_register_static directly. The macro
will create the appropriate *_get_type() function for the boxed type.
Parameters:
name— Name of the new boxed type.boxed_copy— Boxed structure copy function.boxed_free— Boxed structure free function.
clear_signal_handler¶
Disconnects a handler from instance so it will not be called during
any future or currently ongoing emissions of the signal it has been
connected to. The handler_id_ptr is then set to zero, which is never a valid handler ID value (see g_signal_connect()).
If the handler ID is 0 then this function does nothing.
There is also a macro version of this function so that the code will be inlined.
Parameters:
handler_id_ptr— A pointer to a handler ID (of type #gulong) of the handler to be disconnected.instance— The instance to remove the signal handler from. This pointer may beNoneor invalid, if the handler ID is zero.
enum_complete_type_info¶
This function is meant to be called from the complete_type_info
function of a TypePlugin implementation, as in the following
example:
static void
my_enum_complete_type_info (GTypePlugin *plugin,
GType g_type,
GTypeInfo *info,
GTypeValueTable *value_table)
{
static const GEnumValue values[] = {
{ MY_ENUM_FOO, "MY_ENUM_FOO", "foo" },
{ MY_ENUM_BAR, "MY_ENUM_BAR", "bar" },
{ 0, NULL, NULL }
};
g_enum_complete_type_info (type, info, values);
}
Parameters:
g_enum_type— the type identifier of the type being completedconst_values— An array ofEnumValuestructs for the possible enumeration values. The array is terminated by a struct with all members being 0.
enum_get_value¶
Returns the EnumValue for a value.
Parameters:
enum_class— aEnumClassvalue— the value to look up
enum_get_value_by_name¶
Looks up a EnumValue by name.
Parameters:
enum_class— aEnumClassname— the name to look up
enum_get_value_by_nick¶
Looks up a EnumValue by nickname.
Parameters:
enum_class— aEnumClassnick— the nickname to look up
enum_register_static¶
Registers a new static enumeration type with the name name.
It is normally more convenient to let [glib-mkenums][glib-mkenums],
generate a my_enum_get_type() function from a usual C enumeration
definition than to write one yourself using enum_register_static.
Parameters:
name— A nul-terminated string used as the name of the new type.const_static_values— An array ofEnumValuestructs for the possible enumeration values. The array is terminated by a struct with all members being 0. GObject keeps a reference to the data, so it cannot be stack-allocated.
enum_to_string¶
Pretty-prints value in the form of the enum’s name.
This is intended to be used for debugging purposes. The format of the output may change in the future.
Parameters:
g_enum_type— the type identifier of aEnumClasstypevalue— the value
flags_complete_type_info¶
This function is meant to be called from the complete_type_info()
function of a TypePlugin implementation, see the example for
enum_complete_type_info above.
Parameters:
g_flags_type— the type identifier of the type being completedconst_values— An array ofFlagsValuestructs for the possible enumeration values. The array is terminated by a struct with all members being 0.
flags_get_first_value¶
Returns the first FlagsValue which is set in value.
Parameters:
flags_class— aFlagsClassvalue— the value
flags_get_value_by_name¶
Looks up a FlagsValue by name.
Parameters:
flags_class— aFlagsClassname— the name to look up
flags_get_value_by_nick¶
Looks up a FlagsValue by nickname.
Parameters:
flags_class— aFlagsClassnick— the nickname to look up
flags_register_static¶
Registers a new static flags type with the name name.
It is normally more convenient to let [glib-mkenums][glib-mkenums]
generate a my_flags_get_type() function from a usual C enumeration
definition than to write one yourself using flags_register_static.
Parameters:
name— A nul-terminated string used as the name of the new type.const_static_values— An array ofFlagsValuestructs for the possible flags values. The array is terminated by a struct with all members being 0. GObject keeps a reference to the data, so it cannot be stack-allocated.
flags_to_string¶
Pretty-prints value in the form of the flag names separated by | and
sorted. Any extra bits will be shown at the end as a hexadecimal number.
This is intended to be used for debugging purposes. The format of the output may change in the future.
Parameters:
flags_type— the type identifier of aFlagsClasstypevalue— the value
gtype_get_type¶
param_spec_boolean¶
def param_spec_boolean(name: str, nick: str | None, blurb: str | None, default_value: bool, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecBoolean instance specifying a G_TYPE_BOOLEAN
property. In many cases, it may be more appropriate to use an enum with
param_spec_enum, both to improve code clarity by using explicitly named
values, and to allow for more values to be added in future without breaking
API.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifieddefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_boxed¶
def param_spec_boxed(name: str, nick: str | None, blurb: str | None, boxed_type: type | Type, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecBoxed instance specifying a G_TYPE_BOXED
derived property.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedboxed_type—G_TYPE_BOXEDderived type of this propertyflags— flags for the property specified
param_spec_char¶
def param_spec_char(name: str, nick: str | None, blurb: str | None, minimum: int, maximum: int, default_value: int, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecChar instance specifying a G_TYPE_CHAR property.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedminimum— minimum value for the property specifiedmaximum— maximum value for the property specifieddefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_double¶
def param_spec_double(name: str, nick: str | None, blurb: str | None, minimum: float, maximum: float, default_value: float, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecDouble instance specifying a G_TYPE_DOUBLE
property.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedminimum— minimum value for the property specifiedmaximum— maximum value for the property specifieddefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_enum¶
def param_spec_enum(name: str, nick: str | None, blurb: str | None, enum_type: type | Type, default_value: int, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecEnum instance specifying a G_TYPE_ENUM
property.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedenum_type— aGTypederived fromG_TYPE_ENUMdefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_flags¶
def param_spec_flags(name: str, nick: str | None, blurb: str | None, flags_type: type | Type, default_value: int, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecFlags instance specifying a G_TYPE_FLAGS
property.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedflags_type— aGTypederived fromG_TYPE_FLAGSdefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_float¶
def param_spec_float(name: str, nick: str | None, blurb: str | None, minimum: float, maximum: float, default_value: float, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecFloat instance specifying a G_TYPE_FLOAT property.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedminimum— minimum value for the property specifiedmaximum— maximum value for the property specifieddefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_gtype¶
def param_spec_gtype(name: str, nick: str | None, blurb: str | None, is_a_type: type | Type, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecGType instance specifying a
G_TYPE_GTYPE property.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedis_a_type— aGTypewhose subtypes are allowed as values of the property (useG_TYPE_NONEfor any type)flags— flags for the property specified
param_spec_int¶
def param_spec_int(name: str, nick: str | None, blurb: str | None, minimum: int, maximum: int, default_value: int, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecInt instance specifying a G_TYPE_INT property.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedminimum— minimum value for the property specifiedmaximum— maximum value for the property specifieddefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_int64¶
def param_spec_int64(name: str, nick: str | None, blurb: str | None, minimum: int, maximum: int, default_value: int, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecInt64 instance specifying a G_TYPE_INT64 property.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedminimum— minimum value for the property specifiedmaximum— maximum value for the property specifieddefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_long¶
def param_spec_long(name: str, nick: str | None, blurb: str | None, minimum: int, maximum: int, default_value: int, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecLong instance specifying a G_TYPE_LONG property.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedminimum— minimum value for the property specifiedmaximum— maximum value for the property specifieddefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_object¶
def param_spec_object(name: str, nick: str | None, blurb: str | None, object_type: type | Type, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecBoxed instance specifying a G_TYPE_OBJECT
derived property.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedobject_type—G_TYPE_OBJECTderived type of this propertyflags— flags for the property specified
param_spec_param¶
def param_spec_param(name: str, nick: str | None, blurb: str | None, param_type: type | Type, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecParam instance specifying a G_TYPE_PARAM
property.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedparam_type— aGTypederived fromG_TYPE_PARAMflags— flags for the property specified
param_spec_pointer¶
def param_spec_pointer(name: str, nick: str | None, blurb: str | None, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecPointer instance specifying a pointer property.
Where possible, it is better to use param_spec_object or
param_spec_boxed to expose memory management information.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedflags— flags for the property specified
param_spec_string¶
def param_spec_string(name: str, nick: str | None, blurb: str | None, default_value: str | None, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecString instance.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifieddefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_uchar¶
def param_spec_uchar(name: str, nick: str | None, blurb: str | None, minimum: int, maximum: int, default_value: int, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecUChar instance specifying a G_TYPE_UCHAR property.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedminimum— minimum value for the property specifiedmaximum— maximum value for the property specifieddefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_uint¶
def param_spec_uint(name: str, nick: str | None, blurb: str | None, minimum: int, maximum: int, default_value: int, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecUInt instance specifying a G_TYPE_UINT property.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedminimum— minimum value for the property specifiedmaximum— maximum value for the property specifieddefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_uint64¶
def param_spec_uint64(name: str, nick: str | None, blurb: str | None, minimum: int, maximum: int, default_value: int, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecUInt64 instance specifying a G_TYPE_UINT64
property.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedminimum— minimum value for the property specifiedmaximum— maximum value for the property specifieddefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_ulong¶
def param_spec_ulong(name: str, nick: str | None, blurb: str | None, minimum: int, maximum: int, default_value: int, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecULong instance specifying a G_TYPE_ULONG
property.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedminimum— minimum value for the property specifiedmaximum— maximum value for the property specifieddefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_unichar¶
def param_spec_unichar(name: str, nick: str | None, blurb: str | None, default_value: str, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecUnichar instance specifying a G_TYPE_UINT
property. Value structures for this property can be accessed with
Value.set_uint and Value.get_uint.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifieddefault_value— default value for the property specifiedflags— flags for the property specified
param_spec_variant¶
def param_spec_variant(name: str, nick: str | None, blurb: str | None, type: GLib.VariantType, default_value: GLib.Variant | None, flags: ParamFlags | int) -> ParamSpec
Creates a new ParamSpecVariant instance specifying a GLib.Variant
property.
If default_value is floating, it is consumed.
See g_param_spec_internal() for details on property names.
Parameters:
name— canonical name of the property specifiednick— nick name for the property specifiedblurb— description of the property specifiedtype— aGLib.VariantTypedefault_value— aGLib.Variantof typetypeto use as the default value, orNoneflags— flags for the property specified
param_type_register_static¶
Registers name as the name of a new static type derived
from G_TYPE_PARAM.
The type system uses the information contained in the ParamSpecTypeInfo
structure pointed to by info to manage the ParamSpec type and its
instances.
Parameters:
name— 0-terminated string used as the name of the newParamSpectype.pspec_info— TheParamSpecTypeInfofor thisParamSpectype.
param_value_convert¶
def param_value_convert(pspec: ParamSpec, src_value: Value, dest_value: Value, strict_validation: bool) -> bool
Transforms src_value into dest_value if possible, and then
validates dest_value, in order for it to conform to pspec. If
strict_validation is True this function will only succeed if the
transformed dest_value complied to pspec without modifications.
See also Value.type_transformable, Value.transform and
param_value_validate.
Parameters:
pspec— a validParamSpecsrc_value— sourceValuedest_value— destinationValueof correct type forpspecstrict_validation—Truerequiresdest_valueto conform topspecwithout modifications
param_value_defaults¶
Checks whether value contains the default value as specified in pspec.
Parameters:
param_value_is_valid¶
Return whether the contents of value comply with the specifications
set out by pspec.
Parameters:
param_value_set_default¶
Sets value to its default value as specified in pspec.
Parameters:
pspec— a validParamSpecvalue— aValueof correct type forpspec; since 2.64, you can also pass an emptyValue, initialized withG_VALUE_INIT
param_value_validate¶
Ensures that the contents of value comply with the specifications
set out by pspec. For example, a ParamSpecInt might require
that integers stored in value may not be smaller than -42 and not be
greater than +42. If value contains an integer outside of this range,
it is modified accordingly, so the resulting value will fit into the
range -42 .. +42.
Parameters:
param_values_cmp¶
Compares value1 with value2 according to pspec, and return -1, 0 or +1,
if value1 is found to be less than, equal to or greater than value2,
respectively.
Parameters:
pspec— a validParamSpecvalue1— aValueof correct type forpspecvalue2— aValueof correct type forpspec
pointer_type_register_static¶
Creates a new G_TYPE_POINTER derived type id for a new
pointer type with name name.
Parameters:
name— the name of the new pointer type.
signal_accumulator_first_wins¶
def signal_accumulator_first_wins(ihint: SignalInvocationHint, return_accu: Value, handler_return: Value, dummy: int | None = ...) -> bool
A predefined GSignalAccumulator for signals intended to be used as a
hook for application code to provide a particular value. Usually
only one such value is desired and multiple handlers for the same
signal don't make much sense (except for the case of the default
handler defined in the class structure, in which case you will
usually want the signal connection to override the class handler).
This accumulator will use the return value from the first signal handler that is run as the return value for the signal and not run any further handlers (ie: the first handler "wins").
Parameters:
ihint— standardGSignalAccumulatorparameterreturn_accu— standardGSignalAccumulatorparameterhandler_return— standardGSignalAccumulatorparameterdummy— standardGSignalAccumulatorparameter
signal_accumulator_true_handled¶
def signal_accumulator_true_handled(ihint: SignalInvocationHint, return_accu: Value, handler_return: Value, dummy: int | None = ...) -> bool
A predefined GSignalAccumulator for signals that return a
boolean values. The behavior that this accumulator gives is
that a return of True stops the signal emission: no further
callbacks will be invoked, while a return of False allows
the emission to continue. The idea here is that a True return
indicates that the callback handled the signal, and no further
handling is needed.
Parameters:
ihint— standardGSignalAccumulatorparameterreturn_accu— standardGSignalAccumulatorparameterhandler_return— standardGSignalAccumulatorparameterdummy— standardGSignalAccumulatorparameter
signal_add_emission_hook¶
def signal_add_emission_hook(signal_id: int, detail: GLib.Quark, hook_func: SignalEmissionHook) -> int
Adds an emission hook for a signal, which will get called for any emission
of that signal, independent of the instance. This is possible only
for signals which don't have SignalFlags.NO_HOOKS flag set.
Parameters:
signal_id— the signal identifier, as returned bysignal_lookup.detail— the detail on which to call the hook.hook_func— aGSignalEmissionHookfunction.
signal_chain_from_overridden¶
Calls the original class closure of a signal. This function should only
be called from an overridden class closure; see
signal_override_class_closure and
signal_override_class_handler.
Parameters:
instance_and_params— the argument list of the signal emission. The first element in the array is aValuefor the instance the signal is being emitted on. The rest are any arguments to be passed to the signal.return_value— Location for the return value.
signal_connect_closure¶
def signal_connect_closure(instance: Object, detailed_signal: str, closure: Closure, after: bool) -> int
Connects a closure to a signal for a particular object.
If closure is a floating reference (see Closure.sink), this function
takes ownership of closure.
This function cannot fail. If the given signal name doesn’t exist,
a critical warning is emitted. No validation is performed on the
‘detail’ string when specified in detailed_signal, other than a
non-empty check.
Refer to the signals documentation for more details.
Parameters:
instance— the instance to connect to.detailed_signal— a string of the form "signal-name::detail".closure— the closure to connect.after— whether the handler should be called before or after the default handler of the signal.
signal_connect_closure_by_id¶
def signal_connect_closure_by_id(instance: Object, signal_id: int, detail: GLib.Quark, closure: Closure, after: bool) -> int
Connects a closure to a signal for a particular object.
If closure is a floating reference (see Closure.sink), this function
takes ownership of closure.
This function cannot fail. If the given signal name doesn’t exist,
a critical warning is emitted. No validation is performed on the
‘detail’ string when specified in detailed_signal, other than a
non-empty check.
Refer to the signals documentation for more details.
Parameters:
instance— the instance to connect to.signal_id— the id of the signal.detail— the detail.closure— the closure to connect.after— whether the handler should be called before or after the default handler of the signal.
signal_emitv¶
def signal_emitv(instance_and_params: list[Value], signal_id: int, detail: GLib.Quark, return_value: Value) -> Value
Emits a signal. Signal emission is done synchronously. The method will only return control after all handlers are called or signal emission was stopped.
Note that signal_emitv doesn't change return_value if no handlers are
connected, in contrast to g_signal_emit() and g_signal_emit_valist().
Parameters:
instance_and_params— argument list for the signal emission. The first element in the array is aValuefor the instance the signal is being emitted on. The rest are any arguments to be passed to the signal.signal_id— the signal iddetail— the detailreturn_value— Location to store the return value of the signal emission. This must be provided if the specified signal returns a value, but may be ignored otherwise.
signal_get_invocation_hint¶
Returns the invocation hint of the innermost signal emission of instance.
Parameters:
instance— the instance to query
signal_handler_block¶
Blocks a handler of an instance so it will not be called during any signal emissions unless it is unblocked again. Thus "blocking" a signal handler means to temporarily deactivate it, a signal handler has to be unblocked exactly the same amount of times it has been blocked before to become active again.
The handler_id has to be a valid signal handler id, connected to a
signal of instance.
Parameters:
instance— The instance to block the signal handler of.handler_id— Handler id of the handler to be blocked.
signal_handler_disconnect¶
Disconnects a handler from an instance so it will not be called during
any future or currently ongoing emissions of the signal it has been
connected to. The handler_id becomes invalid and may be reused.
The handler_id has to be a valid signal handler id, connected to a
signal of instance.
Parameters:
instance— The instance to remove the signal handler from.handler_id— Handler id of the handler to be disconnected.
signal_handler_find¶
def signal_handler_find(instance: Object, mask: SignalMatchType | int, signal_id: int, detail: GLib.Quark, closure: Closure | None = ..., func: int | None = ..., data: int | None = ...) -> int
Finds the first signal handler that matches certain selection criteria.
The criteria mask is passed as an OR-ed combination of SignalMatchType
flags, and the criteria values are passed as arguments.
The match mask has to be non-0 for successful matches.
If no handler was found, 0 is returned.
Parameters:
instance— The instance owning the signal handler to be found.mask— Mask indicating which ofsignal_id,detail,closure,funcand/ordatathe handler has to match.signal_id— Signal the handler has to be connected to.detail— Signal detail the handler has to be connected to.closure— The closure the handler will invoke.func— The C closure callback of the handler (useless for non-C closures).data— The closure data of the handler's closure.
signal_handler_is_connected¶
Returns whether handler_id is the ID of a handler connected to instance.
Parameters:
instance— The instance where a signal handler is sought.handler_id— the handler ID.
signal_handler_unblock¶
Undoes the effect of a previous signal_handler_block call. A
blocked handler is skipped during signal emissions and will not be
invoked, unblocking it (for exactly the amount of times it has been
blocked before) reverts its "blocked" state, so the handler will be
recognized by the signal system and is called upon future or
currently ongoing signal emissions (since the order in which
handlers are called during signal emissions is deterministic,
whether the unblocked handler in question is called as part of a
currently ongoing emission depends on how far that emission has
proceeded yet).
The handler_id has to be a valid id of a signal handler that is
connected to a signal of instance and is currently blocked.
Parameters:
instance— The instance to unblock the signal handler of.handler_id— Handler id of the handler to be unblocked.
signal_handlers_block_matched¶
def signal_handlers_block_matched(instance: Object, mask: SignalMatchType | int, signal_id: int, detail: GLib.Quark, closure: Closure | None = ..., func: int | None = ..., data: int | None = ...) -> int
Blocks all handlers on an instance that match a certain selection criteria.
The criteria mask is passed as a combination of SignalMatchType flags, and
the criteria values are passed as arguments. A handler must match on all
flags set in mask to be blocked (i.e. the match is conjunctive).
Passing at least one of the SignalMatchType.ID, SignalMatchType.CLOSURE,
SignalMatchType.FUNC
or SignalMatchType.DATA match flags is required for successful matches.
If no handlers were found, 0 is returned, the number of blocked handlers
otherwise.
Support for SignalMatchType.ID was added in GLib 2.78.
Parameters:
instance— The instance to block handlers from.mask— Mask indicating which ofsignal_id,detail,closure,funcand/ordatathe handlers have to match.signal_id— Signal the handlers have to be connected to.detail— Signal detail the handlers have to be connected to.closure— The closure the handlers will invoke.func— The C closure callback of the handlers (useless for non-C closures).data— The closure data of the handlers' closures.
signal_handlers_destroy¶
Destroy all signal handlers of a type instance. This function is
an implementation detail of the Object dispose implementation,
and should not be used outside of the type system.
Parameters:
instance— The instance whose signal handlers are destroyed
signal_handlers_disconnect_matched¶
def signal_handlers_disconnect_matched(instance: Object, mask: SignalMatchType | int, signal_id: int, detail: GLib.Quark, closure: Closure | None = ..., func: int | None = ..., data: int | None = ...) -> int
Disconnects all handlers on an instance that match a certain selection criteria.
The criteria mask is passed as a combination of SignalMatchType flags, and
the criteria values are passed as arguments. A handler must match on all
flags set in mask to be disconnected (i.e. the match is conjunctive).
Passing at least one of the SignalMatchType.ID, SignalMatchType.CLOSURE,
SignalMatchType.FUNC or
SignalMatchType.DATA match flags is required for successful
matches. If no handlers were found, 0 is returned, the number of
disconnected handlers otherwise.
Support for SignalMatchType.ID was added in GLib 2.78.
Parameters:
instance— The instance to remove handlers from.mask— Mask indicating which ofsignal_id,detail,closure,funcand/ordatathe handlers have to match.signal_id— Signal the handlers have to be connected to.detail— Signal detail the handlers have to be connected to.closure— The closure the handlers will invoke.func— The C closure callback of the handlers (useless for non-C closures).data— The closure data of the handlers' closures.
signal_handlers_unblock_matched¶
def signal_handlers_unblock_matched(instance: Object, mask: SignalMatchType | int, signal_id: int, detail: GLib.Quark, closure: Closure | None = ..., func: int | None = ..., data: int | None = ...) -> int
Unblocks all handlers on an instance that match a certain selection criteria.
The criteria mask is passed as a combination of SignalMatchType flags, and
the criteria values are passed as arguments. A handler must match on all
flags set in mask to be unblocked (i.e. the match is conjunctive).
Passing at least one of the SignalMatchType.ID, SignalMatchType.CLOSURE,
SignalMatchType.FUNC
or SignalMatchType.DATA match flags is required for successful matches.
If no handlers were found, 0 is returned, the number of unblocked handlers
otherwise. The match criteria should not apply to any handlers that are
not currently blocked.
Support for SignalMatchType.ID was added in GLib 2.78.
Parameters:
instance— The instance to unblock handlers from.mask— Mask indicating which ofsignal_id,detail,closure,funcand/ordatathe handlers have to match.signal_id— Signal the handlers have to be connected to.detail— Signal detail the handlers have to be connected to.closure— The closure the handlers will invoke.func— The C closure callback of the handlers (useless for non-C closures).data— The closure data of the handlers' closures.
signal_has_handler_pending¶
def signal_has_handler_pending(instance: Object, signal_id: int, detail: GLib.Quark, may_be_blocked: bool) -> bool
Returns whether there are any handlers connected to instance for the
given signal id and detail.
If detail is 0 then it will only match handlers that were connected
without detail. If detail is non-zero then it will match handlers
connected both without detail and with the given detail. This is
consistent with how a signal emitted with detail would be delivered
to those handlers.
Since 2.46 this also checks for a non-default class closure being installed, as this is basically always what you want.
One example of when you might use this is when the arguments to the signal are difficult to compute. A class implementor may opt to not emit the signal if no one is attached anyway, thus saving the cost of building the arguments.
Parameters:
instance— the object whose signal handlers are sought.signal_id— the signal id.detail— the detail.may_be_blocked— whether blocked handlers should count as match.
signal_is_valid_name¶
Validate a signal name. This can be useful for dynamically-generated signals which need to be validated at run-time before actually trying to create them.
See GObject.signal_new for details of the rules for valid names.
The rules for signal names are the same as those for property names.
Parameters:
name— the canonical name of the signal
signal_list_ids¶
Lists the signals by id that a certain instance or interface type
created. Further information about the signals can be acquired through
signal_query.
Parameters:
itype— Instance or interface type.
signal_lookup¶
Given the name of the signal and the type of object it connects to, gets the signal's identifying integer. Emitting the signal by number is somewhat faster than using the name each time.
Also tries the ancestors of the given type.
The type class passed as itype must already have been instantiated (for
example, using TypeClass.ref) for this function to work, as signals are
always installed during class initialization.
See g_signal_new() for details on allowed signal names.
Parameters:
name— the signal's name.itype— the type that the signal operates on.
signal_name¶
Given the signal's identifier, finds its name.
Two different signals may have the same name, if they have differing types.
Parameters:
signal_id— the signal's identifying number.
signal_override_class_closure¶
def signal_override_class_closure(signal_id: int, instance_type: type | Type, class_closure: Closure) -> None
Overrides the class closure (i.e. the default handler) for the given signal
for emissions on instances of instance_type. instance_type must be derived
from the type to which the signal belongs.
See signal_chain_from_overridden and
g_signal_chain_from_overridden_handler() for how to chain up to the
parent class closure from inside the overridden one.
Parameters:
signal_id— the signal idinstance_type— the instance type on which to override the class closure for the signal.class_closure— the closure.
signal_override_class_handler¶
def signal_override_class_handler(signal_name: str, instance_type: type | Type, class_handler: Callback) -> None
Overrides the class closure (i.e. the default handler) for the
given signal for emissions on instances of instance_type with
callback class_handler. instance_type must be derived from the
type to which the signal belongs.
See signal_chain_from_overridden and
g_signal_chain_from_overridden_handler() for how to chain up to the
parent class closure from inside the overridden one.
Parameters:
signal_name— the name for the signalinstance_type— the instance type on which to override the class handler for the signal.class_handler— the handler.
signal_parse_name¶
def signal_parse_name(detailed_signal: str, itype: type | Type, force_detail_quark: bool) -> tuple[bool, int, GLib.Quark]
Internal function to parse a signal name into its signal_id
and detail quark.
Parameters:
detailed_signal— a string of the form "signal-name::detail".itype— The interface/instance type that introduced "signal-name".force_detail_quark—Trueforces creation of aGQuarkfor the detail.
signal_query¶
Queries the signal system for in-depth information about a
specific signal. This function will fill in a user-provided
structure to hold signal-specific information. If an invalid
signal id is passed in, the signal_id member of the SignalQuery
is 0. All members filled into the SignalQuery structure should
be considered constant and have to be left untouched.
Parameters:
signal_id— The signal id of the signal to query information for.
signal_remove_emission_hook¶
Deletes an emission hook.
Parameters:
signal_id— the id of the signalhook_id— the id of the emission hook, as returned bysignal_add_emission_hook
signal_stop_emission¶
Stops a signal's current emission.
This will prevent the default method from running, if the signal was
SignalFlags.RUN_LAST and you connected normally (i.e. without the "after"
flag).
Prints a warning if used on a signal which isn't being emitted.
Parameters:
instance— the object whose signal handlers you wish to stop.signal_id— the signal identifier, as returned bysignal_lookup.detail— the detail which the signal was emitted with.
signal_stop_emission_by_name¶
Stops a signal's current emission.
This is just like signal_stop_emission except it will look up the
signal id for you.
Parameters:
instance— the object whose signal handlers you wish to stop.detailed_signal— a string of the form "signal-name::detail".
signal_type_cclosure_new¶
Creates a new closure which invokes the function found at the offset
struct_offset in the class structure of the interface or classed type
identified by itype.
Parameters:
itype— theGTypeidentifier of an interface or classed typestruct_offset— the offset of the member function ofitype's class structure which is to be invoked by the new closure
strdup_value_contents¶
Return a newly allocated string, which describes the contents of a
Value. The main purpose of this function is to describe Value
contents for debugging output, the way in which the contents are
described may change between different GLib versions.
Parameters:
value—Valuewhich contents are to be described.
type_add_class_private¶
Registers a private class structure for a classed type; when the class is allocated, the private structures for the class and all of its parent types are allocated sequentially in the same memory block as the public structures, and are zero-filled.
This function should be called in the type's get_type() function after the type is registered. The private structure can be retrieved using the G_TYPE_CLASS_GET_PRIVATE() macro.
Parameters:
class_type— GType of a classed typeprivate_size— size of private structure
type_add_instance_private¶
type_add_interface_dynamic¶
def type_add_interface_dynamic(instance_type: type | Type, interface_type: type | Type, plugin: TypePlugin) -> None
Adds interface_type to the dynamic instance_type. The information
contained in the TypePlugin structure pointed to by plugin
is used to manage the relationship.
Parameters:
instance_type—GTypevalue of an instantiatable typeinterface_type—GTypevalue of an interface typeplugin—TypePluginstructure to retrieve theInterfaceInfofrom
type_add_interface_static¶
def type_add_interface_static(instance_type: type | Type, interface_type: type | Type, info: InterfaceInfo) -> None
Adds interface_type to the static instance_type.
The information contained in the InterfaceInfo structure
pointed to by info is used to manage the relationship.
Parameters:
instance_type—GTypevalue of an instantiatable typeinterface_type—GTypevalue of an interface typeinfo—InterfaceInfostructure for this (instance_type,interface_type) combination
type_check_class_is_a¶
type_check_instance¶
Private helper function to aid implementation of the G_TYPE_CHECK_INSTANCE() macro.
Parameters:
instance— a validTypeInstancestructure
type_check_instance_is_a¶
type_check_instance_is_fundamentally_a¶
def type_check_instance_is_fundamentally_a(instance: TypeInstance, fundamental_type: type | Type) -> bool
type_check_is_value_type¶
type_check_value¶
type_check_value_holds¶
type_children¶
Return a newly allocated and 0-terminated array of type IDs, listing
the child types of type.
Parameters:
type— the parent type
type_default_interface_get¶
Returns the default interface vtable for the given g_type.
If the type is not currently in use, then the default vtable
for the type will be created and initialized by calling
the base interface init and default vtable init functions for
the type (the base_init and class_init members of TypeInfo).
If you don't want to create the interface vtable, you should use
type_default_interface_peek instead.
Calling type_default_interface_get is useful when you
want to make sure that signals and properties for an interface
have been installed.
Parameters:
g_type— an interface type
type_default_interface_peek¶
If the interface type g_type is currently in use, returns its
default interface vtable.
Parameters:
g_type— an interface type
type_default_interface_ref¶
:::warning Deprecated since 2.84 This API is deprecated. :::
Increments the reference count for the interface type g_type,
and returns the default interface vtable for the type.
If the type is not currently in use, then the default vtable
for the type will be created and initialized by calling
the base interface init and default vtable init functions for
the type (the base_init and class_init members of TypeInfo).
Calling type_default_interface_ref is useful when you
want to make sure that signals and properties for an interface
have been installed.
Parameters:
g_type— an interface type
type_default_interface_unref¶
:::warning Deprecated since 2.84 This API is deprecated. :::
Decrements the reference count for the type corresponding to the
interface default vtable g_iface.
If the type is dynamic, then when no one is using the interface and all
references have been released, the finalize function for the interface's
default vtable (the class_finalize member of TypeInfo) will be called.
Parameters:
g_iface— the default vtable structure for an interface, as returned bytype_default_interface_ref
type_depth¶
Returns the length of the ancestry of the passed in type. This includes the type itself, so that e.g. a fundamental type has depth 1.
Parameters:
type— aGType
type_ensure¶
Ensures that the indicated type has been registered with the
type system, and its _class_init() method has been run.
In theory, simply calling the type's _get_type() method (or using
the corresponding macro) is supposed take care of this. However,
_get_type() methods are often marked G_GNUC_CONST for performance
reasons, even though this is technically incorrect (since
G_GNUC_CONST requires that the function not have side effects,
which _get_type() methods do on the first call). As a result, if
you write a bare call to a _get_type() macro, it may get optimized
out by the compiler. Using type_ensure guarantees that the
type's _get_type() method is called.
Parameters:
type— aGType
type_free_instance¶
Frees an instance of a type, returning it to the instance pool for the type, if there is one.
Like g_type_create_instance(), this function is reserved for implementors of fundamental types.
Parameters:
instance— an instance of a type
type_from_name¶
Look up the type ID from a given type name, returning 0 if no type has been registered under this name (this is the preferred method to find out by name whether a specific type has been registered yet).
Parameters:
name— type name to look up
type_fundamental¶
Internal function, used to extract the fundamental type ID portion. Use G_TYPE_FUNDAMENTAL() instead.
Parameters:
type_id— valid type ID
type_fundamental_next¶
Returns the next free fundamental type id which can be used to
register a new fundamental type with type_register_fundamental.
The returned type ID represents the highest currently registered
fundamental type identifier.
type_get_instance_count¶
Returns the number of instances allocated of the particular type;
this is only available if GLib is built with debugging support and
the instance-count debug flag is set (by setting the GOBJECT_DEBUG
variable to include instance-count).
Parameters:
type— aGType
type_get_plugin¶
Returns the TypePlugin structure for type.
Parameters:
type—GTypeto retrieve the plugin for
type_get_qdata¶
Obtains data which has previously been attached to type
with type_set_qdata.
Note that this does not take subtyping into account; data
attached to one type with type_set_qdata cannot
be retrieved from a subtype using type_get_qdata.
Parameters:
type— aGTypequark— aGQuarkid to identify the data
type_get_type_registration_serial¶
Returns an opaque serial number that represents the state of the set
of registered types. Any time a type is registered this serial changes,
which means you can cache information based on type lookups (such as
type_from_name) and know if the cache is still valid at a later
time by comparing the current serial with the one at the type lookup.
type_init¶
:::warning Deprecated since 2.36 This API is deprecated. :::
This function used to initialise the type system. Since GLib 2.36, the type system is initialised automatically and this function does nothing.
type_init_with_debug_flags¶
:::warning Deprecated since 2.36 This API is deprecated. :::
This function used to initialise the type system with debugging flags. Since GLib 2.36, the type system is initialised automatically and this function does nothing.
If you need to enable debugging features, use the GOBJECT_DEBUG
environment variable.
Parameters:
debug_flags— bitwise combination ofTypeDebugFlagsvalues for debugging purposes
type_interfaces¶
Return a newly allocated and 0-terminated array of type IDs, listing
the interface types that type conforms to.
Parameters:
type— the type to list interface types for
type_is_a¶
If is_a_type is a derivable type, check whether type is a
descendant of is_a_type. If is_a_type is an interface, check
whether type conforms to it.
Parameters:
type— type to check ancestry foris_a_type— possible ancestor oftypeor interface thattypecould conform to
type_name¶
Get the unique name that is assigned to a type ID.
Note that this function (like all other GType API) cannot cope with
invalid type IDs. G_TYPE_INVALID may be passed to this function, as
may be any other validly registered type ID, but randomized type IDs
should not be passed in and will most likely lead to a crash.
Parameters:
type— type to return name for
type_name_from_class¶
type_name_from_instance¶
type_next_base¶
Given a leaf_type and a root_type which is contained in its
ancestry, return the type that root_type is the immediate parent
of. In other words, this function determines the type that is
derived directly from root_type which is also a base class of
leaf_type. Given a root type and a leaf type, this function can
be used to determine the types and order in which the leaf type is
descended from the root type.
Parameters:
leaf_type— descendant ofroot_typeand the type to be returnedroot_type— immediate parent of the returned type
type_parent¶
Return the direct parent type of the passed in type. If the passed in type has no parent, i.e. is a fundamental type, 0 is returned.
Parameters:
type— the derived type
type_qname¶
Get the corresponding quark of the type IDs name.
Parameters:
type— type to return quark of type name for
type_query¶
Queries the type system for information about a specific type.
This function will fill in a user-provided structure to hold
type-specific information. If an invalid GType is passed in, the
type member of the TypeQuery is 0. All members filled into the
TypeQuery structure should be considered constant and have to be
left untouched.
Since GLib 2.78, this function allows queries on dynamic types. Previously it only supported static types.
Parameters:
type—GTypeof a static, classed type
type_register_dynamic¶
def type_register_dynamic(parent_type: type | Type, type_name: str, plugin: TypePlugin, flags: TypeFlags | int) -> type | Type
Registers type_name as the name of a new dynamic type derived from
parent_type. The type system uses the information contained in the
TypePlugin structure pointed to by plugin to manage the type and its
instances (if not abstract). The value of flags determines the nature
(e.g. abstract or not) of the type.
Parameters:
parent_type— type from which this type will be derivedtype_name— 0-terminated string used as the name of the new typeplugin—TypePluginstructure to retrieve theTypeInfofromflags— bitwise combination ofTypeFlagsvalues
type_register_fundamental¶
def type_register_fundamental(type_id: type | Type, type_name: str, info: TypeInfo, finfo: TypeFundamentalInfo, flags: TypeFlags | int) -> type | Type
Registers type_id as the predefined identifier and type_name as the
name of a fundamental type. If type_id is already registered, or a
type named type_name is already registered, the behaviour is undefined.
The type system uses the information contained in the TypeInfo structure
pointed to by info and the TypeFundamentalInfo structure pointed to by
finfo to manage the type and its instances. The value of flags determines
additional characteristics of the fundamental type.
Parameters:
type_id— a predefined type identifiertype_name— 0-terminated string used as the name of the new typeinfo—TypeInfostructure for this typefinfo—TypeFundamentalInfostructure for this typeflags— bitwise combination ofTypeFlagsvalues
type_register_static¶
def type_register_static(parent_type: type | Type, type_name: str, info: TypeInfo, flags: TypeFlags | int) -> type | Type
Registers type_name as the name of a new static type derived from
parent_type. The type system uses the information contained in the
TypeInfo structure pointed to by info to manage the type and its
instances (if not abstract). The value of flags determines the nature
(e.g. abstract or not) of the type.
Parameters:
parent_type— type from which this type will be derivedtype_name— 0-terminated string used as the name of the new typeinfo—TypeInfostructure for this typeflags— bitwise combination ofTypeFlagsvalues
type_set_qdata¶
Attaches arbitrary data to a type.
Parameters:
type— aGTypequark— aGQuarkid to identify the datadata— the data
type_test_flags¶
variant_get_gtype¶
Enumerations¶
BindingFlags¶
Bit flags.
DEFAULT=0— The default binding; if the source property changes, the target property is updated with its value.BIDIRECTIONAL=1— Bidirectional binding; if either the property of the source or the property of the target changes, the other is updated.SYNC_CREATE=2— Synchronize the values of the source and target properties when creating the binding; the direction of the synchronization is always from the source to the target.INVERT_BOOLEAN=4— If the two properties being bound are booleans, setting one toTruewill result in the other being set toFalseand vice versa. This flag will only work for boolean properties, and cannot be used when passing custom transformation functions toObject.bind_property_full.
ConnectFlags¶
Bit flags.
DEFAULT=0— Default behaviour (no special flags). Since: 2.74AFTER=1— If set, the handler should be called after the default handler of the signal. Normally, the handler is called before the default handler.SWAPPED=2— If set, the instance and data should be swapped when calling the handler; see g_signal_connect_swapped() for an example.
IOCondition¶
Bit flags.
IN=1OUT=4PRI=2ERR=8HUP=16NVAL=32
ParamFlags¶
Bit flags.
READABLE=1— the parameter is readableWRITABLE=2— the parameter is writableREADWRITE=3— alias forParamFlags.READABLE|ParamFlags.WRITABLECONSTRUCT=4— the parameter will be set upon object construction. SeeObject.constructedfor more detailsCONSTRUCT_ONLY=8— the parameter can only be set upon object construction. SeeObject.constructedfor more detailsLAX_VALIDATION=16— upon parameter conversion (seeparam_value_convert) strict validation is not requiredSTATIC_NAME=32— the string used as name when constructing the parameter is guaranteed to remain valid and unmodified for the lifetime of the parameter. Since 2.8PRIVATE=32— internalSTATIC_NICK=64— the string used as nick when constructing the parameter is guaranteed to remain valid and unmmodified for the lifetime of the parameter. Since 2.8STATIC_BLURB=128— the string used as blurb when constructing the parameter is guaranteed to remain valid and unmodified for the lifetime of the parameter. Since 2.8EXPLICIT_NOTIFY=1073741824— calls toObject.set_propertyfor this property will not automatically result in a "notify" signal being emitted: the implementation must callObject.notifythemselves in case the property actually changes. Since: 2.42.DEPRECATED=2147483648— the parameter is deprecated and will be removed in a future version. A warning will be generated if it is used while running with G_ENABLE_DIAGNOSTIC=1. Since 2.26
SignalFlags¶
Bit flags.
RUN_FIRST=1— Invoke the object method handler in the first emission stage.RUN_LAST=2— Invoke the object method handler in the third emission stage.RUN_CLEANUP=4— Invoke the object method handler in the last emission stage.NO_RECURSE=8— Signals being emitted for an object while currently being in emission for this very object will not be emitted recursively, but instead cause the first emission to be restarted.DETAILED=16— This signal supports "::detail" appendices to the signal name upon handler connections and emissions.ACTION=32— Action signals are signals that may freely be emitted on alive objects from user code via g_signal_emit() and friends, without the need of being embedded into extra code that performs pre or post emission adjustments on the object. They can also be thought of as object methods which can be called generically by third-party code.NO_HOOKS=64— No emissions hooks are supported for this signal.MUST_COLLECT=128— Varargs signal emission will always collect the arguments, even if there are no signal handlers connected.DEPRECATED=256— The signal is deprecated and will be removed in a future version. A warning will be generated if it is connected while running withG_ENABLE_DIAGNOSTIC=1.ACCUMULATOR_FIRST_RUN=131072— The signal accumulator was invoked for the first time. This flag is only used inSignalAccumulator[accumulator functions] for therun_typefield of theSignalInvocationHint, to mark the first call to the accumulator function for a signal emission.
SignalMatchType¶
Bit flags.
ID=1— The signal id must be equal.DETAIL=2— The signal detail must be equal.CLOSURE=4— The closure must be the same.FUNC=8— The C closure callback must be the same.DATA=16— The closure data must be the same.UNBLOCKED=32— Only unblocked signals may be matched.
TypeDebugFlags¶
Bit flags.
NONE=0— Print no messagesOBJECTS=1— Print messages about object bookkeepingSIGNALS=2— Print messages about signal emissionsINSTANCE_COUNT=4— Keep a count of instances of each typeMASK=7— Mask covering all debug flags
TypeFlags¶
Bit flags.
NONE=0— No special flags. Since: 2.74ABSTRACT=16— Indicates an abstract type. No instances can be created for an abstract typeVALUE_ABSTRACT=32— Indicates an abstract value type, i.e. a type that introduces a value table, but can't be used forValue.initFINAL=64— Indicates a final type. A final type is a non-derivable leaf node in a deep derivable type hierarchy tree. Since: 2.70DEPRECATED=128— The type is deprecated and may be removed in a future version. A warning will be emitted if it is instantiated while running withG_ENABLE_DIAGNOSTIC=1. Since 2.76
TypeFundamentalFlags¶
Bit flags.
CLASSED=1— Indicates a classed typeINSTANTIATABLE=2— Indicates an instantiatable type (implies classed)DERIVABLE=4— Indicates a flat derivable typeDEEP_DERIVABLE=8— Indicates a deep derivable type (implies derivable)
Constants¶
PARAM_MASK¶
Mask containing the bits of ParamSpec.flags which are reserved for GLib.
PARAM_STATIC_STRINGS¶
ParamSpecFlags value alias for ParamFlags.STATIC_NAME | ParamFlags.STATIC_NICK | ParamFlags.STATIC_BLURB.
It is recommended to use this for all properties by default, as it allows for internal performance improvements in GObject.
It is very rare that a property would have a dynamically constructed name, nickname or blurb.
Since 2.13.0
PARAM_USER_SHIFT¶
Minimum shift count to be used for user defined flags, to be stored in
ParamSpec.flags. The maximum allowed is 10.
SIGNAL_FLAGS_MASK¶
A mask for all SignalFlags bits.
SIGNAL_MATCH_MASK¶
A mask for all SignalMatchType bits.
TYPE_FLAG_RESERVED_ID_BIT¶
A bit in the type number that's supposed to be left untouched.
TYPE_FUNDAMENTAL_MAX¶
An integer constant that represents the number of identifiers reserved for types that are assigned at compile-time.
TYPE_FUNDAMENTAL_SHIFT¶
Shift value used in converting numbers to type IDs.
TYPE_RESERVED_BSE_FIRST¶
First fundamental type number to create a new fundamental type id with G_TYPE_MAKE_FUNDAMENTAL() reserved for BSE.
TYPE_RESERVED_BSE_LAST¶
Last fundamental type number reserved for BSE.
TYPE_RESERVED_GLIB_FIRST¶
First fundamental type number to create a new fundamental type id with G_TYPE_MAKE_FUNDAMENTAL() reserved for GLib.
TYPE_RESERVED_GLIB_LAST¶
Last fundamental type number reserved for GLib.
TYPE_RESERVED_USER_FIRST¶
First available fundamental type number to create new fundamental type id with G_TYPE_MAKE_FUNDAMENTAL().
VALUE_COLLECT_FORMAT_MAX_LENGTH¶
The maximal number of GTypeCValues which can be collected for a
single Value.
VALUE_INTERNED_STRING¶
Flag to indicate that a string in a Value is canonical and
will exist for the duration of the process.
See Value.set_interned_string.
This flag should be checked by implementations of
TypeValueFreeFunc, TypeValueCollectFunc
and TypeValueLCopyFunc.
VALUE_NOCOPY_CONTENTS¶
Flag to indicate that allocated data in a Value shouldn’t be
copied.
If passed to GObject.VALUE_COLLECT, allocated data won’t be copied
but used verbatim. This does not affect ref-counted types like objects.
This does not affect usage of Value.copy: the data will
be copied if it is not ref-counted.
This flag should be checked by implementations of
TypeValueFreeFunc, TypeValueCollectFunc
and TypeValueLCopyFunc.
Callbacks¶
BaseFinalizeFunc¶
BaseInitFunc¶
BindingTransformFunc¶
BoxedCopyFunc¶
BoxedFreeFunc¶
Callback¶
ClassFinalizeFunc¶
ClassInitFunc¶
ClosureMarshal¶
ClosureMarshal = Callable[[closure: Closure, return_value: Value | None, param_values: list[Value]], None]
ClosureNotify¶
InstanceInitFunc¶
InterfaceFinalizeFunc¶
InterfaceInitFunc¶
ObjectFinalizeFunc¶
ObjectGetPropertyFunc¶
ObjectGetPropertyFunc = Callable[[object: Object, property_id: int, value: Value, pspec: ParamSpec], None]
ObjectSetPropertyFunc¶
ObjectSetPropertyFunc = Callable[[object: Object, property_id: int, value: Value, pspec: ParamSpec], None]
SignalAccumulator¶
SignalAccumulator = Callable[[ihint: SignalInvocationHint, return_accu: Value, handler_return: Value], bool]
SignalEmissionHook¶
ToggleNotify¶
TypeClassCacheFunc¶
TypeInterfaceCheckFunc¶
TypePluginCompleteInterfaceInfo¶
TypePluginCompleteInterfaceInfo = Callable[[plugin: TypePlugin, instance_type: type | Type, interface_type: type | Type, info: InterfaceInfo], None]
TypePluginCompleteTypeInfo¶
TypePluginCompleteTypeInfo = Callable[[plugin: TypePlugin, g_type: type | Type, info: TypeInfo, value_table: TypeValueTable], None]
TypePluginUnuse¶
TypePluginUse¶
TypeValueCollectFunc¶
TypeValueCollectFunc = Callable[[value: Value, collect_values: list[TypeCValue], collect_flags: int], str]
TypeValueCopyFunc¶
TypeValueFreeFunc¶
TypeValueInitFunc¶
TypeValueLCopyFunc¶
TypeValueLCopyFunc = Callable[[value: Value, collect_values: list[TypeCValue], collect_flags: int], str]