Hook Functions support for manipulating lists of hook functions. The #GHookList, #GHook and their related functions provide support for lists of hook functions. Functions can be added and removed from the lists, and the list of hook functions can be invoked. The GHookList struct represents a list of hook functions. @seq_id: the next free #GHook id. @hook_size: the size of the #GHookList elements, in bytes. @is_setup: 1 if the #GHookList has been initialized. @hooks: the first #GHook element in the list. @hook_memchunk: the #GMemChunk used for allocating the #GHook elements. @finalize_hook: the function to call to finalize a #GHook element. The default behaviour is to call the hooks destroy function. @dummy: Defines the type of function to be called when a hook in a list of hooks gets finalized. @hook_list: a #GHookList. @hook: the hook in @hook_list that gets finalized. The GHook struct represents a single hook function in a #GHookList. @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 #GHookFlagMask for predefined flags. @func: the function to call when this hook is invoked. The possible signatures for this function are #GHookFunc and #GHookCheckFunc. @destroy: the default finalize_hook function of a #GHookList calls this member of the hook that is being finalized. Defines the type of a hook function that can be invoked by g_hook_list_invoke(). @data: the data field of the #GHook is passed to the hook function here. Defines the type of a hook function that can be invoked by g_hook_list_invoke_check(). @data: the data field of the #GHook is passed to the hook function here. @Returns: %FALSE if the #GHook should be destroyed. Initializes a #GHookList. This must be called before the #GHookList is used. @hook_list: a #GHookList. @hook_size: the size of each element in the #GHookList, typically sizeof (GHook). Calls all of the #GHook functions in a #GHookList. @hook_list: a #GHookList. @may_recurse: %TRUE if functions which are already running (e.g. in another thread) can be called. If set to %FALSE, these are skipped. Calls all of the #GHook functions in a #GHookList. Any function which returns %TRUE is removed from the #GHookList. @hook_list: a #GHookList. @may_recurse: %TRUE if functions which are already running (e.g. in another thread) can be called. If set to %FALSE, these are skipped. Calls a function on each valid #GHook. @hook_list: a #GHookList. @may_recurse: %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped. @marshaller: the function to call for each #GHook. @marshal_data: data to pass to @marshaller. Defines the type of function used by g_hook_list_marshal(). @hook: a #GHook. @marshal_data: user data. Calls a function on each valid #GHook and destroys it if the function returns %FALSE. @hook_list: a #GHookList. @may_recurse: %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped. @marshaller: the function to call for each #GHook. @marshal_data: data to pass to @marshaller. Defines the type of function used by g_hook_list_marshal_check(). @hook: a #GHook. @marshal_data: user data. @Returns: %FALSE if @hook should be destroyed. Removes all the #GHook elements from a #GHookList. @hook_list: a #GHookList. Allocates space for a #GHook and initializes it. @hook_list: a #GHookList. @Returns: a new #GHook. Appends a #GHook onto the end of a #GHookList. @hook_list: a #GHookList. @hook: the #GHook to add to the end of @hook_list. Prepends a #GHook on the start of a #GHookList. @hook_list: a #GHookList. @hook: the #GHook to add to the start of @hook_list. Inserts a #GHook into a #GHookList, before a given #GHook. @hook_list: a #GHookList. @sibling: the #GHook to insert the new #GHook before. @hook: the #GHook to insert. Inserts a #GHook into a #GHookList, sorted by the given function. @hook_list: a #GHookList. @hook: the #GHook to insert. @func: the comparison function used to sort the #GHook elements. Defines the type of function used to compare #GHook elements in g_hook_insert_sorted(). @new_hook: the #GHook being inserted. @sibling: the #GHook to compare with @new_hook. @Returns: a value <= 0 if @new_hook should be before @sibling. Compares the ids of two #GHook elements, returning a negative value if the second id is greater than the first. @new_hook: a #GHook. @sibling: a #GHook to compare with @new_hook. @Returns: a value <= 0 if the id of @sibling is >= the id of @new_hook. Returns the #GHook with the given id, or %NULL if it is not found. @hook_list: a #GHookList. @hook_id: a hook id. @Returns: the #GHook with the given id, or %NULL if it is not found. Finds a #GHook in a #GHookList using the given function to test for a match. @hook_list: a #GHookList. @need_valids: %TRUE if #GHook elements which have been destroyed should be skipped. @func: the function to call for each #GHook, which should return %TRUE when the #GHook has been found. @data: the data to pass to @func. @Returns: the found #GHook or %NULL if no matching #GHook is found. Defines the type of the function passed to g_hook_find(). @hook: a #GHook. @data: user data passed to g_hook_find_func(). @Returns: %TRUE if the required #GHook has been found. Finds a #GHook in a #GHookList with the given data. @hook_list: a #GHookList. @need_valids: %TRUE if #GHook elements which have been destroyed should be skipped. @data: the data to find. @Returns: the #GHook with the given @data or %NULL if no matching #GHook is found. Finds a #GHook in a #GHookList with the given function. @hook_list: a #GHookList. @need_valids: %TRUE if #GHook elements which have been destroyed should be skipped. @func: the function to find. @Returns: the #GHook with the given @func or %NULL if no matching #GHook is found. Finds a #GHook in a #GHookList with the given function and data. @hook_list: a #GHookList. @need_valids: %TRUE if #GHook elements which have been destroyed should be skipped. @func: the function to find. @data: the data to find. @Returns: the #GHook with the given @func and @data or %NULL if no matching #GHook is found. 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.) @hook_list: a #GHookList. @may_be_in_call: %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped. @Returns: the first valid #GHook, or %NULL if none are 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.) @hook_list: a #GHookList. @hook: the current #GHook. @may_be_in_call: %TRUE if hooks which are currently running (e.g. in another thread) are considered valid. If set to %FALSE, these are skipped. @Returns: the next valid #GHook, or %NULL if none are valid. Flags used internally in the #GHook implementation. @G_HOOK_FLAG_ACTIVE: set if the hook has not been destroyed. @G_HOOK_FLAG_IN_CALL: set if the hook is currently being run. @G_HOOK_FLAG_MASK: Returns the flags of a hook. @hook: a #GHook. 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. Casts a pointer to a GHook*. @hook: a pointer. Returns %TRUE if the #GHook is valid, i.e. it is in a #GHookList, it is active and it has not been destroyed. @hook: a #GHook. @Returns: %TRUE if the #GHook is valid. Returns %TRUE if the #GHook is active, which is normally %TRUE until the #GHook is destroyed. @hook: a #GHook. @Returns: %TRUE if the #GHook is active. Returns %TRUE if the #GHook function is currently executing. @hook: a #GHook. @Returns: %TRUE if the #GHook function is currently executing. Returns %TRUE if the #GHook is not in a #GHookList. @hook: a #GHook. @Returns: %TRUE if the #GHook is not in a #GHookList. Increments the reference count for a #GHook. @hook_list: a #GHookList. @hook: the #GHook to increment the reference count of. 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. @hook_list: a #GHookList. @hook: the #GHook to unref. Calls the #GHookList @hook_free function if it exists, and frees the memory allocated for the #GHook. @hook_list: a #GHookList. @hook: the #GHook to free. Destroys a #GHook, given its ID. @hook_list: a #GHookList. @hook_id: a hook ID. @Returns: %TRUE if the #GHook was found in the #GHookList and destroyed. Removes one #GHook from a #GHookList, marking it inactive and calling g_hook_unref() on it. @hook_list: a #GHookList. @hook: the #GHook to remove.