GLib.Hook - Structures - GLib 2.0 (original) (raw)
Fields¶
Name | Type | Access | Description |
---|---|---|---|
data | object | r/w | data which is passed to func when this hook is invoked |
destroy | GLib.DestroyNotify | r/w | the default finalize_hook function of a GLib.HookList calls this member of the hook that is being finalized |
flags | int | r/w | flags which are set for this hook. See GLib.HookFlagMask for predefined flags |
func | object | r/w | the function to call when this hook is invoked. The possible signatures for this function are GLib.HookFunc and GLib.HookCheckFunc |
hook_id | int | r/w | the id of this hook, which is unique within its list |
next | GLib.Hook | r/w | pointer to the next hook in the list |
prev | GLib.Hook | r/w | pointer to the previous hook in the list |
ref_count | int | r/w | the reference count of this hook |
Methods¶
class | destroy_link (hook_list, hook) |
---|---|
class | free (hook_list, hook) |
class | insert_before (hook_list, sibling, hook) |
class | insert_sorted (hook_list, hook, func) |
class | prepend (hook_list, hook) |
class | unref (hook_list, hook) |
compare_ids (sibling) |
Details¶
class GLib.Hook¶
The GLib.Hook struct represents a single hook function in a GLib.HookList.
classmethod destroy_link(hook_list, hook)[source]¶
Parameters:
- hook_list (GLib.HookList) – a GLib.HookList
- hook (GLib.Hook) – the GLib.Hook to remove
Removes one GLib.Hook from a GLib.HookList, marking it inactive and calling GLib.Hook.unref() on it.
classmethod free(hook_list, hook)[source]¶
Parameters:
- hook_list (GLib.HookList) – a GLib.HookList
- hook (GLib.Hook) – the GLib.Hook to free
Calls the GLib.HookList finalize_hook function if it exists, and frees the memory allocated for the GLib.Hook.
classmethod insert_before(hook_list, sibling, hook)[source]¶
Parameters:
- hook_list (GLib.HookList) – a GLib.HookList
- sibling (GLib.Hook or None) – the GLib.Hook to insert the new GLib.Hook before
- hook (GLib.Hook) – the GLib.Hook to insert
Inserts a GLib.Hook into a GLib.HookList, before a given GLib.Hook.
classmethod insert_sorted(hook_list, hook, func)[source]¶
Parameters:
- hook_list (GLib.HookList) – a GLib.HookList
- hook (GLib.Hook) – the GLib.Hook to insert
- func (GLib.HookCompareFunc) – the comparison function used to sort the GLib.Hook elements
Inserts a GLib.Hook into a GLib.HookList, sorted by the given function.
classmethod prepend(hook_list, hook)[source]¶
Parameters:
- hook_list (GLib.HookList) – a GLib.HookList
- hook (GLib.Hook) – the GLib.Hook to add to the start of hook_list
Prepends a GLib.Hook on the start of a GLib.HookList.
classmethod unref(hook_list, hook)[source]¶
Parameters:
- hook_list (GLib.HookList) – a GLib.HookList
- hook (GLib.Hook) – the GLib.Hook to unref
Decrements the reference count of a GLib.Hook. If the reference count falls to 0, the GLib.Hook is removed from the GLib.HookList and GLib.Hook.free() is called to free it.
Parameters:
sibling (GLib.Hook) – a GLib.Hook to compare with self
Returns:
a value <= 0 if the id of sibling is >= the id of self
Return type:
Compares the ids of two GLib.Hook elements, returning a negative value if the second id is greater than the first.