Adds a function to be called whenever there are no higher priority events pending.
If the function returns g_source_remove or false it is automatically removed from the list of event sources and will not be called again.
See memory management of sources for details on how to handle the return value and memory management of
This internally creates a main loop source using IdleSource and attaches it to the global MainContext using attach, so the callback will be invoked in whichever thread is running that main context. You can do these steps manually if you need greater control or to use a custom main context.
the priority of the idle source. Typically this will be in the range between g_priority_default_idle and g_priority_high_idle.
function to call
data to pass to
function to call when the idle is removed, or null
the ID (greater than 0) of the event source.