Back to Seed Clases

GObject


Classes

Interfaces

Structs

Unions

Enums

Struct GObject.Closure

Import line: GObject = imports.gi.GObject;
GIR File: GObject-2.0.gir
C documentation: GClosure
Struct : Closure
A GClosure represents a callback supplied by the programmer. It
will generally comprise a function of some kind and a marshaller
used to call it. It is the reponsibility of the marshaller to
convert the arguments for the invocation from GValues into
a suitable form, perform the callback on the converted arguments,
and transform the return value back into a GValue.
In the case of C programs, a closure usually just holds a pointer
to a function and maybe a data argument, and the marshaller
converts between GValue and native C types. The GObject
library provides the GCClosure type for this purpose. Bindings for
other languages need marshallers which convert between GValues and suitable representations in the runtime of the language in
order to use functions written in that languages as callbacks.
Within GObject, closures play an important role in the
implementation of signals. When a signal is registered, the
marshaller for any closure which is connected to this
signal. GObject provides a number of C marshallers for this
purpose, see the g_cclosure_marshal_*() functions. Additional C
marshallers can be generated with the linkend="glib-genmarshal">glib-genmarshal utility. Closures
can be explicitly connected to signals with
g_signal_connect_closure(), but it usually more convenient to let
GObject create a closure automatically by using one of the
g_signal_connect_*() functions which take a callback function/user
data pair.
Using closures has a number of important advantages over a simple
callback function/data pointer combination:


Closures allow the callee to get the types of the callback parameters,
which means that language bindings don't have to write individual glue
for each callback type.


The reference counting of GClosure makes it easy to handle reentrancy
right; if a callback is removed while it is being invoked, the closure
and its parameters won't be freed until the invocation finishes.


g_closure_invalidate() and invalidation notifiers allow callbacks to be
automatically removed when the objects they point to go away.

Properties
Properties Defined By
Methods / Constructors
Method / Constructor Defined By
 
new GObject.Closure ()
Create a new GObject.Closure
Create a new GObject.Closure
 
Events
None
Used by These Methods / Signals / Properties
Class / Namespace Method / Signal / Properties
Clutter.Alpha
Method
Clutter.Alpha.register_func (Closure closure) : guint32
Registers a global alpha function and returns its logical id
to be used by clutter_alpha_set_mode() or by ClutterAnimation.
Clutter.Alpha
Method
set_closure (Closure closure) : none
Sets the GClosure used to compute the alpha value at each
frame of the ClutterTimeline bound to alpha.
Clutter.BindingPool
Method
install_closure (String action_name, guint32 key_val, ModifierType modifiers, Closure closure) : none
A GClosure variant of clutter_binding_pool_install_action().
Clutter.BindingPool
Method
override_closure (guint32 key_val, ModifierType modifiers, Closure closure) : none
A GClosure variant of clutter_binding_pool_override_action().
GObject
Method
GObject.cclosure_marshal_BOOLEAN__BOXED_BOXED (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
GObject
Method
GObject.cclosure_marshal_BOOLEAN__FLAGS (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
gboolean (*callback) (gpointer instance, gint arg1, gpointer user_data) where the gint parameter
denotes a flags type.
GObject
Method
GObject.cclosure_marshal_STRING__OBJECT_POINTER (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
gchar* (*callback) (gpointer instance, GObject *arg1, gpointer arg2, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__BOOLEAN (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, gboolean arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__BOXED (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, GBoxed *arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__CHAR (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, gchar arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__DOUBLE (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, gdouble arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__ENUM (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, gint arg1, gpointer user_data) where the gint parameter denotes an enumeration type.
GObject
Method
GObject.cclosure_marshal_VOID__FLAGS (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, gint arg1, gpointer user_data) where the gint parameter denotes a flags type.
GObject
Method
GObject.cclosure_marshal_VOID__FLOAT (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, gfloat arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__INT (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, gint arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__LONG (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, glong arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__OBJECT (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, GObject *arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__PARAM (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, GParamSpec *arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__POINTER (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, gpointer arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__STRING (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, const gchar *arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__UCHAR (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, guchar arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__UINT (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, guint arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__UINT_POINTER (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, guint arg1, gpointer arg2, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__ULONG (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, gulong arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__VARIANT (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, GVariant *arg1, gpointer user_data).
GObject
Method
GObject.cclosure_marshal_VOID__VOID (Closure closure, Value return_value, guint32 n_param_values, Value param_values, void* invocation_hint, void* marshal_data) : none
A marshaller for a GCClosure with a callback of type
void (*callback) (gpointer instance, gpointer user_data).
GObject
Method
GObject.signal_connect_closure (void* instance, String detailed_signal, Closure closure, gboolean after) : guint32
Connects a closure to a signal for a particular object.
GObject
Method
GObject.signal_connect_closure_by_id (void* instance, guint32 signal_id, guint32 detail, Closure closure, gboolean after) : guint32
Connects a closure to a signal for a particular object.
GObject
Method
GObject.signal_handler_find (void* instance, SignalMatchType mask, guint32 signal_id, guint32 detail, Closure closure, void* func, void* data) : guint32
Finds the first signal handler that matches certain selection criteria.
GObject
Method
GObject.signal_handlers_block_matched (void* instance, SignalMatchType mask, guint32 signal_id, guint32 detail, Closure closure, void* func, void* data) : guint32
Blocks all handlers on an instance that match a certain selection criteria.
GObject
Method
GObject.signal_handlers_disconnect_matched (void* instance, SignalMatchType mask, guint32 signal_id, guint32 detail, Closure closure, void* func, void* data) : guint32
Disconnects all handlers on an instance that match a certain
selection criteria.
GObject
Method
GObject.signal_handlers_unblock_matched (void* instance, SignalMatchType mask, guint32 signal_id, guint32 detail, Closure closure, void* func, void* data) : guint32
Unblocks all handlers on an instance that match a certain selection
criteria.
GObject
Method
GObject.signal_override_class_closure (guint32 signal_id, Number instance_type, Closure class_closure) : none
Overrides the class closure (i.e.
GObject
Method
GObject.signal_type_cclosure_new (Number itype, guint32 struct_offset) : GObject.Closure
Creates a new closure which invokes the function found at the offset
identified by itype.
GObject
Method
GObject.source_set_closure (Source source, Closure closure) : none
Set the callback for a source as a GClosure.
GObject.InitiallyUnowned
Method
GObject.InitiallyUnowned.bind_property_full (void* source, String source_property, void* target, String target_property, BindingFlags flags, Closure transform_to, Closure transform_from) : GObject.Binding
Complete version of g_object_bind_property().
Gio
Method
Gio.bus_own_name_on_connection (DBusConnection connection, String name, BusNameOwnerFlags flags, Closure name_acquired_closure, Closure name_lost_closure) : guint32
Like g_bus_own_name() but takes a GDBusConnection instead of a
GBusType.
Gio
Method
Gio.bus_own_name (BusType bus_type, String name, BusNameOwnerFlags flags, Closure bus_acquired_closure, Closure name_acquired_closure, Closure name_lost_closure) : guint32
Starts acquiring name on the bus specified by bus_type and calls
acquired respectively lost.
Gio
Method
Gio.bus_watch_name_on_connection (DBusConnection connection, String name, BusNameWatcherFlags flags, Closure name_appeared_closure, Closure name_vanished_closure) : guint32
Like g_bus_watch_name() but takes a GDBusConnection instead of a
GBusType.
Gio
Method
Gio.bus_watch_name (BusType bus_type, String name, BusNameWatcherFlags flags, Closure name_appeared_closure, Closure name_vanished_closure) : guint32
Starts watching name on the bus specified by bus_type and calls
known to have a owner respectively known to lose its
owner.
Gtk.AccelGroup
Method
Gtk.AccelGroup.from_accel_closure (Closure closure) : Gtk.AccelGroup
Finds the GtkAccelGroup to which closure is connected;
see gtk_accel_group_connect().
Gtk.AccelGroup
Method
connect (guint32 accel_key, ModifierType accel_mods, AccelFlags accel_flags, Closure closure) : none
Installs an accelerator in this group.
Gtk.AccelGroup
Method
connect_by_path (String accel_path, Closure closure) : none
Installs an accelerator in this group, using an accelerator path to look
up the appropriate key and modifiers (see gtk_accel_map_add_entry()).
Gtk.AccelGroup
Method
disconnect (Closure closure) : gboolean
Removes an accelerator previously installed through
gtk_accel_group_connect().
Gtk.AccelLabel
Property
accel_closure : GObject.Closure
Gtk.AccelLabel
Method
set_accel_closure (Closure accel_closure) : none
Sets the closure to be monitored by this accelerator label.
Gtk.Action
Method
get_accel_closure () : GObject.Closure
Returns the accel closure for this action.
Nautilus
Method
Nautilus.info_provider_update_complete_invoke (Closure update_complete, InfoProvider provider, OperationHandle handle, OperationResult result) : none
Nautilus.InfoProvider
Method
update_file_info (FileInfo file, Closure update_complete, OperationHandle handle) : Nautilus.OperationResult
Documentation generated by Introspection Doc Generator Loosely Based on JsDoc Toolkit on Sat Apr 16 2011 17:10:43 GMT+0800 (HKT)