Struct
GLibHook
Description
struct GHook {
gpointer data;
GHook* next;
GHook* prev;
guint ref_count;
gulong hook_id;
guint flags;
gpointer func;
GDestroyNotify destroy;
}
The GHook
struct represents a single hook function in a GHookList
.
Structure members
data |
Data which is passed to func when this hook is invoked. |
next |
Pointer to the next hook in the list. |
prev |
Pointer to the previous hook in the list. |
ref_count |
The reference count of this hook. |
hook_id |
The id of this hook, which is unique within its list. |
flags |
Flags which are set for this hook. See |
func |
The function to call when this hook is invoked. The possible
signatures for this function are |
destroy |
The default |
Functions
g_hook_alloc
Allocates space for a GHook
and initializes it.
g_hook_destroy
Destroys a GHook
, given its ID.
g_hook_destroy_link
Removes one GHook
from a GHookList
, marking it
inactive and calling g_hook_unref()
on it.
g_hook_find
Finds a GHook
in a GHookList
using the given function to
test for a match.
g_hook_find_data
Finds a GHook
in a GHookList
with the given data.
g_hook_find_func
Finds a GHook
in a GHookList
with the given function.
g_hook_find_func_data
Finds a GHook
in a GHookList
with the given function and data.
g_hook_first_valid
Returns the first GHook
in a GHookList
which has not been destroyed.
The reference count for the GHook
is incremented, so you must call
g_hook_unref()
to restore it when no longer needed. (Or call
g_hook_next_valid()
if you are stepping through the GHookList
.)
g_hook_free
Calls the GHookList
finalize_hook
function if it exists,
and frees the memory allocated for the GHook
.
g_hook_get
Returns the GHook
with the given id, or NULL
if it is not found.
g_hook_insert_before
Inserts a GHook
into a GHookList
, before a given GHook
.
g_hook_insert_sorted
Inserts a GHook
into a GHookList
, sorted by the given function.
g_hook_next_valid
Returns the next GHook
in a GHookList
which has not been destroyed.
The reference count for the GHook
is incremented, so you must call
g_hook_unref()
to restore it when no longer needed. (Or continue to call
g_hook_next_valid()
until NULL
is returned.)
g_hook_prepend
Prepends a GHook
on the start of a GHookList
.
g_hook_ref
Increments the reference count for a GHook
.
g_hook_unref
Decrements the reference count of a GHook
.
If the reference count falls to 0, the GHook
is removed
from the GHookList
and g_hook_free()
is called to free it.
Instance methods
g_hook_compare_ids
Compares the ids of two GHook
elements, returning a negative value
if the second id is greater than the first.