Details
struct GHookList
struct GHookList
{
gulong seq_id;
guint hook_size : 16;
guint is_setup : 1;
GHook *hooks;
GMemChunk *hook_memchunk;
GHookFinalizeFunc finalize_hook;
gpointer dummy[2];
};
|
The GHookList struct represents a
list of hook functions.
GHookFinalizeFunc ()
Defines the type of function to be called when a hook in a
list of hooks gets finalized.
struct GHook
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.
GHookFunc ()
Defines the type of a hook function that can be invoked
by g_hook_list_invoke().
g_hook_list_init ()
Initializes a GHookList.
This must be called before the GHookList is used.
g_hook_list_invoke ()
Calls all of the GHook functions in a GHookList.
g_hook_list_invoke_check ()
Calls all of the GHook functions in a GHookList.
Any function which returns TRUE is removed from the GHookList.
g_hook_list_marshal ()
Calls a function on each valid GHook.
g_hook_list_marshal_check ()
Calls a function on each valid GHook and destroys it if the
function returns FALSE.
g_hook_list_clear ()
void g_hook_list_clear (GHookList *hook_list); |
Removes all the GHook elements from a GHookList.
g_hook_alloc ()
Allocates space for a GHook and initializes it.
g_hook_append()
#define g_hook_append( hook_list, hook ) |
Appends a GHook onto the end of a GHookList.
g_hook_insert_sorted ()
Inserts a GHook into a GHookList, sorted by the given function.
g_hook_compare_ids ()
Compares the ids of two GHook elements, returning a negative value
if the second id is greater than the first.
g_hook_get ()
Returns the GHook with the given id, or NULL if it is not found.
g_hook_find ()
Finds a GHook in a GHookList using the given function to test for a match.
GHookFindFunc ()
Defines the type of the function passed to g_hook_find().
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_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.)
enum GHookFlagMask
typedef enum
{
G_HOOK_FLAG_ACTIVE = 1 << 0,
G_HOOK_FLAG_IN_CALL = 1 << 1,
G_HOOK_FLAG_MASK = 0x0f
} GHookFlagMask;
|
Flags used internally in the GHook implementation.
G_HOOK_FLAGS()
#define G_HOOK_FLAGS(hook) (G_HOOK (hook)->flags)
|
Returns the flags of a hook.
G_HOOK_FLAG_USER_SHIFT
#define G_HOOK_FLAG_USER_SHIFT (4)
|
The position of the first bit which is not reserved for internal
use be the GHook implementation, i.e.
1 << G_HOOK_FLAG_USER_SHIFT is the first bit
which can be used for application-defined flags.
G_HOOK()
#define G_HOOK(hook) ((GHook*) (hook))
|
Casts a pointer to a GHook*.
G_HOOK_IS_VALID()
#define G_HOOK_IS_VALID(hook) |
Returns TRUE if the GHook is valid, i.e. it is in a GHookList, it is active
and it has not been destroyed.
G_HOOK_ACTIVE()
#define G_HOOK_ACTIVE(hook) |
Returns TRUE if the GHook is active, which is normally TRUE until the GHook
is destroyed.
G_HOOK_IN_CALL()
#define G_HOOK_IN_CALL(hook) |
Returns TRUE if the GHook function is currently executing.
G_HOOK_IS_UNLINKED()
#define G_HOOK_IS_UNLINKED(hook) |
Returns TRUE if the GHook is not in 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.
g_hook_free ()
Calls the GHookList hook_free function if it exists, and frees the memory
allocated for the GHook.
g_hook_destroy ()
Destroys a GHook, given its ID.