GObject Reference
The GObject library contains GLib's type system, including the GObject type, subclasses of which can include properties and signals.
Properties
Properties of GObject are mapped onto Julia properties.
Gtk4.GLib.set_gtk_property! — Functionset_gtk_property!(w::GObject, name, ::Type{T}, value)Set a GObject property name (which can be a string or symbol) to value converted to type T.
set_gtk_property!(w::GObject, name, value)Set a GObject property name (which can be a string or symbol) to value. The type of value will be converted to match the property type, if possible.
GObject properties are mapped onto Julia instance properties, so note that this function is equivalent to the more convenient syntax w.name = value.
See also get_gtk_property.
Gtk4.GLib.get_gtk_property — Functionget_gtk_property(w::GObject, name::AbstractString, ::Type{T})Get a GObject property's value as type T.
get_gtk_property(w::GObject, name::AbstractString)Get a GObject property's value. The type of the returned value depends on the property, so this function's output is type unstable.
GObject properties are mapped onto Julia instance properties, so this function is equivalent to the syntax w.name.
See also set_gtk_property!.
Gtk4.GLib.bind_property — Functionbind_property(source::GObject, source_property, target::GObject, target_property, flags = BindingFlags_DEFAULT)Creates a binding between source_property on source and target_property on target. When source_property is changed, target_property will be updated to the same value. Returns a GBinding object that can be used to release the binding using unbind_property.
See also unbind_property.
Related GTK function: g_object_bind_property
Gtk4.GLib.unbind_property — Functionunbind_property(b::GBinding)Releases a binding created by bind_property.
See also bind_property.
Related GTK function: g_binding_unbind
Gtk4.GLib.setproperties! — Functionsetproperties!(obj::GObject; kwargs...)Set many GObject properties at once using keyword arguments. For example for a GtkWindow, setproperties!(win; title="New title", visible=true).
These are functions that are intended to be used in the REPL to look up information about GObjects and their properties and signals.
Gtk4.GLib.propertyinfo — Functionpropertyinfo(w::GObject, name)Prints information about a property of the GObject w, including a brief description, its type, its default value, and its current value.
Gtk4.GLib.gtk_propertynames — Functiongtk_propertynames(w::GObject)Get a list of property names for the GObject w.
Signals
Gtk4.GLib.signal_handler_is_connected — Functionsignal_handler_is_connected(widget, id) -> BoolReturn true/false depending on whether widget has a connected signal handler with the given id.
Gtk4.GLib.signal_handler_disconnect — Functionsignal_handler_disconnect(w::GObject, id)Disconnect a signal handler from a widget w by its id.
Gtk4.GLib.signal_handler_block — Functionsignal_handler_block(w::GObject, id)Temporarily block a signal handler from running on a GObject instance.
See also signal_handler_unblock.
Gtk4.GLib.signal_handler_unblock — Functionsignal_handler_block(w::GObject, id)Unblock a signal handler that had been previously blocked.
See also signal_handler_block.
Gtk4.GLib.signal_emit — Functionsignal_emit(w::GObject, sig::AbstractStringLike, ::Type{RT}, args...) where RTCause an object signal to be emitted. The return type RT and the correct number of arguments (of the correct type) must be provided. The argument list should exclude the user_data argument.
Gtk4.GLib.waitforsignal — Functionwaitforsignal(obj::GObject, signal)Returns when a GObject's signal is emitted. Can be used to wait for a window to be closed. This function should only be used for signals that return nothing, with one exception: the "close-request" signal of GtkWindow.
Gtk4.GLib.on_notify — Functionon_notify(f, object::GObject, property, user_data = object, after = false)Connect a callback f to the object's "notify::property" signal that will be called whenever the property changes. The callback signature should be f(::Ptr, param::Ptr{GParamSpec}, user_data) and the function should return nothing.
Gtk4.GLib.signalnames — Functionsignalnames(::Type{T}) where T <: GObjectReturns a list of the names of supported signals for T.
Gtk4.GLib.signal_return_type — Functionsignal_return_type(::Type{T}, name::Symbol) where T <: GObjectGets the return type for the callback for the signal name of a GObject type (for example GtkWidget).
Gtk4.GLib.signal_argument_types — Functionsignal_argument_types(::Type{T}, name::Symbol) where T <: GObjectGets the argument types for the callback for the signal name of a GObject type (for example GtkWidget).
GObject type system
These functions are not typically needed by most users.
Gtk4.GLib.g_type — Functiong_type(x)Get the GType corresponding to a Julia type or object. See GLib documentation for more information.
Gtk4.GLib.find_leaf_type — Functionfind_leaf_type(hnd::Ptr{T}) where T <: GObjectFor a pointer to a GObject, look up its type in the GType system and return the Julia leaf type that best matches it. For types supported by Gtk4, for example GtkWindow, this will be the leaf type GtkWindowLeaf. Some types defined in GTK4 and other libraries are not exported. In this case, the nearest parent type supported by the Julia package will be returned. For example, objects in GIO that implement the GFile interface are returned as GObjectLeaf.