:right-sidebar: True Source =================================================================== .. currentmodule:: gi.repository.GLib .. class:: Source(*args, **kwargs) :no-contents-entry: The ``GSource`` struct is an opaque data type representing an event source. Methods ------- .. rst-class:: interim-class .. class:: Source :no-index: .. method:: finalize() .. method:: get_current_time() This function ignores ``source`` and is otherwise the same as :obj:`~gi.repository.GLib.get_current_time`\. .. deprecated:: 2.28 use :obj:`~gi.repository.GLib.Source.get_time` instead .. method:: set_callback(fn, user_data=None) Sets the callback function for a source. The callback for a source is called from the source's dispatch function. The exact type of ``func`` depends on the type of source; ie. you should not count on ``func`` being called with ``data`` as its first parameter. Cast ``func`` with :obj:`~gi.repository.GLib.SOURCE_FUNC` to avoid warnings about incompatible function types. See `mainloop memory management `__ for details on how to handle memory management of ``data``\. Typically, you won't use this function. Instead use functions specific to the type of source you are using, such as :obj:`~gi.repository.GLib.idle_add` or :obj:`~gi.repository.GLib.timeout_add`\. It is safe to call this function multiple times on a source which has already been attached to a context. The changes will take effect for the next time the source is dispatched after this call returns. Note that :obj:`~gi.repository.GLib.Source.destroy` for a currently attached source has the effect of also unsetting the callback. :param fn: :param user_data: Fields ------ .. rst-class:: interim-class .. class:: Source :no-index: .. attribute:: can_recurse .. attribute:: priority