Cancellable.sourceNew

glib.source.Source sourceNew()

Creates a source that triggers if cancellable is cancelled and calls its callback of type #GCancellableSourceFunc. This is primarily useful for attaching to another (non-cancellable) source with [glib.source.Source.addChildSource] to add cancellability to it.

For convenience, you can call this with a null #GCancellable, in which case the source will never trigger.

The new #GSource will hold a reference to the #GCancellable.

Returns

the new #GSource.