:right-sidebar: True SourceFuncs =================================================================== .. currentmodule:: gi.repository.GLib .. class:: SourceFuncs(*args, **kwargs) :no-contents-entry: :Constructors: :: SourceFuncs() Fields ------ .. rst-class:: interim-class .. class:: SourceFuncs :no-index: .. attribute:: check Called after all the file descriptors are polled. The source should return :const:`True` if it is ready to be dispatched. Note that some time may have passed since the previous prepare function was called, so the source should be checked again here. Since 2.36 this may be :const:`None`, in which case the effect is as if the function always returns :const:`False`. .. attribute:: closure_callback .. attribute:: closure_marshal .. attribute:: dispatch Called to dispatch the event source, after it has returned :const:`True` in either its ``prepare`` or its ``check`` function, or if a ready time has been reached. The ``dispatch`` function receives a callback function and user data. The callback function may be :const:`None` if the source was never connected to a callback using :func:`~gi.repository.GLib.Source.set_callback`. The ``dispatch`` function should call the callback function with ``user_data`` and whatever additional parameters are needed for this type of event source. The return value of the ``dispatch`` function should be :const:`~gi.repository.GLib.SOURCE_REMOVE` if the source should be removed or :const:`~gi.repository.GLib.SOURCE_CONTINUE` to keep it. .. attribute:: finalize Called when the source is finalized. At this point, the source will have been destroyed, had its callback cleared, and have been removed from its :obj:`~gi.repository.GLib.MainContext`, but it will still have its final reference count, so methods can be called on it from within this function. .. attribute:: prepare Called before all the file descriptors are polled. If the source can determine that it is ready here (without waiting for the results of the poll() call) it should return :const:`True`. It can also return a @``timeout_`` value which should be the maximum timeout (in milliseconds) which should be passed to the poll() call. The actual timeout used will be -1 if all sources returned -1, or it will be the minimum of all the @``timeout_`` values returned which were >= 0. Since 2.36 this may be :const:`None`, in which case the effect is as if the function always returns :const:`False` with a timeout of -1. If ``prepare`` returns a timeout and the source also has a ready time set, then the lower of the two will be used.