glib.source
Module for [Source] class
class Source
Types 1
classSource : gobject.boxed.Boxed
The glib.source.Source struct is an opaque data type representing an event source.
Methods
void addChildSource(glib.source.Source childSource) nothrowAdds child_source to source as a "polled" source; when source is added to a #GMainContext, child_source will be automatically added with the same priority, when child_source is triggered, it will c...void addPoll(glib.types.PollFD fd) nothrowAdds a file descriptor to the set of file descriptors polled for this source. This is usually combined with [glib.source.Source.new_] to add an event source. The event source's check function will ...void * addUnixFd(int fd, glib.types.IOCondition events) nothrowMonitors fd for the IO events in events.uint attach(glib.main_context.MainContext context = null) nothrowAdds a #GSource to a context so that it will be executed within that context. Remove it by calling [glib.source.Source.destroy].void destroy() nothrowRemoves a source from its #GMainContext, if any, and mark it as destroyed. The source cannot be subsequently added to another context. It is safe to call this on sources which have already been re...bool getCanRecurse() nothrowChecks whether a source is allowed to be called recursively. see [glib.source.Source.setCanRecurse]. Returns: whether recursion is allowed.glib.main_context.MainContext getContext() nothrowGets the #GMainContext with which the source is associated.void getCurrentTime(glib.time_val.TimeVal timeval) nothrowThis function ignores source and is otherwise the same as [glib.global.getCurrentTime].uint getId() nothrowReturns the numeric ID for a particular source. The ID of a source is a positive integer which is unique within a particular main loop context. The reverse mapping from ID to source is done by [gli...string getName() nothrowGets a name for the source, used in debugging and profiling. The name may be #NULL if it has never been set with [glib.source.Source.setName]. Returns: the name of the sourcelong getReadyTime() nothrowGets the "ready time" of source, as set by [glib.source.Source.setReadyTime].long getTime() nothrowGets the time to be used when checking this source. The advantage of calling this function over calling [glib.global.getMonotonicTime] directly is that when checking multiple sources, GLib can cach...void modifyUnixFd(void * tag, glib.types.IOCondition newEvents) nothrowUpdates the event mask to watch for the fd identified by tag.glib.types.IOCondition queryUnixFd(void * tag) nothrowQueries the events reported for the fd corresponding to tag on source during the last poll.void removeChildSource(glib.source.Source childSource) nothrowDetaches child_source from source and destroys it.void removePoll(glib.types.PollFD fd) nothrowRemoves a file descriptor from the set of file descriptors polled for this source.void removeUnixFd(void * tag) nothrowReverses the effect of a previous call to [glib.source.Source.addUnixFd].void setCallback(glib.types.SourceFunc func) nothrowSets the callback function for a source. The callback for a source is called from the source's dispatch function.void setCallbackIndirect(void * callbackData, glib.types.SourceCallbackFuncs callbackFuncs) nothrowSets the callback function storing the data as a refcounted callback "object". This is used internally. Note that calling [glib.source.Source.setCallbackIndirect] assumes an initial reference count...void setCanRecurse(bool canRecurse) nothrowSets whether a source can be called recursively. If can_recurse is true, then while the source is being dispatched then this source will be processed normally. Otherwise, all processing of this sou...void setFuncs(glib.types.SourceFuncs funcs) nothrowSets the source functions (can be used to override default implementations) of an unattached source.void setName(string name) nothrowSets a name for the source, used in debugging and profiling. The name defaults to #NULL.void setPriority(int priority) nothrowSets the priority of a source. While the main loop is being run, a source will be dispatched if it is ready to be dispatched and no sources at a higher (numerically smaller) priority are ready to b...void setReadyTime(long readyTime) nothrowSets a #GSource to be dispatched when the given monotonic time is reached (or passed). If the monotonic time is in the past (as it always will be if ready_time is 0) then the source will be dispat...void setStaticName(string name) nothrowA variant of [glib.source.Source.setName] that does not duplicate the name, and can only be used with string literals.bool remove(uint tag) static nothrowRemoves the source with the given ID from the default main context. You must use [glib.source.Source.destroy] for sources added to a non-default main context.bool removeByFuncsUserData(glib.types.SourceFuncs funcs, void * userData = null) static nothrowRemoves a source from the default main loop context given the source functions and user data. If multiple sources exist with the same source functions and user data, only one will be destroyed.bool removeByUserData(void * userData = null) static nothrowRemoves a source from the default main loop context given the user data for the callback. If multiple sources exist with the same user data, only one will be destroyed.Constructors
this(glib.types.SourceFuncs sourceFuncs, uint structSize)Creates a new #GSource structure. The size is specified to allow creating structures derived from #GSource that contain additional data. The size passed in must be at least `sizeof (GSource)`.