This is the signature of marshaller functions, required to marshall
arrays of parameter values to signal emissions into C language callback
invocations. It is merely an alias to #GClosureMarshal since the #GClosure
mechanism takes over responsibility of actual function invocation for the
signal system.
A C representable type name for #G_TYPE_STRV.
A numerical value which represents the unique identifier of a registered
type.
A callback function used by the type system to finalize those portions
of a derived types class structure that were setup from the corresponding
GBaseInitFunc() function. Class finalization basically works the inverse
way in which class intialization is performed.
See GClassInitFunc() for a discussion of the class intialization process.
The #GTypeClass structure to finalize.
A callback function used by the type system to do base initialization
of the class structures of derived types. It is called as part of the
initialization process of all derived classes and should reallocate
or reset all dynamic class members copied over from the parent class.
For example, class members (such as strings) that are not sufficiently
handled by a plain memory copy of the parent class into the derived class
have to be altered. See GClassInitFunc() for a discussion of the class
intialization process.
The #GTypeClass structure to initialize.
<structname>GBinding</structname> is an opaque structure whose members
cannot be accessed directly.
Retrieves the flags passed when constructing the #GBinding
the #GBindingFlags used by the #GBinding
Retrieves the #GObject instance used as the source of the binding
the source #GObject
Retrieves the name of the property of #GBinding:source used as the source
of the binding
the name of the source property
Retrieves the #GObject instance used as the target of the binding
the target #GObject
Retrieves the name of the property of #GBinding:target used as the target
of the binding
the name of the target property
Flags to be used to control the #GBinding
The #GObject that should be used as the source of the binding
The name of the property of #GBinding:source that should be used
as the source of the binding
The #GObject that should be used as the target of the binding
The name of the property of #GBinding:target that should be used
as the target of the binding
Flags to be passed to g_object_bind_property() or
g_object_bind_property_full().
This enumeration can be extended at later date.
A function to be called to transform the source property of @source
from @source_value into the target property of @target
using @target_value.
otherwise
%TRUE if the transformation was successful, and %FALSE
a #GBinding
the value of the source property
the value of the target property
data passed to the transform function
This function is provided by the user and should produce a copy of the passed
in boxed structure.
The newly created copy of the boxed structure.
The boxed structure to be copied.
This function is provided by the user and should free the boxed
structure passed.
The boxed structure to be freed.
A #GCClosure is a specialization of #GClosure for C function callbacks.
The type used for callback functions in structure definitions and function
signatures. This doesn't mean that all callback functions must take no
parameters and return void. The required signature of a callback function
is determined by the context in which is used (e.g. the signal to which it
is connected). Use G_CALLBACK() to cast the callback function to a #GCallback.
A callback function used by the type system to finalize a class.
This function is rarely needed, as dynamically allocated class resources
should be handled by GBaseInitFunc() and GBaseFinalizeFunc().
Also, specification of a GClassFinalizeFunc() in the #GTypeInfo
structure of a static type is invalid, because classes of static types
will never be finalized (they are artificially kept alive when their
reference count drops to zero).
The #GTypeClass structure to finalize.
The @class_data member supplied via the #GTypeInfo structure.
A callback function used by the type system to initialize the class
of a specific type. This function should initialize all static class
members.
The initialization process of a class involves:
<itemizedlist>
<listitem><para>
1 - Copying common members from the parent class over to the
derived class structure.
</para></listitem>
<listitem><para>
2 - Zero initialization of the remaining members not copied
over from the parent class.
</para></listitem>
<listitem><para>
3 - Invocation of the GBaseInitFunc() initializers of all parent
types and the class' type.
</para></listitem>
<listitem><para>
4 - Invocation of the class' GClassInitFunc() initializer.
</para></listitem>
</itemizedlist>
Since derived classes are partially initialized through a memory copy
of the parent class, the general rule is that GBaseInitFunc() and
GBaseFinalizeFunc() should take care of necessary reinitialization
and release of those class members that were introduced by the type
that specified these GBaseInitFunc()/GBaseFinalizeFunc().
GClassInitFunc() should only care about initializing static
class members, while dynamic class members (such as allocated strings
or reference counted resources) are better handled by a GBaseInitFunc()
for this type, so proper initialization of the dynamic class members
is performed for class initialization of derived types as well.
An example may help to correspond the intend of the different class
initializers:
|[
typedef struct {
GObjectClass parent_class;
gint static_integer;
gchar *dynamic_string;
} TypeAClass;
static void
type_a_base_class_init (TypeAClass *class)
{
class->dynamic_string = g_strdup ("some string");
}
static void
type_a_base_class_finalize (TypeAClass *class)
{
g_free (class->dynamic_string);
}
static void
type_a_class_init (TypeAClass *class)
{
class->static_integer = 42;
}
typedef struct {
TypeAClass parent_class;
gfloat static_float;
GString *dynamic_gstring;
} TypeBClass;
static void
type_b_base_class_init (TypeBClass *class)
{
class->dynamic_gstring = g_string_new ("some other string");
}
static void
type_b_base_class_finalize (TypeBClass *class)
{
g_string_free (class->dynamic_gstring);
}
static void
type_b_class_init (TypeBClass *class)
{
class->static_float = 3.14159265358979323846;
}
]|
Initialization of TypeBClass will first cause initialization of
TypeAClass (derived classes reference their parent classes, see
g_type_class_ref() on this).
Initialization of TypeAClass roughly involves zero-initializing its fields,
then calling its GBaseInitFunc() type_a_base_class_init() to allocate
its dynamic members (dynamic_string), and finally calling its GClassInitFunc()
type_a_class_init() to initialize its static members (static_integer).
The first step in the initialization process of TypeBClass is then
a plain memory copy of the contents of TypeAClass into TypeBClass and
zero-initialization of the remaining fields in TypeBClass.
The dynamic members of TypeAClass within TypeBClass now need
reinitialization which is performed by calling type_a_base_class_init()
with an argument of TypeBClass.
After that, the GBaseInitFunc() of TypeBClass, type_b_base_class_init()
is called to allocate the dynamic members of TypeBClass (dynamic_gstring),
and finally the GClassInitFunc() of TypeBClass, type_b_class_init(),
is called to complete the initialization process with the static members
(static_float).
Corresponding finalization counter parts to the GBaseInitFunc() functions
have to be provided to release allocated resources at class finalization
time.
The #GTypeClass structure to initialize.
The @class_data member supplied via the #GTypeInfo structure.
A #GClosure represents a callback supplied by the programmer.
A variant of g_closure_new_simple() which stores @object in the
when implementing new types of closures.
a newly allocated #GClosure
the size of the structure to allocate, must be at least <literal>sizeof (GClosure)</literal>
a #GObject pointer to store in the @data field of the newly allocated #GClosure
Allocates a struct of the given size and initializes the initial
part as a #GClosure. This function is mainly useful when
implementing new types of closures.
|[
typedef struct _MyClosure MyClosure;
struct _MyClosure
{
GClosure closure;
// extra data goes here
};
static void
my_closure_finalize (gpointer notify_data,
GClosure *closure)
{
MyClosure *my_closure = (MyClosure *)closure;
// free extra data here
}
MyClosure *my_closure_new (gpointer data)
{
GClosure *closure;
MyClosure *my_closure;
closure = g_closure_new_simple (sizeof (MyClosure), data);
my_closure = (MyClosure *) closure;
// initialize extra data here
g_closure_add_finalize_notifier (closure, notify_data,
my_closure_finalize);
return my_closure;
}
]|
a newly allocated #GClosure
the size of the structure to allocate, must be at least <literal>sizeof (GClosure)</literal>
data to store in the @data field of the newly allocated #GClosure
Registers a finalization notifier which will be called when the
reference count of @closure goes down to 0. Multiple finalization
notifiers on a single closure are invoked in unspecified order. If
a single call to g_closure_unref() results in the closure being
both invalidated and finalized, then the invalidate notifiers will
be run before the finalize notifiers.
data to pass to @notify_func
the callback function to register
Registers an invalidation notifier which will be called when the
notifiers are invoked before finalization notifiers, in an
unspecified order.
data to pass to @notify_func
the callback function to register
Adds a pair of notifiers which get invoked before and after the
closure callback, respectively. This is typically used to protect
the extra arguments for the duration of the callback. See
g_object_watch_closure() for an example of marshal guards.
data to pass to @pre_marshal_notify
a function to call before the closure callback
data to pass to @post_marshal_notify
a function to call after the closure callback
Sets a flag on the closure to indicate that its calling
environment has become invalid, and thus causes any future
invocations of g_closure_invoke() on this @closure to be
ignored. Also, invalidation notifiers installed on the closure will
be called at this point. Note that unless you are holding a
reference to the closure yourself, the invalidation notifiers may
unref the closure and cause it to be destroyed, so if you need to
access the closure after calling g_closure_invalidate(), make sure
that you've previously called g_closure_ref().
Note that g_closure_invalidate() will also be called when the
reference count of a closure drops to zero (unless it has already
been invalidated before).
Invokes the closure, i.e. executes the callback represented by the @closure.
a #GValue to store the return value. May be %NULL if the callback of @closure doesn't return a value.
the length of the @param_values array
an array of #GValue<!-- -->s holding the arguments on which to invoke the callback of @closure
a context-dependent invocation hint
Increments the reference count on a closure to force it staying
alive while the caller holds a pointer to it.
The @closure passed in, for convenience
Removes a finalization notifier.
Notice that notifiers are automatically removed after they are run.
data which was passed to g_closure_add_finalize_notifier() when registering @notify_func
the callback function to remove
Removes an invalidation notifier.
Notice that notifiers are automatically removed after they are run.
data which was passed to g_closure_add_invalidate_notifier() when registering @notify_func
the callback function to remove
Sets the marshaller of @closure. The <literal>marshal_data</literal>
of @marshal provides a way for a meta marshaller to provide additional
information to the marshaller. (See g_closure_set_meta_marshal().) For
GObject's C predefined marshallers (the g_cclosure_marshal_*()
functions), what it provides is a callback function to use instead of
a #GClosureMarshal function
Sets the meta marshaller of @closure. A meta marshaller wraps
fashion. The most common use of this facility is for C callbacks.
The same marshallers (generated by <link
linkend="glib-genmarshal">glib-genmarshal</link>) are used
everywhere, but the way that we get the callback function
differs. In most cases we want to use @closure->callback, but in
other cases we want to use some different technique to retrieve the
callback function.
For example, class closures for signals (see
g_signal_type_cclosure_new()) retrieve the callback function from a
fixed offset in the class structure. The meta marshaller retrieves
the right callback and passes it to the marshaller as the
context-dependent data to pass to @meta_marshal
a #GClosureMarshal function
Takes over the initial ownership of a closure. Each closure is
initially created in a <firstterm>floating</firstterm> state, which
means that the initial reference count is not owned by any caller.
g_closure_sink() checks to see if the object is still floating, and
if so, unsets the floating state and decreases the reference
count. If the closure is not floating, g_closure_sink() does
nothing. The reason for the existance of the floating state is to
prevent cumbersome code sequences like:
|[
closure = g_cclosure_new (cb_func, cb_data);
g_source_set_closure (source, closure);
g_closure_unref (closure); // XXX GObject doesn't really need this
]|
Because g_source_set_closure() (and similar functions) take ownership of the
initial reference count, if it is unowned, we instead can write:
|[
g_source_set_closure (source, g_cclosure_new (cb_func, cb_data));
]|
Generally, this function is used together with g_closure_ref(). Ane example
of storing a closure for later notification looks like:
|[
static GClosure *notify_closure = NULL;
void
foo_notify_set_closure (GClosure *closure)
{
if (notify_closure)
g_closure_unref (notify_closure);
notify_closure = closure;
if (notify_closure)
{
g_closure_ref (notify_closure);
g_closure_sink (notify_closure);
}
}
]|
Because g_closure_sink() may decrement the reference count of a closure
(if it hasn't been called on @closure yet) just like g_closure_unref(),
g_closure_ref() should be called prior to this function.
Decrements the reference count of a closure after it was previously
incremented by the same caller. If no other callers are using the
closure, then the closure will be destroyed and freed.
The type used for marshaller functions.
the #GClosure to which the marshaller belongs
a #GValue to store the return value. May be %NULL if the callback of @closure doesn't return a value.
the length of the @param_values array
an array of #GValue<!-- -->s holding the arguments on which to invoke the callback of @closure
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller, see g_closure_set_marshal() and g_closure_set_meta_marshal()
The type used for the various notification callbacks which can be registered
on closures.
data specified when registering the notification callback
the #GClosure on which the notification is emitted
The connection flags are used to specify the behaviour of a signal's
connection.
The class of an enumeration type holds information about its
possible values.
A structure which contains a single enum value, its name, and its
nickname.
The class of a flags type holds information about its
possible values.
A structure which contains a single flags value, its name, and its
nickname.
All the fields in the <structname>GInitiallyUnowned</structname> structure
are private to the #GInitiallyUnowned implementation and should never be
accessed directly.
Creates a binding between @source_property on @source and @target_property
on @target. Whenever the @source_property is changed the @target_property is
updated using the same value. For instance:
|[
g_object_bind_property (action, "active", widget, "sensitive", 0);
]|
Will result in the "sensitive" property of the widget #GObject instance to be
updated with the same value of the "active" property of the action #GObject
instance.
If @flags contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
if @target_property on @target changes then the @source_property on @source
will be updated as well.
The binding will automatically be removed when either the @source or the
#GBinding instance.
A #GObject can have multiple bindings.
binding between the two #GObject instances. The binding is released
whenever the #GBinding reference count reaches zero.
the #GBinding instance representing the
the source #GObject
the property on @source to bind
the target #GObject
the property on @target to bind
flags to pass to #GBinding
Complete version of g_object_bind_property().
Creates a binding between @source_property on @source and @target_property
on @target, allowing you to set the transformation functions to be used by
the binding.
If @flags contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
if @target_property on @target changes then the @source_property on @source
will be updated as well. The @transform_from function is only used in case
of bidirectional bindings, otherwise it will be ignored
The binding will automatically be removed when either the @source or the
#GBinding instance.
A #GObject can have multiple bindings.
<note>The same @user_data parameter will be used for both @transform_to
and @transform_from transformation functions; the @notify function will
be called once, when the binding is removed. If you need different data
for each transformation function, please use
g_object_bind_property_with_closures() instead.</note>
binding between the two #GObject instances. The binding is released
whenever the #GBinding reference count reaches zero.
the #GBinding instance representing the
the source #GObject
the property on @source to bind
the target #GObject
the property on @target to bind
flags to pass to #GBinding
the transformation function from the @source to the @target, or %NULL to use the default
the transformation function from the @target to the @source, or %NULL to use the default
custom data to be passed to the transformation functions, or %NULL
function to be called when disposing the binding, to free the resources used by the transformation functions
Creates a binding between @source_property on @source and @target_property
on @target, allowing you to set the transformation functions to be used by
the binding.
This function is the language bindings friendly version of
g_object_bind_property_full(), using #GClosure<!-- -->s instead of
function pointers.
binding between the two #GObject instances. The binding is released
whenever the #GBinding reference count reaches zero.
the #GBinding instance representing the
the source #GObject
the property on @source to bind
the target #GObject
the property on @target to bind
flags to pass to #GBinding
a #GClosure wrapping the transformation function from the @source to the @target, or %NULL to use the default
a #GClosure wrapping the transformation function from the @target to the @source, or %NULL to use the default
A convenience function to connect multiple signals at once.
The signal specs expected by this function have the form
"modifier::signal_name", where modifier can be one of the following:
<variablelist>
<varlistentry>
<term>signal</term>
<listitem><para>
equivalent to <literal>g_signal_connect_data (..., NULL, 0)</literal>
</para></listitem>
</varlistentry>
<varlistentry>
<term>object_signal</term>
<term>object-signal</term>
<listitem><para>
equivalent to <literal>g_signal_connect_object (..., 0)</literal>
</para></listitem>
</varlistentry>
<varlistentry>
<term>swapped_signal</term>
<term>swapped-signal</term>
<listitem><para>
equivalent to <literal>g_signal_connect_data (..., NULL, G_CONNECT_SWAPPED)</literal>
</para></listitem>
</varlistentry>
<varlistentry>
<term>swapped_object_signal</term>
<term>swapped-object-signal</term>
<listitem><para>
equivalent to <literal>g_signal_connect_object (..., G_CONNECT_SWAPPED)</literal>
</para></listitem>
</varlistentry>
<varlistentry>
<term>signal_after</term>
<term>signal-after</term>
<listitem><para>
equivalent to <literal>g_signal_connect_data (..., NULL, G_CONNECT_AFTER)</literal>
</para></listitem>
</varlistentry>
<varlistentry>
<term>object_signal_after</term>
<term>object-signal-after</term>
<listitem><para>
equivalent to <literal>g_signal_connect_object (..., G_CONNECT_AFTER)</literal>
</para></listitem>
</varlistentry>
<varlistentry>
<term>swapped_signal_after</term>
<term>swapped-signal-after</term>
<listitem><para>
equivalent to <literal>g_signal_connect_data (..., NULL, G_CONNECT_SWAPPED | G_CONNECT_AFTER)</literal>
</para></listitem>
</varlistentry>
<varlistentry>
<term>swapped_object_signal_after</term>
<term>swapped-object-signal-after</term>
<listitem><para>
equivalent to <literal>g_signal_connect_object (..., G_CONNECT_SWAPPED | G_CONNECT_AFTER)</literal>
</para></listitem>
</varlistentry>
</variablelist>
|[
menu->toplevel = g_object_connect (g_object_new (GTK_TYPE_WINDOW,
"type", GTK_WINDOW_POPUP,
"child", menu,
NULL),
"signal::event", gtk_menu_window_event, menu,
"signal::size_request", gtk_menu_window_size_request, menu,
"signal::destroy", gtk_widget_destroyed, &menu->toplevel,
NULL);
]|
@object
a #GObject
the spec for the first signal
A convenience function to disconnect multiple signals at once.
The signal specs expected by this function have the form
"any_signal", which means to disconnect any signal with matching
callback and data, or "any_signal::signal_name", which only
disconnects the signal named "signal_name".
a #GObject
the spec for the first signal
Gets properties of an object.
In general, a copy is made of the property contents and the caller
is responsible for freeing the memory in the appropriate manner for
the type, for instance by calling g_free() or g_object_unref().
<example>
<title>Using g_object_get(<!-- -->)</title>
An example of using g_object_get() to get the contents
of three properties - one of type #G_TYPE_INT,
one of type #G_TYPE_STRING, and one of type #G_TYPE_OBJECT:
<programlisting>
gint intval;
gchar *strval;
GObject *objval;
g_object_get (my_object,
"int-property", &intval,
"str-property", &strval,
"obj-property", &objval,
NULL);
// Do something with intval, strval, objval
g_free (strval);
g_object_unref (objval);
</programlisting>
</example>
a #GObject
name of the first property to get
Find the #GParamSpec with the given name for an
interface. Generally, the interface vtable passed in as @g_iface
will be the default vtable from g_type_default_interface_ref(), or,
if you know the interface has already been loaded,
g_type_default_interface_peek().
name @property_name, or %NULL if no such property exists.
the #GParamSpec for the property of the interface with the
any interface vtable for the interface, or the default vtable for the interface
name of a property to lookup.
Add a property to an interface; this is only useful for interfaces
that are added to GObject-derived types. Adding a property to an
interface forces all objects classes with that interface to have a
compatible property. The compatible property could be a newly
created #GParamSpec, but normally
g_object_class_override_property() will be used so that the object
class only needs to provide an implementation and inherits the
property description, default value, bounds, and so forth from the
interface property.
This function is meant to be called from the interface's default
vtable initialization function (the @class_init member of
#GTypeInfo.) It must not be called after after @class_init has
been called for any object types implementing this interface.
any interface vtable for the interface, or the default vtable for the interface.
the #GParamSpec for the new property
Lists the properties of an interface.Generally, the interface
vtable passed in as @g_iface will be the default vtable from
g_type_default_interface_ref(), or, if you know the interface has
already been loaded, g_type_default_interface_peek().
structures. The paramspecs are owned by GLib, but the
array should be freed with g_free() when you are done with
it.
a pointer to an array of pointers to #GParamSpec
any interface vtable for the interface, or the default vtable for the interface
location to store number of properties returned.
Checks wether @object has a <link linkend="floating-ref">floating</link>
reference.
%TRUE if @object has a floating reference
a #GObject
Creates a new instance of a #GObject subtype and sets its properties.
Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY)
which are not explicitly specified are set to their default values.
a new instance of @object_type
the type id of the #GObject subtype to instantiate
the name of the first property
Creates a new instance of a #GObject subtype and sets its properties.
Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY)
which are not explicitly specified are set to their default values.
a new instance of @object_type
the type id of the #GObject subtype to instantiate
the name of the first property
the value of the first property, followed optionally by more name/value pairs, followed by %NULL
Creates a new instance of a #GObject subtype and sets its properties.
Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY)
which are not explicitly specified are set to their default values.
a new instance of @object_type
the type id of the #GObject subtype to instantiate
the length of the @parameters array
an array of #GParameter
Increases the reference count of @object.
the same @object
a #GObject
Increase the reference count of @object, and possibly remove the
<link linkend="floating-ref">floating</link> reference, if @object
has a floating reference.
In other words, if the object is floating, then this call "assumes
ownership" of the floating reference, converting it to a normal
reference by clearing the floating flag while leaving the reference
count unchanged. If the object is not floating, then this call
adds a new normal reference increasing the reference count by one.
@object
a #GObject
Sets properties on an object.
a #GObject
name of the first property to set
Decreases the reference count of @object. When its reference count
drops to 0, the object is finalized (i.e. its memory is freed).
a #GObject
The class structure for the <structname>GInitiallyUnowned</structname> type.
A callback function used by the type system to initialize a new
instance of a type. This function initializes all instance members and
allocates any resources required by it.
Initialization of a derived instance involves calling all its parent
types instance initializers, so the class member of the instance
is altered during its initialization to always point to the class that
belongs to the type the current initializer was introduced for.
The instance to initialize.
The class of the type the instance is created for.
A callback function used by the type system to finalize an interface.
This function should destroy any internal data and release any resources
allocated by the corresponding GInterfaceInitFunc() function.
The interface structure to finalize.
The @interface_data supplied via the #GInterfaceInfo structure.
A structure that provides information to the type system which is
used specifically for managing interface types.
A callback function used by the type system to initialize a new
interface. This function should initialize all internal data and
allocate any resources required by the interface.
The interface structure to initialize.
The @interface_data supplied via the #GInterfaceInfo structure.
All the fields in the <structname>GObject</structname> structure are private
to the #GObject implementation and should never be accessed directly.
Emits a "notify" signal for the property @property_name on @object.
When possible, eg. when signaling a property change from within the class
that registered the property, you should use g_object_notify_by_pspec()
instead.
Increases the reference count of the object by one and sets a
callback to be called when all other references to the object are
dropped, or when this is already the last reference to the object
and another reference is established.
This functionality is intended for binding @object to a proxy
object managed by another memory manager. This is done with two
g_object_add_toggle_ref() and a reverse reference to the proxy
object which is either a strong reference or weak reference.
The setup is that when there are no other references to @object,
only a weak reference is held in the reverse direction from @object
to the proxy object, but when there are other references held to
when the reference from @object to the proxy object should be
<firstterm>toggled</firstterm> from strong to weak (@is_last_ref
true) or weak to strong (@is_last_ref false).
Since a (normal) reference must be held to the object before
calling g_object_toggle_ref(), the initial state of the reverse
link is always strong.
Multiple toggle references may be added to the same gobject,
however if there are multiple toggle references to an object, none
of them will ever be notified until all but one are removed. For
this reason, you should only ever use a toggle reference if there
is important state in the proxy object.
a function to call when this reference is the last reference to the object, or is no longer the last reference.
data to pass to @notify
Adds a weak reference from weak_pointer to @object to indicate that
the pointer located at @weak_pointer_location is only valid during
the lifetime of @object. When the @object is finalized,
The memory address of a pointer.
This function is intended for #GObject implementations to re-enforce a
<link linkend="floating-ref">floating</link> object reference.
Doing this is seldomly required, all
#GInitiallyUnowned<!-- -->s are created with a floating reference which
usually just needs to be sunken by calling g_object_ref_sink().
Increases the freeze count on @object. If the freeze count is
non-zero, the emission of "notify" signals on @object is
stopped. The signals are queued until the freeze count is decreased
to zero.
This is necessary for accessors that modify multiple properties to prevent
premature notification while the object is still being modified.
Gets a named field from the objects table of associations (see g_object_set_data()).
the data if found, or %NULL if no such data exists.
name of the key for that association
Gets a property of an object.
In general, a copy is made of the property contents and the caller is
responsible for freeing the memory by calling g_value_unset().
Note that g_object_get_property() is really intended for language
bindings, g_object_get() is much more convenient for C programming.
the name of the property to get
return location for the property value
This function gets back user data pointers stored via
g_object_set_qdata().
The user data pointer set, or %NULL
A #GQuark, naming the user data pointer
Gets properties of an object.
In general, a copy is made of the property contents and the caller
is responsible for freeing the memory in the appropriate manner for
the type, for instance by calling g_free() or g_object_unref().
See g_object_get().
name of the first property to get
return location for the first property, followed optionally by more name/return location pairs, followed by %NULL
Emits a "notify" signal for the property @property_name on @object.
When possible, eg. when signaling a property change from within the class
that registered the property, you should use g_object_notify_by_pspec()
instead.
the name of a property installed on the class of @object.
Emits a "notify" signal for the property specified by @pspec on @object.
This function omits the property name lookup, hence it is faster than
g_object_notify().
One way to avoid using g_object_notify() from within the
class that registered the properties, and using g_object_notify_by_pspec()
instead, is to store the GParamSpec used with
g_object_class_install_property() inside a static array, e.g.:
|[
enum
{
PROP_0,
PROP_FOO,
PROP_LAST
};
static GParamSpec *properties[PROP_LAST];
static void
my_object_class_init (MyObjectClass *klass)
{
properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
0, 100,
50,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class,
PROP_FOO,
properties[PROP_FOO]);
}
]|
and then notify a change on the "foo" property with:
|[
g_object_notify_by_pspec (self, properties[PROP_FOO]);
]|
the #GParamSpec of a property installed on the class of @object.
Removes a reference added with g_object_add_toggle_ref(). The
reference count of the object is decreased by one.
a function to call when this reference is the last reference to the object, or is no longer the last reference.
data to pass to @notify
Removes a weak reference from @object that was previously added
using g_object_add_weak_pointer(). The @weak_pointer_location has
to match the one used with g_object_add_weak_pointer().
The memory address of a pointer.
Releases all references to other objects. This can be used to break
reference cycles.
This functions should only be called from object system implementations.
Each object carries around a table of associations from
strings to pointers. This function lets you set an association.
If the object already had an association with that name,
the old association will be destroyed.
name of the key
data to associate with that key
Like g_object_set_data() except it adds notification
for when the association is destroyed, either by setting it
to a different value or when the object is destroyed.
Note that the @destroy callback is not called if @data is %NULL.
name of the key
data to associate with that key
function to call when the association is destroyed
Sets a property on an object.
the name of the property to set
the value
This sets an opaque, named pointer on an object.
The name is specified through a #GQuark (retrived e.g. via
g_quark_from_static_string()), and the pointer
can be gotten back from the @object with g_object_get_qdata()
until the @object is finalized.
Setting a previously set user data pointer, overrides (frees)
the old pointer set, using #NULL as pointer essentially
removes the data stored.
A #GQuark, naming the user data pointer
An opaque user data pointer
This function works like g_object_set_qdata(), but in addition,
a void (*destroy) (gpointer) function may be specified which is
called with @data as argument when the @object is finalized, or
the data is being overwritten by a call to g_object_set_qdata()
with the same @quark.
A #GQuark, naming the user data pointer
An opaque user data pointer
Function to invoke with @data as argument, when @data needs to be freed
Sets properties on an object.
name of the first property to set
value for the first property, followed optionally by more name/value pairs, followed by %NULL
Remove a specified datum from the object's data associations,
without invoking the association's destroy handler.
the data if found, or %NULL if no such data exists.
name of the key
This function gets back user data pointers stored via
g_object_set_qdata() and removes the @data from object
without invoking its destroy() function (if any was
set).
Usually, calling this function is only required to update
user data pointers with a destroy notifier, for example:
|[
void
object_add_to_user_list (GObject *object,
const gchar *new_string)
{
// the quark, naming the object data
GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
// retrive the old string list
GList *list = g_object_steal_qdata (object, quark_string_list);
// prepend new string
list = g_list_prepend (list, g_strdup (new_string));
// this changed 'list', so we need to set it again
g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
}
static void
free_string_list (gpointer data)
{
GList *node, *list = data;
for (node = list; node; node = node->next)
g_free (node->data);
g_list_free (list);
}
]|
Using g_object_get_qdata() in the above example, instead of
g_object_steal_qdata() would have left the destroy function set,
and thus the partial string list would have been freed upon
g_object_set_qdata_full().
The user data pointer set, or %NULL
A #GQuark, naming the user data pointer
Reverts the effect of a previous call to
g_object_freeze_notify(). The freeze count is decreased on @object
and when it reaches zero, all queued "notify" signals are emitted.
It is an error to call this function when the freeze count is zero.
This function essentially limits the life time of the @closure to
the life time of the object. That is, when the object is finalized,
the @closure is invalidated by calling g_closure_invalidate() on
it, in order to prevent invocations of the closure with a finalized
(nonexisting) object. Also, g_object_ref() and g_object_unref() are
added as marshal guards to the @closure, to ensure that an extra
reference count is held on @object during invocation of the
use this @object as closure data.
GClosure to watch
Adds a weak reference callback to an object. Weak references are
used for notification when an object is finalized. They are called
"weak references" because they allow you to safely hold a pointer
to an object without calling g_object_ref() (g_object_ref() adds a
strong reference, that is, forces the object to stay alive).
callback to invoke before the object is freed
extra data to pass to notify
Removes a weak reference callback to an object.
callback to search for
data to search for
The class structure for the <structname>GObject</structname> type.
<example>
<title>Implementing singletons using a constructor</title>
<programlisting>
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;
}
</programlisting></example>
Looks up the #GParamSpec for a property of a class.
doesn't have a property of that name
the #GParamSpec for the property, or %NULL if the class
the name of the property to look up
Installs new properties from an array of #GParamSpec<!-- -->s. This is
usually done in the class initializer.
The property id of each property is the index of each #GParamSpec in
the @pspecs array.
The property id of 0 is treated specially by #GObject and it should not
be used to store a #GParamSpec.
This function should be used if you plan to use a static array of
#GParamSpec<!-- -->s and g_object_notify_pspec(). For instance, this
class initialization:
|[
enum {
PROP_0, PROP_FOO, PROP_BAR, N_PROPERTIES
};
static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, };
static void
my_object_class_init (MyObjectClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
obj_properties[PROP_FOO] =
g_param_spec_int ("foo", "Foo", "Foo",
-1, G_MAXINT,
0,
G_PARAM_READWRITE);
obj_properties[PROP_BAR] =
g_param_spec_string ("bar", "Bar", "Bar",
NULL,
G_PARAM_READWRITE);
gobject_class->set_property = my_object_set_property;
gobject_class->get_property = my_object_get_property;
g_object_class_install_properties (gobject_class,
N_PROPERTIES,
obj_properties);
}
]|
allows calling g_object_notify_by_pspec() to notify of property changes:
|[
void
my_object_set_foo (MyObject *self, gint foo)
{
if (self->foo != foo)
{
self->foo = foo;
g_object_notify_by_pspec (G_OBJECT (self), obj_properties[PROP_FOO]);
}
}
]|
the length of the #GParamSpec<!-- -->s array
the #GParamSpec<!-- -->s array defining the new properties
Installs a new property. This is usually done in the class initializer.
Note that it is possible to redefine a property in a derived class,
by installing a property with the same name. This can be useful at times,
e.g. to change the range of allowed values or the default value.
the id for the new property
the #GParamSpec for the new property
Get an array of #GParamSpec* for all properties of a class.
#GParamSpec* which should be freed after use
an array of
return location for the length of the returned array
Registers @property_id as referring to a property with the
name @name in a parent class or in an interface implemented
by @oclass. This allows this class to <firstterm>override</firstterm>
a property implementation in a parent class or to provide
the implementation of a property from an interface.
<note>
Internally, overriding is implemented by creating a property of type
#GParamSpecOverride; generally operations that query the properties of
the object class, such as g_object_class_find_property() or
g_object_class_list_properties() will return the overridden
property. However, in one case, the @construct_properties argument of
the @constructor virtual function, the #GParamSpecOverride is passed
instead, so that the @param_id field of the #GParamSpec will be
correct. For virtually all uses, this makes no difference. If you
need to get the overridden property, you can call
g_param_spec_get_redirect_target().
</note>
the new property ID
the name of a property registered in a parent class or in an interface of this class.
The <structname>GObjectConstructParam</structname> struct is an auxiliary
structure used to hand #GParamSpec/#GValue pairs to the @constructor of
a #GObjectClass.
The type of the @finalize function of #GObjectClass.
the #GObject being finalized
The type of the @get_property function of #GObjectClass.
a #GObject
the numeric id under which the property was registered with g_object_class_install_property().
a #GValue to return the property value in
the #GParamSpec describing the property
The type of the @set_property function of #GObjectClass.
a #GObject
the numeric id under which the property was registered with g_object_class_install_property().
the new value for the property
the #GParamSpec describing the property
Through the #GParamFlags flag values, certain aspects of parameters
can be configured.
All other fields of the <structname>GParamSpec</structname> struct are private and
should not be used directly.
Get the short description of a #GParamSpec.
the short description of @pspec.
Get the name of a #GParamSpec.
the name of @pspec.
Get the nickname of a #GParamSpec.
the nickname of @pspec.
Gets back user data pointers stored via g_param_spec_set_qdata().
the user data pointer set, or %NULL
a #GQuark, naming the user data pointer
If the paramspec redirects operations to another paramspec,
returns that paramspec. Redirect is used typically for
providing a new implementation of a property in a derived
type while preserving all the properties from the parent
type. Redirection is established by creating a property
of type #GParamSpecOverride. See g_object_class_override_property()
for an example of the use of this capability.
be redirected, or %NULL if none.
paramspec to which requests on this paramspec should
Increments the reference count of @pspec.
the #GParamSpec that was passed into this function
Convenience function to ref and sink a #GParamSpec.
the #GParamSpec that was passed into this function
Sets an opaque, named pointer on a #GParamSpec. The name is
specified through a #GQuark (retrieved e.g. via
g_quark_from_static_string()), and the pointer can be gotten back
from the @pspec with g_param_spec_get_qdata(). Setting a
previously set user data pointer, overrides (frees) the old pointer
set, using %NULL as pointer essentially removes the data stored.
a #GQuark, naming the user data pointer
an opaque user data pointer
This function works like g_param_spec_set_qdata(), but in addition,
a <literal>void (*destroy) (gpointer)</literal> function may be
specified which is called with @data as argument when the @pspec is
finalized, or the data is being overwritten by a call to
g_param_spec_set_qdata() with the same @quark.
a #GQuark, naming the user data pointer
an opaque user data pointer
function to invoke with @data as argument, when @data needs to be freed
The initial reference count of a newly created #GParamSpec is 1,
even though no one has explicitly called g_param_spec_ref() on it
yet. So the initial reference count is flagged as "floating", until
someone calls <literal>g_param_spec_ref (pspec); g_param_spec_sink
(pspec);</literal> in sequence on it, taking over the initial
reference count (thus ending up with a @pspec that has a reference
count of 1 still, but is not flagged "floating" anymore).
Gets back user data pointers stored via g_param_spec_set_qdata()
and removes the @data from @pspec without invoking its destroy()
function (if any was set). Usually, calling this function is only
required to update user data pointers with a destroy notifier.
the user data pointer set, or %NULL
a #GQuark, naming the user data pointer
Decrements the reference count of a @pspec.
A #GParamSpec derived structure that contains the meta data for boolean properties.
A #GParamSpec derived structure that contains the meta data for boxed properties.
A #GParamSpec derived structure that contains the meta data for character properties.
The class structure for the <structname>GParamSpec</structname> type.
Normally, <structname>GParamSpec</structname> classes are filled by
g_param_type_register_static().
A #GParamSpec derived structure that contains the meta data for double properties.
A #GParamSpec derived structure that contains the meta data for enum
properties.
A #GParamSpec derived structure that contains the meta data for flags
properties.
A #GParamSpec derived structure that contains the meta data for float properties.
A #GParamSpec derived structure that contains the meta data for #GType properties.
A #GParamSpec derived structure that contains the meta data for integer properties.
A #GParamSpec derived structure that contains the meta data for 64bit integer properties.
A #GParamSpec derived structure that contains the meta data for long integer properties.
A #GParamSpec derived structure that contains the meta data for object properties.
This is a type of #GParamSpec type that simply redirects operations to
another paramspec. 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 overidden
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.
A #GParamSpec derived structure that contains the meta data for %G_TYPE_PARAM
properties.
A #GParamSpec derived structure that contains the meta data for pointer properties.
A #GParamSpecPool maintains a collection of #GParamSpec<!-- -->s 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.
Inserts a #GParamSpec in the pool.
the #GParamSpec to insert
a #GType identifying the owner of @pspec
Gets an array of all #GParamSpec<!-- -->s owned by @owner_type in
the pool.
#GParamSpec<!-- -->s owned by @owner_type in the pool
a newly allocated array containing pointers to all
the owner to look for
return location for the length of the returned array
Gets an #GList of all #GParamSpec<!-- -->s owned by @owner_type in
the pool.
in the pool#GParamSpec<!-- -->s.
a #GList of all #GParamSpec<!-- -->s owned by @owner_type
the owner to look for
Looks up a #GParamSpec in the pool.
The found #GParamSpec, or %NULL if no matching #GParamSpec was found.
the name to look for
the owner to look for
If %TRUE, also try to find a #GParamSpec with @param_name owned by an ancestor of @owner_type.
Removes a #GParamSpec from the pool.
the #GParamSpec to remove
A #GParamSpec derived structure that contains the meta data for string
properties.
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().
A #GParamSpec derived structure that contains the meta data for unsigned character properties.
A #GParamSpec derived structure that contains the meta data for unsigned integer properties.
A #GParamSpec derived structure that contains the meta data for unsigned 64bit integer properties.
A #GParamSpec derived structure that contains the meta data for unsigned long integer properties.
A #GParamSpec derived structure that contains the meta data for unichar (unsigned integer) properties.
A #GParamSpec derived structure that contains the meta data for #GValueArray properties.
A #GParamSpec derived structure that contains the meta data for #GVariant properties.
The <structname>GParameter</structname> struct is an auxiliary structure used
to hand parameter name/value pairs to g_object_newv().
The signal accumulator is a special callback function that can be used
to collect return values of the various callbacks that are called
during a signal emission. The signal accumulator is specified at signal
creation time, if it is left %NULL, no accumulation of callback return
values is performed. The return value of signal emissions is then the
value returned by the last callback.
should be aborted. Returning %FALSE means to abort the
current emission and %TRUE is returned for continuation.
The accumulator function returns whether the signal emission
Signal invocation hint, see #GSignalInvocationHint.
Accumulator to collect callback return values in, this is the return value of the current signal emission.
A #GValue holding the return value of the signal handler.
Callback data that was specified when creating the signal.
A simple function pointer to get invoked when the signal is emitted. This
allows you to tie a hook to the signal type, so that it will trap all
emissions of that signal, from any object.
You may not attach these to signals created with the #G_SIGNAL_NO_HOOKS flag.
hook is disconnected (and destroyed).
whether it wants to stay connected. If it returns %FALSE, the signal
Signal invocation hint, see #GSignalInvocationHint.
the number of parameters to the function, including the instance on which the signal was emitted.
the instance on which the signal was emitted, followed by the parameters of the emission.
user data associated with the hook.
The signal flags are used to specify a signal's behaviour, the overall
signal description outlines how especially the RUN flags control the
stages of a signal emission.
The #GSignalInvocationHint structure is used to pass on additional information
to callbacks during a signal emission.
The match types specify what g_signal_handlers_block_matched(),
g_signal_handlers_unblock_matched() and g_signal_handlers_disconnect_matched()
match signals by.
A structure holding in-depth information for a specific signal. It is
filled in by the g_signal_query() function.
A callback function used for notification when the state
of a toggle reference changes. See g_object_add_toggle_ref().
Callback data passed to g_object_add_toggle_ref()
The object on which g_object_add_toggle_ref() was called.
%TRUE if the toggle reference is now the last reference to the object. %FALSE if the toggle reference was the last reference and there are now other references.
A union holding one collected value.
An opaque structure used as the base of all classes.
A callback function which is called when the reference count of a class
drops to zero. It may use g_type_class_ref() to prevent the class from
being freed. You should not call g_type_class_unref() from a
#GTypeClassCacheFunc function to prevent infinite recursion, use
g_type_class_unref_uncached() instead.
The functions have to check the class id passed in to figure
whether they actually want to cache the class of this type, since all
classes are routed through the same #GTypeClassCacheFunc chain.
called, %FALSE to continue.
%TRUE to stop further #GTypeClassCacheFunc<!-- -->s from being
data that was given to the g_type_add_class_cache_func() call
The #GTypeClass structure which is unreferenced
The <type>GTypeDebugFlags</type> enumeration values can be passed to
g_type_init_with_debug_flags() to trigger debugging messages during runtime.
Note that the messages can also be triggered by setting the
<envar>GOBJECT_DEBUG</envar> environment variable to a ':'-separated list of
"objects" and "signals".
Bit masks used to check or determine characteristics of a type.
Bit masks used to check or determine specific characteristics of a
fundamental type.
A structure that provides information to the type system which is
used specifically for managing fundamental types.
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().
An opaque structure used as the base of all type instances.
An opaque structure used as the base of all interface types.
A callback called after an interface vtable is initialized.
See g_type_add_interface_check().
data passed to g_type_add_interface_check().
the interface that has been initialized
The members of the <structname>GTypeModule</structname> structure should not
be accessed directly, except for the @name field.
Registers an additional interface for a type, whose interface lives
in the given type plugin. If the interface was already registered
for the type in this plugin, nothing will be done.
As long as any instances of the type exist, the type plugin will
not be unloaded.
type to which to add the interface.
interface type to add
type information structure
Looks up or registers an enumeration that is implemented with a particular
type plugin. If a type with name @type_name was previously registered,
the #GType identifier for the type is returned, otherwise the type
is newly registered, and the resulting #GType identifier returned.
As long as any instances of the type exist, the type plugin will
not be unloaded.
the new or existing type ID
name for the type
an array of #GEnumValue structs for the possible enumeration values. The array is terminated by a struct with all members being 0.
Looks up or registers a flags type that is implemented with a particular
type plugin. If a type with name @type_name was previously registered,
the #GType identifier for the type is returned, otherwise the type
is newly registered, and the resulting #GType identifier returned.
As long as any instances of the type exist, the type plugin will
not be unloaded.
the new or existing type ID
name for the type
an array of #GFlagsValue structs for the possible flags values. The array is terminated by a struct with all members being 0.
Looks up or registers a type that is implemented with a particular
type plugin. If a type with name @type_name was previously registered,
the #GType identifier for the type is returned, otherwise the type
is newly registered, and the resulting #GType identifier returned.
When reregistering a type (typically because a module is unloaded
then reloaded, and reinitialized), @module and @parent_type must
be the same as they were previously.
As long as any instances of the type exist, the type plugin will
not be unloaded.
the new or existing type ID
the type for the parent class
name for the type
type information structure
flags field providing details about the type
Sets the name for a #GTypeModule
a human-readable name to use in error messages.
Decreases the use count of a #GTypeModule by one. If the
result is zero, the module will be unloaded. (However, the
#GTypeModule will not be freed, and types associated with the
#GTypeModule are not unregistered. Once a #GTypeModule is
initialized, it must exist forever.)
Increases the use count of a #GTypeModule by one. If the
use count was zero before, the plugin will be loaded.
If loading the plugin fails, the use count is reset to
its prior value.
loading the plugin failed.
%FALSE if the plugin needed to be loaded and
In order to implement dynamic loading of types based on #GTypeModule,
the @load and @unload functions in #GTypeModuleClass must be implemented.
The <structname>GTypePlugin</structname> typedef is used as a placeholder
for objects that implement the <structname>GTypePlugin</structname>
interface.
Calls the @complete_interface_info function from the
#GTypePluginClass of @plugin. There should be no need to use this
function outside of the GObject type system itself.
the #GType of an instantiable type to which the interface is added
the #GType of the interface whose info is completed
the #GInterfaceInfo to fill in
Calls the @complete_type_info function from the #GTypePluginClass of @plugin.
There should be no need to use this function outside of the GObject
type system itself.
the #GType whose info is completed
the #GTypeInfo struct to fill in
the #GTypeValueTable to fill in
Calls the @unuse_plugin function from the #GTypePluginClass of
the GObject type system itself.
Calls the @use_plugin function from the #GTypePluginClass of
the GObject type system itself.
The #GTypePlugin interface is used by the type system in order to handle
the lifecycle of dynamically loaded types.
The type of the @complete_interface_info function of #GTypePluginClass.
the #GTypePlugin
the #GType of an instantiable type to which the interface is added
the #GType of the interface whose info is completed
the #GInterfaceInfo to fill in
The type of the @complete_type_info function of #GTypePluginClass.
the #GTypePlugin
the #GType whose info is completed
the #GTypeInfo struct to fill in
the #GTypeValueTable to fill in
The type of the @unuse_plugin function of #GTypePluginClass.
the #GTypePlugin whose use count should be decreased
The type of the @use_plugin function of #GTypePluginClass, which gets called
to increase the use count of @plugin.
the #GTypePlugin whose use count should be increased
A structure holding information for a specific type. It is
filled in by the g_type_query() function.
The #GTypeValueTable provides the functions required by the #GValue implementation,
to serve as a container for values of a type.
An opaque structure used to hold different types of values.
to functions within a #GTypeValueTable structure, or implementations of
the g_value_*() API. That is, code portions which implement new fundamental
types.
#GValue users can not 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.
Copies the value of @src_value into @dest_value.
An initialized #GValue structure of the same type as @src_value.
Get the contents of a %G_TYPE_BOXED derived #GValue. Upon getting,
the boxed value is duplicated and needs to be later freed with
return_value);
boxed contents of @value
Get the contents of a %G_TYPE_OBJECT derived #GValue, increasing
its reference count.
longer needed.
object content of @value, should be unreferenced when no
Get the contents of a %G_TYPE_PARAM #GValue, increasing its
reference count.
no longer needed.
#GParamSpec content of @value, should be unreferenced when
Get a copy the contents of a %G_TYPE_STRING #GValue.
a newly allocated copy of the string content of @value
Get the contents of a variant #GValue, increasing its refcount.
g_variant_unref() when no longer needed
variant contents of @value, should be unrefed using
Determines if @value will fit inside the size of a pointer value.
This is an internal function introduced mainly for C marshallers.
%TRUE if @value will fit inside a pointer value.
Get the contents of a %G_TYPE_BOOLEAN #GValue.
boolean contents of @value
Get the contents of a %G_TYPE_BOXED derived #GValue.
boxed contents of @value
Get the contents of a %G_TYPE_CHAR #GValue.
character contents of @value
Get the contents of a %G_TYPE_DOUBLE #GValue.
double contents of @value
Get the contents of a %G_TYPE_ENUM #GValue.
enum contents of @value
Get the contents of a %G_TYPE_FLAGS #GValue.
flags contents of @value
Get the contents of a %G_TYPE_FLOAT #GValue.
float contents of @value
Get the contents of a %G_TYPE_GTYPE #GValue.
the #GType stored in @value
Get the contents of a %G_TYPE_INT #GValue.
integer contents of @value
Get the contents of a %G_TYPE_INT64 #GValue.
64bit integer contents of @value
Get the contents of a %G_TYPE_LONG #GValue.
long integer contents of @value
Get the contents of a %G_TYPE_OBJECT derived #GValue.
object contents of @value
Get the contents of a %G_TYPE_PARAM #GValue.
#GParamSpec content of @value
Get the contents of a pointer #GValue.
pointer contents of @value
Get the contents of a %G_TYPE_STRING #GValue.
string content of @value
Get the contents of a %G_TYPE_UCHAR #GValue.
unsigned character contents of @value
Get the contents of a %G_TYPE_UINT #GValue.
unsigned integer contents of @value
Get the contents of a %G_TYPE_UINT64 #GValue.
unsigned 64bit integer contents of @value
Get the contents of a %G_TYPE_ULONG #GValue.
unsigned long integer contents of @value
Get the contents of a variant #GValue.
variant contents of @value
Initializes @value with the default value of @type.
the #GValue structure that has been passed in
Type the #GValue should hold values of.
Return the value contents as pointer. This function asserts that
g_value_fits_pointer() returned %TRUE for the passed in value.
This is an internal function introduced mainly for C marshallers.
%TRUE if @value will fit inside a pointer value.
Clears the current value in @value and resets it to the default value
(as if the value had just been initialized).
the #GValue structure that has been passed in
Set the contents of a %G_TYPE_BOOLEAN #GValue to @v_boolean.
boolean value to be set
Set the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed.
boxed value to be set
This is an internal function introduced mainly for C marshallers.
duplicated unowned boxed value to be set
Set the contents of a %G_TYPE_CHAR #GValue to @v_char.
character value to be set
Set the contents of a %G_TYPE_DOUBLE #GValue to @v_double.
double value to be set
Set the contents of a %G_TYPE_ENUM #GValue to @v_enum.
enum value to be set
Set the contents of a %G_TYPE_FLAGS #GValue to @v_flags.
flags value to be set
Set the contents of a %G_TYPE_FLOAT #GValue to @v_float.
float value to be set
Set the contents of a %G_TYPE_GTYPE #GValue to @v_gtype.
#GType to be set
Sets @value from an instantiatable type via the
value_table's collect_value() function.
the instance
Set the contents of a %G_TYPE_INT #GValue to @v_int.
integer value to be set
Set the contents of a %G_TYPE_INT64 #GValue to @v_int64.
64bit integer value to be set
Set the contents of a %G_TYPE_LONG #GValue to @v_long.
long integer value to be set
Set the contents of a %G_TYPE_OBJECT derived #GValue to @v_object.
g_value_set_object() increases the reference count of @v_object
(the #GValue holds a reference to @v_object). If you do not wish
to increase the reference count of the object (i.e. you wish to
pass your current reference to the #GValue because you no longer
need it), use g_value_take_object() instead.
It is important that your #GValue holds a reference to @v_object (either its
own, or one it has taken) to ensure that the object won't be destroyed while
the #GValue still exists).
object value to be set
This is an internal function introduced mainly for C marshallers.
object value to be set
Set the contents of a %G_TYPE_PARAM #GValue to @param.
the #GParamSpec to be set
This is an internal function introduced mainly for C marshallers.
the #GParamSpec to be set
Set the contents of a pointer #GValue to @v_pointer.
pointer value to be set
Set the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed.
The boxed value is assumed to be static, and is thus not duplicated
when setting the #GValue.
static boxed value to be set
Set the contents of a %G_TYPE_STRING #GValue to @v_string.
The string is assumed to be static, and is thus not duplicated
when setting the #GValue.
static string to be set
Set the contents of a %G_TYPE_STRING #GValue to @v_string.
caller-owned string to be duplicated for the #GValue
This is an internal function introduced mainly for C marshallers.
duplicated unowned string to be set
Set the contents of a %G_TYPE_UCHAR #GValue to @v_uchar.
unsigned character value to be set
Set the contents of a %G_TYPE_UINT #GValue to @v_uint.
unsigned integer value to be set
Set the contents of a %G_TYPE_UINT64 #GValue to @v_uint64.
unsigned 64bit integer value to be set
Set the contents of a %G_TYPE_ULONG #GValue to @v_ulong.
unsigned long integer value to be set
Set the contents of a variant #GValue to @variant.
If the variant is floating, it is consumed.
a #GVariant, or %NULL
Sets the contents of a %G_TYPE_BOXED derived #GValue to @v_boxed
and takes over the ownership of the callers reference to @v_boxed;
the caller doesn't have to unref it any more.
duplicated unowned boxed value to be set
Sets the contents of a %G_TYPE_OBJECT derived #GValue to @v_object
and takes over the ownership of the callers reference to @v_object;
the caller doesn't have to unref it any more (i.e. the reference
count of the object is not increased).
If you want the #GValue to hold its own reference to @v_object, use
g_value_set_object() instead.
object value to be set
Sets the contents of a %G_TYPE_PARAM #GValue to @param and takes
over the ownership of the callers reference to @param; the caller
doesn't have to unref it any more.
the #GParamSpec to be set
Sets the contents of a %G_TYPE_STRING #GValue to @v_string.
string to take ownership of
Set the contents of a variant #GValue to @variant, and takes over
the ownership of the caller's reference to @variant;
the caller doesn't have to unref it any more (i.e. the reference
count of the variant is not increased).
It is a programmer error to pass a floating variant to this function.
In particular this means that callbacks in closures, and signal handlers
for signals of return type %G_TYPE_VARIANT, must never return floating
variants.
If you want the #GValue to hold its own reference to @variant, use
g_value_set_variant() instead.
This is an internal function introduced mainly for C marshallers.
a #GVariant, or %NULL
Tries to cast the contents of @src_value into a type appropriate
to store in @dest_value, e.g. to transform a %G_TYPE_INT value
into a %G_TYPE_FLOAT value. Performing transformations between
value types might incur precision lossage. Especially
transformations into strings might reveal seemingly arbitrary
results and shouldn't be relied upon for production code (such
as rcfile value or object property serialization).
Upon failing transformations, @dest_value is left untouched.
Whether a transformation rule was found and could be applied.
Target value.
Clears the current value in @value and "unsets" the type,
this releases all resources associated with this GValue.
An unset value is the same as an uninitialized (zero-filled)
#GValue structure.
A #GValueArray contains an array of #GValue elements.
Allocate and initialize a new #GValueArray, optionally preserve space
for @n_prealloced elements. New arrays always contain 0 elements,
regardless of the value of @n_prealloced.
a newly allocated #GValueArray with 0 values
number of values to preallocate space for
Insert a copy of @value as last element of @value_array. If @value is
%NULL, an uninitialized value is appended.
the #GValueArray passed in as @value_array
#GValue to copy into #GValueArray, or %NULL
Construct an exact copy of a #GValueArray by duplicating all its
contents.
Newly allocated copy of #GValueArray
Free a #GValueArray including its contents.
Return a pointer to the value at @index_ containd in @value_array.
pointer to a value at @index_ in @value_array
index of the value of interest
Insert a copy of @value at specified position into @value_array. If @value
is %NULL, an uninitialized value is inserted.
the #GValueArray passed in as @value_array
insertion position, must be <= value_array->n_values
#GValue to copy into #GValueArray, or %NULL
Insert a copy of @value as first element of @value_array. If @value is
%NULL, an uninitialized value is prepended.
the #GValueArray passed in as @value_array
#GValue to copy into #GValueArray, or %NULL
Remove the value at position @index_ from @value_array.
the #GValueArray passed in as @value_array
position of value to remove, must be < value_array->n_values
Sort @value_array using @compare_func to compare the elements accoring to
the semantics of #GCompareFunc.
The current implementation uses Quick-Sort as sorting algorithm.
the #GValueArray passed in as @value_array
function to compare elements
Sort @value_array using @compare_func to compare the elements accoring
to the semantics of #GCompareDataFunc.
The current implementation uses Quick-Sort as sorting algorithm.
the #GValueArray passed in as @value_array
function to compare elements
extra data argument provided for @compare_func
The type of value transformation functions which can be registered with
g_value_register_transform_func().
Source value.
Target value.
A #GWeakNotify function can be added to an object as a callback that gets
triggered when the object is finalized. Since the object is already being
finalized when the #GWeakNotify is called, there's not much you could do
with the object, apart from e.g. using its adress as hash-index or the like.
data that was provided when the weak reference was established
the object being finalized
Provide a copy of a boxed structure @src_boxed which is of type @boxed_type.
The newly created copy of the boxed structure.
The type of @src_boxed.
The boxed structure to be copied.
Free the boxed structure @boxed which is of type @boxed_type.
The type of @boxed.
The boxed structure to be freed.
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.
New %G_TYPE_BOXED derived type id for @name.
Name of the new boxed type.
Boxed structure copy function.
Boxed structure free function.
A marshaller for a #GCClosure with a callback of type
<literal>gboolean (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameter
denotes a flags type.
the #GClosure to which the marshaller belongs
a #GValue which can store the returned #gboolean
2
a #GValue array holding instance and arg1
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>gchar* (*callback) (gpointer instance, GObject *arg1, gpointer arg2, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
a #GValue, which can store the returned string
3
a #GValue array holding instance, arg1 and arg2
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gboolean arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gboolean parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, GBoxed *arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #GBoxed* parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gchar arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gchar parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gdouble arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gdouble parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameter denotes an enumeration type..
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the enumeration parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal> where the #gint parameter denotes a flags type.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the flags parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gfloat arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gfloat parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gint arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gint parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, glong arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #glong parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, GObject *arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #GObject* parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, GParamSpec *arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #GParamSpec* parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gpointer arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gpointer parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, const gchar *arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gchar* parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, guchar arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #guchar parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, guint arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #guint parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, guint arg1, gpointer arg2, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
3
a #GValue array holding instance, arg1 and arg2
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gulong arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #gulong parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, GVariant *arg1, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
2
a #GValue array holding the instance and the #GVariant* parameter
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
A marshaller for a #GCClosure with a callback of type
<literal>void (*callback) (gpointer instance, gpointer user_data)</literal>.
the #GClosure to which the marshaller belongs
ignored
1
a #GValue array holding only the instance
the invocation hint given as the last argument to g_closure_invoke()
additional data specified when registering the marshaller
Creates a new closure which invokes @callback_func with @user_data as
the last parameter.
a new #GCClosure
the function to invoke
user data to pass to @callback_func
destroy notify to be called when @user_data is no longer used
A variant of g_cclosure_new() which uses @object as @user_data and
calls g_object_watch_closure() on @object and the created
closure. This function is useful when you have a callback closely
associated with a #GObject, and want the callback to no longer run
after the object is is freed.
a new #GCClosure
the function to invoke
a #GObject pointer to pass to @callback_func
A variant of g_cclosure_new_swap() which uses @object as @user_data
and calls g_object_watch_closure() on @object and the created
closure. This function is useful when you have a callback closely
associated with a #GObject, and want the callback to no longer run
after the object is is freed.
a new #GCClosure
the function to invoke
a #GObject pointer to pass to @callback_func
Creates a new closure which invokes @callback_func with @user_data as
the first parameter.
a new #GCClosure
the function to invoke
user data to pass to @callback_func
destroy notify to be called when @user_data is no longer used
This function is meant to be called from the complete_type_info()
function of a #GTypePlugin 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);
}
]|
the type identifier of the type being completed
the #GTypeInfo struct to be filled in
An array of #GEnumValue structs for the possible enumeration values. The array is terminated by a struct with all members being 0.
Returns the #GEnumValue for a value.
member of the enumeration
the #GEnumValue for @value, or %NULL if @value is not a
a #GEnumClass
the value to look up
Looks up a #GEnumValue by name.
enumeration doesn't have a member with that name
the #GEnumValue with name @name, or %NULL if the
a #GEnumClass
the name to look up
Looks up a #GEnumValue by nickname.
enumeration doesn't have a member with that nickname
the #GEnumValue with nickname @nick, or %NULL if the
a #GEnumClass
the nickname to look up
Registers a new static enumeration type with the name @name.
It is normally more convenient to let <link
linkend="glib-mkenums">glib-mkenums</link> generate a
my_enum_get_type() function from a usual C enumeration definition
than to write one yourself using g_enum_register_static().
The new type identifier.
A nul-terminated string used as the name of the new type.
An array of #GEnumValue structs 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.
This function is meant to be called from the complete_type_info()
function of a #GTypePlugin implementation, see the example for
g_enum_complete_type_info() above.
the type identifier of the type being completed
the #GTypeInfo struct to be filled in
An array of #GFlagsValue structs for the possible enumeration values. The array is terminated by a struct with all members being 0.
Returns the first #GFlagsValue which is set in @value.
none is set
the first #GFlagsValue which is set in @value, or %NULL if
a #GFlagsClass
the value
Looks up a #GFlagsValue by name.
flag with that name
the #GFlagsValue with name @name, or %NULL if there is no
a #GFlagsClass
the name to look up
Looks up a #GFlagsValue by nickname.
no flag with that nickname
the #GFlagsValue with nickname @nick, or %NULL if there is
a #GFlagsClass
the nickname to look up
Registers a new static flags type with the name @name.
It is normally more convenient to let <link
linkend="glib-mkenums">glib-mkenums</link> generate a
my_flags_get_type() function from a usual C enumeration definition
than to write one yourself using g_flags_register_static().
The new type identifier.
A nul-terminated string used as the name of the new type.
An array of #GFlagsValue structs 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.
Creates a new #GParamSpecBoolean instance specifying a %G_TYPE_BOOLEAN
property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
default value for the property specified
flags for the property specified
Creates a new #GParamSpecBoxed instance specifying a %G_TYPE_BOXED
derived property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
%G_TYPE_BOXED derived type of this property
flags for the property specified
Creates a new #GParamSpecChar instance specifying a %G_TYPE_CHAR property.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
Creates a new #GParamSpecDouble instance specifying a %G_TYPE_DOUBLE
property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
Creates a new #GParamSpecEnum instance specifying a %G_TYPE_ENUM
property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
a #GType derived from %G_TYPE_ENUM
default value for the property specified
flags for the property specified
Creates a new #GParamSpecFlags instance specifying a %G_TYPE_FLAGS
property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
a #GType derived from %G_TYPE_FLAGS
default value for the property specified
flags for the property specified
Creates a new #GParamSpecFloat instance specifying a %G_TYPE_FLOAT property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
Creates a new #GParamSpecGType instance specifying a
%G_TYPE_GTYPE property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
a #GType whose subtypes are allowed as values of the property (use %G_TYPE_NONE for any type)
flags for the property specified
Creates a new #GParamSpecInt instance specifying a %G_TYPE_INT property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
Creates a new #GParamSpecInt64 instance specifying a %G_TYPE_INT64 property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
Creates a new #GParamSpec instance.
A property name consists of segments consisting of ASCII letters and
digits, separated by either the '-' or '_' character. The first
character of a property name must be a letter. Names which violate these
rules lead to undefined behaviour.
When creating and looking up a #GParamSpec, either separator can be
used, but they cannot be mixed. Using '-' is considerably more
efficient and in fact required when using property names as detail
strings for signals.
Beyond the name, #GParamSpec<!-- -->s have two more descriptive
strings associated with them, the @nick, which should be suitable
for use as a label for the property in a property editor, and the
e.g. a tooltip. The @nick and @blurb should ideally be localized.
a newly allocated #GParamSpec instance
the #GType for the property; must be derived from #G_TYPE_PARAM
the canonical name of the property
the nickname of the property
a short description of the property
a combination of #GParamFlags
Creates a new #GParamSpecLong instance specifying a %G_TYPE_LONG property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
Creates a new #GParamSpecBoxed instance specifying a %G_TYPE_OBJECT
derived property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
%G_TYPE_OBJECT derived type of this property
flags for the property specified
Creates a new property of type #GParamSpecOverride. This is used
to direct operations to another paramspec, and will not be directly
useful unless you are implementing a new base type similar to GObject.
the newly created #GParamSpec
the name of the property.
The property that is being overridden
Creates a new #GParamSpecParam instance specifying a %G_TYPE_PARAM
property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
a #GType derived from %G_TYPE_PARAM
flags for the property specified
Creates a new #GParamSpecPoiner instance specifying a pointer property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
flags for the property specified
Creates a new #GParamSpecPool.
If @type_prefixing is %TRUE, lookups in the newly created pool will
allow to specify the owner as a colon-separated prefix of the
property name, like "GtkContainer:border-width". This feature is
deprecated, so you should always set @type_prefixing to %FALSE.
a newly allocated #GParamSpecPool.
Whether the pool will support type-prefixed property names.
Creates a new #GParamSpecString instance.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
default value for the property specified
flags for the property specified
Creates a new #GParamSpecUChar instance specifying a %G_TYPE_UCHAR property.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
Creates a new #GParamSpecUInt instance specifying a %G_TYPE_UINT property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
Creates a new #GParamSpecUInt64 instance specifying a %G_TYPE_UINT64
property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
Creates a new #GParamSpecULong instance specifying a %G_TYPE_ULONG
property.
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
minimum value for the property specified
maximum value for the property specified
default value for the property specified
flags for the property specified
Creates a new #GParamSpecUnichar instance specifying a %G_TYPE_UINT
property. #GValue structures for this property can be accessed with
g_value_set_uint() and g_value_get_uint().
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
default value for the property specified
flags for the property specified
Creates a new #GParamSpecValueArray instance specifying a
%G_TYPE_VALUE_ARRAY property. %G_TYPE_VALUE_ARRAY is a
%G_TYPE_BOXED type, as such, #GValue structures for this property
can be accessed with g_value_set_boxed() and g_value_get_boxed().
See g_param_spec_internal() for details on property names.
a newly created parameter specification
canonical name of the property specified
nick name for the property specified
description of the property specified
a #GParamSpec describing the elements contained in arrays of this property, may be %NULL
flags for the property specified
Creates a new #GParamSpecVariant instance specifying a #GVariant
property.
If @default_value is floating, it is consumed.
See g_param_spec_internal() for details on property names.
the newly created #GParamSpec
canonical name of the property specified
nick name for the property specified
description of the property specified
a #GVariantType
a #GVariant of type @type to use as the default value, or %NULL
flags for the property specified
Registers @name as the name of a new static type derived from
#G_TYPE_PARAM. The type system uses the information contained in
the #GParamSpecTypeInfo structure pointed to by @info to manage the
#GParamSpec type and its instances.
The new type identifier.
0-terminated string used as the name of the new #GParamSpec type.
The #GParamSpecTypeInfo for this #GParamSpec type.
Transforms @src_value into @dest_value if possible, and then
validates @dest_value, in order for it to conform to @pspec. If
transformed @dest_value complied to @pspec without modifications.
See also g_value_type_transformable(), g_value_transform() and
g_param_value_validate().
%FALSE otherwise and @dest_value is left untouched.
%TRUE if transformation and validation were successful,
a valid #GParamSpec
souce #GValue
destination #GValue of correct type for @pspec
%TRUE requires @dest_value to conform to @pspec without modifications
Checks whether @value contains the default value as specified in @pspec.
whether @value contains the canonical default for this @pspec
a valid #GParamSpec
a #GValue of correct type for @pspec
Sets @value to its default value as specified in @pspec.
a valid #GParamSpec
a #GValue of correct type for @pspec
Ensures that the contents of @value comply with the specifications
set out by @pspec. For example, a #GParamSpecInt 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.
whether modifying @value was necessary to ensure validity
a valid #GParamSpec
a #GValue of correct type for @pspec
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.
-1, 0 or +1, for a less than, equal to or greater than result
a valid #GParamSpec
a #GValue of correct type for @pspec
a #GValue of correct type for @pspec
Creates a new %G_TYPE_POINTER derived type id for a new
pointer type with name @name.
a new %G_TYPE_POINTER derived type id for @name.
the name of the new pointer type.
A predefined #GSignalAccumulator for signals that return a
boolean values. The behavior that this accumulator gives is
callbacks will be invoked, while a return of %FALSE allows
the emission to coninue. The idea here is that a %TRUE return
indicates that the callback <emphasis>handled</emphasis> the signal,
and no further handling is needed.
standard #GSignalAccumulator result
standard #GSignalAccumulator parameter
standard #GSignalAccumulator parameter
standard #GSignalAccumulator parameter
standard #GSignalAccumulator parameter
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 #G_SIGNAL_NO_HOOKS flag set.
the hook id, for later use with g_signal_remove_emission_hook().
the signal identifier, as returned by g_signal_lookup().
the detail on which to call the hook.
a #GSignalEmissionHook function.
user data for @hook_func.
a #GDestroyNotify for @hook_data.
Calls the original class closure of a signal. This function should only
be called from an overridden class closure; see
g_signal_override_class_closure() and
g_signal_override_class_handler().
the argument list of the signal emission. The first element in the array is a #GValue for the instance the signal is being emitted on. The rest are any arguments to be passed to the signal.
Location for the return value.
Calls the original class closure of a signal. This function should
only be called from an overridden class closure; see
g_signal_override_class_closure() and
g_signal_override_class_handler().
the instance the signal is being emitted on.
Connects a closure to a signal for a particular object.
the handler id
the instance to connect to.
a string of the form "signal-name::detail".
the closure to connect.
whether the handler should be called before or after the default handler of the signal.
Connects a closure to a signal for a particular object.
the handler id
the instance to connect to.
the id of the signal.
the detail.
the closure to connect.
whether the handler should be called before or after the default handler of the signal.
Connects a #GCallback function to a signal for a particular object. Similar
to g_signal_connect(), but allows to provide a #GClosureNotify for the data
which will be called when the signal handler is disconnected and no longer
used. Specify @connect_flags if you need <literal>..._after()</literal> or
<literal>..._swapped()</literal> variants of this function.
the handler id
the instance to connect to.
a string of the form "signal-name::detail".
the #GCallback to connect.
data to pass to @c_handler calls.
a #GClosureNotify for @data.
a combination of #GConnectFlags.
This is similar to g_signal_connect_data(), but uses a closure which
ensures that the @gobject stays alive during the call to @c_handler
by temporarily adding a reference count to @gobject.
Note that there is a bug in GObject that makes this function
much less useful than it might seem otherwise. Once @gobject is
disposed, the callback will no longer be called, but, the signal
handler is <emphasis>not</emphasis> currently disconnected. If the
matter, since the signal will automatically be removed, but
if @instance persists, then the signal handler will leak. You
should not remove the signal yourself because in a future versions of
GObject, the handler <emphasis>will</emphasis> automatically
be disconnected.
It's possible to work around this problem in a way that will
continue to work with future versions of GObject by checking
that the signal handler is still connected before disconnected it:
<informalexample><programlisting>
if (g_signal_handler_is_connected (instance, id))
g_signal_handler_disconnect (instance, id);
</programlisting></informalexample>
the handler id.
the instance to connect to.
a string of the form "signal-name::detail".
the #GCallback to connect.
the object to pass as data to @c_handler.
a combination of #GConnnectFlags.
Emits a signal.
Note that g_signal_emit() resets the return value to the default
if no handlers are connected, in contrast to g_signal_emitv().
the instance the signal is being emitted on.
the signal id
the detail
Emits a signal.
Note that g_signal_emit_by_name() resets the return value to the default
if no handlers are connected, in contrast to g_signal_emitv().
the instance the signal is being emitted on.
a string of the form "signal-name::detail".
Emits a signal.
Note that g_signal_emit_valist() resets the return value to the default
if no handlers are connected, in contrast to g_signal_emitv().
the instance the signal is being emitted on.
the signal id
the detail
a list of parameters to be passed to the signal, followed by a location for the return value. If the return type of the signal is #G_TYPE_NONE, the return value location can be omitted.
Emits a signal.
Note that g_signal_emitv() doesn't change @return_value if no handlers are
connected, in contrast to g_signal_emit() and g_signal_emit_valist().
argument list for the signal emission. The first element in the array is a #GValue for the instance the signal is being emitted on. The rest are any arguments to be passed to the signal.
the signal id
the detail
Location to store the return value of the signal emission.
Returns the invocation hint of the innermost signal emission of instance.
the invocation hint of the innermost signal emission.
the instance to query
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 deactive 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.
The instance to block the signal handler of.
Handler id of the handler to be blocked.
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.
The instance to remove the signal handler from.
Handler id of the handler to be disconnected.
Finds the first signal handler that matches certain selection criteria.
The criteria mask is passed as an OR-ed combination of #GSignalMatchType
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.
A valid non-0 signal handler id for a successful match.
The instance owning the signal handler to be found.
Mask indicating which of @signal_id, @detail, @closure, @func and/or @data the handler has to match.
Signal the handler has to be connected to.
Signal detail the handler has to be connected to.
The closure the handler will invoke.
The C closure callback of the handler (useless for non-C closures).
The closure data of the handler's closure.
Returns whether @handler_id is the id of a handler connected to @instance.
whether @handler_id identifies a handler connected to @instance.
The instance where a signal handler is sought.
the handler id.
Undoes the effect of a previous g_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.
The instance to unblock the signal handler of.
Handler id of the handler to be unblocked.
Blocks all handlers on an instance that match a certain selection criteria.
The criteria mask is passed as an OR-ed combination of #GSignalMatchType
flags, and the criteria values are passed as arguments.
Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
or %G_SIGNAL_MATCH_DATA match flags is required for successful matches.
If no handlers were found, 0 is returned, the number of blocked handlers
otherwise.
The number of handlers that matched.
The instance to block handlers from.
Mask indicating which of @signal_id, @detail, @closure, @func and/or @data the handlers have to match.
Signal the handlers have to be connected to.
Signal detail the handlers have to be connected to.
The closure the handlers will invoke.
The C closure callback of the handlers (useless for non-C closures).
The closure data of the handlers' closures.
Disconnects all handlers on an instance that match a certain
selection criteria. The criteria mask is passed as an OR-ed
combination of #GSignalMatchType flags, and the criteria values are
passed as arguments. Passing at least one of the
%G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC or
%G_SIGNAL_MATCH_DATA match flags is required for successful
matches. If no handlers were found, 0 is returned, the number of
disconnected handlers otherwise.
The number of handlers that matched.
The instance to remove handlers from.
Mask indicating which of @signal_id, @detail, @closure, @func and/or @data the handlers have to match.
Signal the handlers have to be connected to.
Signal detail the handlers have to be connected to.
The closure the handlers will invoke.
The C closure callback of the handlers (useless for non-C closures).
The closure data of the handlers' closures.
Unblocks all handlers on an instance that match a certain selection
criteria. The criteria mask is passed as an OR-ed combination of
#GSignalMatchType flags, and the criteria values are passed as arguments.
Passing at least one of the %G_SIGNAL_MATCH_CLOSURE, %G_SIGNAL_MATCH_FUNC
or %G_SIGNAL_MATCH_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.
The number of handlers that matched.
The instance to unblock handlers from.
Mask indicating which of @signal_id, @detail, @closure, @func and/or @data the handlers have to match.
Signal the handlers have to be connected to.
Signal detail the handlers have to be connected to.
The closure the handlers will invoke.
The C closure callback of the handlers (useless for non-C closures).
The closure data of the handlers' closures.
Returns whether there are any handlers connected to @instance for the
given signal id and detail.
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.
otherwise.
%TRUE if a handler is connected to the signal, %FALSE
the object whose signal handlers are sought.
the signal id.
the detail.
whether blocked handlers should count as match.
Lists the signals by id that a certain instance or interface type
created. Further information about the signals can be acquired through
g_signal_query().
Newly allocated array of signal IDs.
Instance or interface type.
Location to store the number of signal ids for @itype.
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.
See g_signal_new() for details on allowed signal names.
the signal's identifying number, or 0 if no signal was found.
the signal's name.
the type that the signal operates on.
Given the signal's identifier, finds its name.
Two different signals may have the same name, if they have differing types.
the signal name, or %NULL if the signal number was invalid.
the signal's identifying number.
Creates a new signal. (This is usually done in the class initializer.)
A signal name consists of segments consisting of ASCII letters and
digits, separated by either the '-' or '_' character. The first
character of a signal name must be a letter. Names which violate these
rules lead to undefined behaviour of the GSignal system.
When registering a signal and looking up a signal, either separator can
be used, but they cannot be mixed.
If 0 is used for @class_offset subclasses cannot override the class handler
in their <code>class_init</code> method by doing
<code>super_class->signal_handler = my_signal_handler</code>. Instead they
will have to use g_signal_override_class_handler().
the signal id
the name for the signal
the type this signal pertains to. It will also pertain to types which are derived from this type.
a combination of #GSignalFlags specifying detail of when the default handler is to be invoked. You should at least specify %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
The offset of the function pointer in the class structure for this type. Used to invoke a class method generically. Pass 0 to not associate a class method slot with this signal.
the accumulator for this signal; may be %NULL.
user data for the @accumulator.
the function to translate arrays of parameter values to signal emissions into C language callback invocations.
the type of return value, or #G_TYPE_NONE for a signal without a return value.
the number of parameter types to follow.
Creates a new signal. (This is usually done in the class initializer.)
This is a variant of g_signal_new() that takes a C callback instead
off a class offset for the signal's class handler. This function
doesn't need a function pointer exposed in the class structure of
an object definition, instead the function pointer is passed
directly and can be overriden by derived classes with
g_signal_override_class_closure() or
g_signal_override_class_handler()and chained to with
g_signal_chain_from_overridden() or
g_signal_chain_from_overridden_handler().
See g_signal_new() for information about signal names.
the signal id
the name for the signal
the type this signal pertains to. It will also pertain to types which are derived from this type.
a combination of #GSignalFlags specifying detail of when the default handler is to be invoked. You should at least specify %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
a #GCallback which acts as class implementation of this signal. Used to invoke a class method generically. Pass %NULL to not associate a class method with this signal.
the accumulator for this signal; may be %NULL.
user data for the @accumulator.
the function to translate arrays of parameter values to signal emissions into C language callback invocations.
the type of return value, or #G_TYPE_NONE for a signal without a return value.
the number of parameter types to follow.
Creates a new signal. (This is usually done in the class initializer.)
See g_signal_new() for details on allowed signal names.
the signal id
the name for the signal
the type this signal pertains to. It will also pertain to types which are derived from this type.
a combination of #GSignalFlags specifying detail of when the default handler is to be invoked. You should at least specify %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST.
The closure to invoke on signal emission; may be %NULL.
the accumulator for this signal; may be %NULL.
user data for the @accumulator.
the function to translate arrays of parameter values to signal emissions into C language callback invocations.
the type of return value, or #G_TYPE_NONE for a signal without a return value.
the number of parameter types in @args.
va_list of #GType, one for each parameter.
Creates a new signal. (This is usually done in the class initializer.)
See g_signal_new() for details on allowed signal names.
the signal id
the name for the signal
the type this signal pertains to. It will also pertain to types which are derived from this type
a combination of #GSignalFlags specifying detail of when the default handler is to be invoked. You should at least specify %G_SIGNAL_RUN_FIRST or %G_SIGNAL_RUN_LAST
The closure to invoke on signal emission; may be %NULL
the accumulator for this signal; may be %NULL
user data for the @accumulator
the function to translate arrays of parameter values to signal emissions into C language callback invocations
the type of return value, or #G_TYPE_NONE for a signal without a return value
the length of @param_types
an array of types, one for each parameter
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 g_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.
the signal id
the instance type on which to override the class closure for the signal.
the closure.
Overrides the class closure (i.e. the default handler) for the
given signal for emissions on instances of @instance_type with
callabck @class_handler. @instance_type must be derived from the
type to which the signal belongs.
See g_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.
the name for the signal
the instance type on which to override the class handler for the signal.
the handler.
Internal function to parse a signal name into its @signal_id
and @detail quark.
Whether the signal name could successfully be parsed and @signal_id_p and @detail_p contain valid return values.
a string of the form "signal-name::detail".
The interface/instance type that introduced "signal-name".
Location to store the signal id.
Location to store the detail quark.
%TRUE forces creation of a #GQuark for the detail.
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 #GSignalQuery
is 0. All members filled into the #GSignalQuery structure should
be considered constant and have to be left untouched.
The signal id of the signal to query information for.
A user provided structure that is filled in with constant values upon success.
Deletes an emission hook.
the id of the signal
the id of the emission hook, as returned by g_signal_add_emission_hook()
Stops a signal's current emission.
This will prevent the default method from running, if the signal was
%G_SIGNAL_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.
the object whose signal handlers you wish to stop.
the signal identifier, as returned by g_signal_lookup().
the detail which the signal was emitted with.
Stops a signal's current emission.
This is just like g_signal_stop_emission() except it will look up the
signal id for you.
the object whose signal handlers you wish to stop.
a string of the form "signal-name::detail".
Creates a new closure which invokes the function found at the offset
identified by @itype.
a new #GCClosure
the #GType identifier of an interface or classed type
the offset of the member function of @itype's class structure which is to be invoked by the new closure
Set the callback for a source as a #GClosure.
If the source is not one of the standard GLib types, the @closure_callback
and @closure_marshal fields of the #GSourceFuncs structure must have been
filled in with pointers to appropriate functions.
the source
a #GClosure
Return a newly allocated string, which describes the contents of a
#GValue. The main purpose of this function is to describe #GValue
contents for debugging output, the way in which the contents are
described may change between different GLib versions.
Newly allocated string.
#GValue which contents are to be described.
Adds a #GTypeClassCacheFunc to be called before the reference count of a
class goes from one to zero. This can be used to prevent premature class
destruction. All installed #GTypeClassCacheFunc functions will be chained
until one of them returns %TRUE. The functions have to check the class id
passed in to figure whether they actually want to cache the class of this
type, since all classes are routed through the same #GTypeClassCacheFunc
chain.
data to be passed to @cache_func
a #GTypeClassCacheFunc
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. 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.
GType of an classed type.
size of private structure.
Adds a function to be called after an interface vtable is
initialized for any class (i.e. after the @interface_init member of
#GInterfaceInfo has been called).
This function is useful when you want to check an invariant that
depends on the interfaces of a class. For instance, the
implementation of #GObject uses this facility to check that an
object implements all of the properties that are defined on its
interfaces.
data to pass to @check_func
function to be called after each interface is initialized.
Adds the dynamic @interface_type to @instantiable_type. The information
contained in the #GTypePlugin structure pointed to by @plugin
is used to manage the relationship.
the #GType value of an instantiable type.
the #GType value of an interface type.
the #GTypePlugin structure to retrieve the #GInterfaceInfo from.
Adds the static @interface_type to @instantiable_type. The information
contained in the #GTypeInterfaceInfo structure pointed to by @info
is used to manage the relationship.
#GType value of an instantiable type.
#GType value of an interface type.
The #GInterfaceInfo structure for this (@instance_type, @interface_type) combination.
Private helper function to aid implementation of the G_TYPE_CHECK_INSTANCE()
macro.
A valid #GTypeInstance structure.
Return a newly allocated and 0-terminated array of type IDs, listing the
child types of @type. The return value has to be g_free()ed after use.
Newly allocated and 0-terminated array of child types.
The parent type.
Optional #guint pointer to contain the number of child types.
Registers a private structure for an instantiatable type.
When an object is allocated, the private structures for
the type and all of its parent types are allocated
sequentially in the same memory block as the public
structures.
Note that the accumulated size of the private structures of
a type and all its parent types cannot excced 64kB.
This function should be called in the type's class_init() function.
The private structure can be retrieved using the
G_TYPE_INSTANCE_GET_PRIVATE() macro.
The following example shows attaching a private structure
<structname>MyObjectPrivate</structname> to an object
<structname>MyObject</structname> defined in the standard GObject
fashion.
type's class_init() function.
|[
typedef struct _MyObject MyObject;
typedef struct _MyObjectPrivate MyObjectPrivate;
struct _MyObject {
GObject parent;
MyObjectPrivate *priv;
};
struct _MyObjectPrivate {
int some_field;
};
static void
my_object_class_init (MyObjectClass *klass)
{
g_type_class_add_private (klass, sizeof (MyObjectPrivate));
}
static void
my_object_init (MyObject *my_object)
{
my_object->priv = G_TYPE_INSTANCE_GET_PRIVATE (my_object,
MY_TYPE_OBJECT,
MyObjectPrivate);
}
static int
my_object_get_some_field (MyObject *my_object)
{
MyObjectPrivate *priv = my_object->priv;
return priv->some_field;
}
]|
class structure for an instantiatable type
size of private structure.
This function is essentially the same as g_type_class_ref(), except that
the classes reference count isn't incremented. As a consequence, this function
may return %NULL if the class of the type passed in does not currently
exist (hasn't been referenced before).
if the class does not currently exist.
The #GTypeClass structure for the given type ID or %NULL
Type ID of a classed type.
This is a convenience function often needed in class initializers.
It returns the class structure of the immediate parent type of the
class passed in. Since derived classes hold a reference count on
their parent classes as long as they are instantiated, the returned
class will always exist. This function is essentially equivalent
to:
<programlisting>
g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (g_class)));
</programlisting>
The parent class of @g_class.
The #GTypeClass structure to retrieve the parent class for.
A more efficient version of g_type_class_peek() which works only for
static types.
if the class does not currently exist or is dynamically loaded.
The #GTypeClass structure for the given type ID or %NULL
Type ID of a classed type.
Increments the reference count of the class structure belonging to
exist already.
The #GTypeClass structure for the given type ID.
Type ID of a classed type.
Decrements the reference count of the class structure being passed in.
Once the last reference count of a class has been released, classes
may be finalized by the type system, so further dereferencing of a
class pointer after g_type_class_unref() are invalid.
The #GTypeClass structure to unreference.
A variant of g_type_class_unref() for use in #GTypeClassCacheFunc
implementations. It unreferences a class without consulting the chain
of #GTypeClassCacheFunc<!-- -->s, avoiding the recursion which would occur
otherwise.
The #GTypeClass structure to unreference.
Creates and initializes an instance of @type if @type is valid and
can be instantiated. The type system only performs basic allocation
happen through functions supplied by the type's fundamental type
implementation. So use of g_type_create_instance() is reserved for
implementators of fundamental types only. E.g. instances of the
#GObject hierarchy should be created via g_object_new() and
<emphasis>never</emphasis> directly through
g_type_create_instance() which doesn't handle things like singleton
use this function, unless you're implementing a fundamental
type. Also language bindings should <emphasis>not</emphasis> use
this function but g_object_new() instead.
treatment by the fundamental type implementation.
An allocated and initialized instance, subject to further
An instantiatable type to create an instance for.
If the interface type @g_type is currently in use, returns its
default interface vtable.
if the type is not currently in use.
the default vtable for the interface, or %NULL
an interface type
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 initalized by calling
the base interface init and default vtable init functions for
the type (the @<structfield>base_init</structfield>
and <structfield>class_init</structfield> members of #GTypeInfo).
Calling g_type_default_interface_ref() is useful when you
want to make sure that signals and properties for an interface
have been installed.
g_type_default_interface_unref() when you are done using
the interface.
the default vtable for the interface; call
an interface type
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 <structfield>class_finalize</structfield> member of
#GTypeInfo) will be called.
the default vtable structure for a interface, as returned by g_type_default_interface_ref()
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.
The depth of @type.
A #GType value.
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.
an instance of a type.
Lookup 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).
Corresponding type ID or 0.
Type name to lookup.
Internal function, used to extract the fundamental type ID portion.
use G_TYPE_FUNDAMENTAL() instead.
fundamental type ID
valid type ID
Returns the next free fundamental type id which can be used to
register a new fundamental type with g_type_register_fundamental().
The returned type ID represents the highest currently registered
fundamental type identifier.
or 0 if the type system ran out of fundamental type IDs.
The nextmost fundamental type ID to be registered,
Returns the #GTypePlugin structure for @type or
%NULL if @type does not have a #GTypePlugin structure.
%NULL otherwise.
The corresponding plugin if @type is a dynamic type,
The #GType to retrieve the plugin for.
Obtains data which has previously been attached to @type
with g_type_set_qdata().
the data, or %NULL if no data was found
a #GType
a #GQuark id to identify the data
Prior to any use of the type system, g_type_init() has to be called
to initialize the type system and assorted other code portions
(such as the various fundamental type implementations or the signal
system).
Since version 2.24 this also initializes the thread system
Similar to g_type_init(), but additionally sets debug flags.
Bitwise combination of #GTypeDebugFlags values for debugging purposes.
Adds @prerequisite_type to the list of prerequisites of @interface_type.
This means that any type implementing @interface_type must also implement
interface derivation (which GType doesn't support). An interface can have
at most one instantiatable prerequisite type.
#GType value of an interface type.
#GType value of an interface or instantiatable type.
Returns the #GTypePlugin structure for the dynamic interface
have a #GTypePlugin structure. See g_type_add_interface_dynamic().
of @instance_type.
the #GTypePlugin for the dynamic interface @interface_type
the #GType value of an instantiatable type.
the #GType value of an interface type.
Returns the #GTypeInterface structure of an interface to which the
passed in class conforms.
by @instance_class, %NULL otherwise
The GTypeInterface structure of iface_type if implemented
A #GTypeClass structure.
An interface ID which this class conforms to.
Returns the corresponding #GTypeInterface structure of the parent type
of the instance type to which @g_iface belongs. This is useful when
deriving the implementation of an interface from the parent type and
then possibly overriding some methods.
type of the instance type to which @g_iface belongs, or
%NULL if the parent type doesn't conform to the interface.
The corresponding #GTypeInterface structure of the parent
A #GTypeInterface structure.
Returns the prerequisites of an interfaces type.
the prerequisites of @interface_type
a newly-allocated zero-terminated array of #GType containing
an interface type
location to return the number of prerequisites, or %NULL
Return a newly allocated and 0-terminated array of type IDs, listing the
interface types that @type conforms to. The return value has to be
g_free()ed after use.
Newly allocated and 0-terminated array of interface types.
The type to list interface types for.
Optional #guint pointer to contain the number of interface types.
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.
%TRUE if @type is_a @is_a_type holds true.
Type to check anchestry for.
Possible anchestor of @type or interface @type could conform to.
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.
Static type name or %NULL.
Type to return name for.
Given a @leaf_type and a @root_type which is contained in its
anchestry, 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
be used to determine the types and order in which the leaf type is
descended from the root type.
Immediate child of @root_type and anchestor of @leaf_type.
Descendant of @root_type and the type to be returned.
Immediate parent of the returned type.
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.
The parent type.
The derived type.
Get the corresponding quark of the type IDs name.
The type names quark or 0.
Type to return quark of type name for.
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
#GTypeQuery structure should be considered constant and have to be
left untouched.
the #GType value of a static, classed type.
A user provided structure that is filled in with constant values upon success.
Registers @type_name as the name of a new dynamic type derived from
#GTypePlugin 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.
The new type identifier or #G_TYPE_INVALID if registration failed.
Type from which this type will be derived.
0-terminated string used as the name of the new type.
The #GTypePlugin structure to retrieve the #GTypeInfo from.
Bitwise combination of #GTypeFlags values.
Registers @type_id as the predefined identifier and @type_name as the
name of a fundamental type. The type system uses the information
contained in the #GTypeInfo structure pointed to by @info and the
#GTypeFundamentalInfo structure pointed to by @finfo to manage the
type and its instances. The value of @flags determines additional
characteristics of the fundamental type.
The predefined type identifier.
A predefined type identifier.
0-terminated string used as the name of the new type.
The #GTypeInfo structure for this type.
The #GTypeFundamentalInfo structure for this type.
Bitwise combination of #GTypeFlags values.
Registers @type_name as the name of a new static type derived from
#GTypeInfo 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.
The new type identifier.
Type from which this type will be derived.
0-terminated string used as the name of the new type.
The #GTypeInfo structure for this type.
Bitwise combination of #GTypeFlags values.
Registers @type_name as the name of a new static type derived from
abstract or not) of the type. It works by filling a #GTypeInfo
struct and calling g_type_register_static().
The new type identifier.
Type from which this type will be derived.
0-terminated string used as the name of the new type.
Size of the class structure (see #GTypeInfo)
Location of the class initialization function (see #GTypeInfo)
Size of the instance structure (see #GTypeInfo)
Location of the instance initialization function (see #GTypeInfo)
Bitwise combination of #GTypeFlags values.
Removes a previously installed #GTypeClassCacheFunc. The cache
maintained by @cache_func has to be empty when calling
g_type_remove_class_cache_func() to avoid leaks.
data that was given when adding @cache_func
a #GTypeClassCacheFunc
Removes an interface check function added with
g_type_add_interface_check().
callback data passed to g_type_add_interface_check()
callback function passed to g_type_add_interface_check()
Attaches arbitrary data to a type.
a #GType
a #GQuark id to identify the data
the data
Returns the location of the #GTypeValueTable associated with @type.
<emphasis>Note that this function should only be used from source code
that implements or has internal knowledge of the implementation of
%NULL if there is no #GTypeValueTable associated with @type.
Location of the #GTypeValueTable associated with @type or
A #GType value.
Registers a value transformation function for use in g_value_transform().
A previously registered transformation function for @src_type and @dest_type
will be replaced.
Source type.
Target type.
a function which transforms values of type @src_type into value of type @dest_type
Returns whether a #GValue of type @src_type can be copied into
a #GValue of type @dest_type.
%TRUE if g_value_copy() is possible with @src_type and @dest_type.
source type to be copied.
destination type for copying.
Check whether g_value_transform() is able to transform values
of type @src_type into values of type @dest_type.
%TRUE if the transformation is possible, %FALSE otherwise.
Source type.
Target type.