:right-sidebar: True Hook =================================================================== .. currentmodule:: gi.repository.GLib .. class:: Hook(*args, **kwargs) :no-contents-entry: :Constructors: :: Hook() Methods ------- .. rst-class:: interim-class .. class:: Hook :no-index: .. method:: compare_ids(sibling: ~gi.repository.GLib.Hook) -> int Compares the ids of two :obj:`~gi.repository.GLib.Hook` elements, returning a negative value if the second id is greater than the first. :param sibling: a :obj:`~gi.repository.GLib.Hook` to compare with ``new_hook`` .. method:: destroy(hook_list: ~gi.repository.GLib.HookList, hook_id: int) -> bool Destroys a :obj:`~gi.repository.GLib.Hook`, given its ID. :param hook_list: a :obj:`~gi.repository.GLib.HookList` :param hook_id: a hook ID .. method:: destroy_link(hook_list: ~gi.repository.GLib.HookList, hook: ~gi.repository.GLib.Hook) -> None Removes one :obj:`~gi.repository.GLib.Hook` from a :obj:`~gi.repository.GLib.HookList`, marking it inactive and calling :func:`~gi.repository.GLib.Hook.unref` on it. :param hook_list: a :obj:`~gi.repository.GLib.HookList` :param hook: the :obj:`~gi.repository.GLib.Hook` to remove .. method:: free(hook_list: ~gi.repository.GLib.HookList, hook: ~gi.repository.GLib.Hook) -> None Calls the :obj:`~gi.repository.GLib.HookList` ``finalize_hook`` function if it exists, and frees the memory allocated for the :obj:`~gi.repository.GLib.Hook`. :param hook_list: a :obj:`~gi.repository.GLib.HookList` :param hook: the :obj:`~gi.repository.GLib.Hook` to free .. method:: insert_before(hook_list: ~gi.repository.GLib.HookList, sibling: ~gi.repository.GLib.Hook | None, hook: ~gi.repository.GLib.Hook) -> None Inserts a :obj:`~gi.repository.GLib.Hook` into a :obj:`~gi.repository.GLib.HookList`, before a given :obj:`~gi.repository.GLib.Hook`. :param hook_list: a :obj:`~gi.repository.GLib.HookList` :param sibling: the :obj:`~gi.repository.GLib.Hook` to insert the new :obj:`~gi.repository.GLib.Hook` before :param hook: the :obj:`~gi.repository.GLib.Hook` to insert .. method:: insert_sorted(hook_list: ~gi.repository.GLib.HookList, hook: ~gi.repository.GLib.Hook, func: ~typing.Callable[[~gi.repository.GLib.Hook, ~gi.repository.GLib.Hook], int]) -> None Inserts a :obj:`~gi.repository.GLib.Hook` into a :obj:`~gi.repository.GLib.HookList`, sorted by the given function. :param hook_list: a :obj:`~gi.repository.GLib.HookList` :param hook: the :obj:`~gi.repository.GLib.Hook` to insert :param func: the comparison function used to sort the :obj:`~gi.repository.GLib.Hook` elements .. method:: prepend(hook_list: ~gi.repository.GLib.HookList, hook: ~gi.repository.GLib.Hook) -> None Prepends a :obj:`~gi.repository.GLib.Hook` on the start of a :obj:`~gi.repository.GLib.HookList`. :param hook_list: a :obj:`~gi.repository.GLib.HookList` :param hook: the :obj:`~gi.repository.GLib.Hook` to add to the start of ``hook_list`` Fields ------ .. rst-class:: interim-class .. class:: Hook :no-index: .. attribute:: data Data which is passed to func when this hook is invoked .. attribute:: flags Flags which are set for this hook. See ``GHookFlagMask`` for predefined flags .. attribute:: func The function to call when this hook is invoked. The possible signatures for this function are ``GHookFunc`` and ``GHookCheckFunc`` .. attribute:: hook_id The id of this hook, which is unique within its list .. attribute:: next Pointer to the next hook in the list .. attribute:: prev Pointer to the previous hook in the list .. attribute:: ref_count The reference count of this hook