File.trash

Sends file to the "Trashcan", if possible. This is similar to deleting it, but the user can recover it before emptying the trashcan. Not all file systems support trashing, so this call can return the gio.types.IOErrorEnum.NotSupported error. Since GLib 2.66, the x-gvfs-notrash unix mount option can be used to disable gio.file.File.trash support for certain mounts, the gio.types.IOErrorEnum.NotSupported error will be returned in that case.

If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error gio.types.IOErrorEnum.Cancelled will be returned.

interface File
bool
trash

Parameters

cancellable gio.cancellable.Cancellable

optional #GCancellable object, null to ignore

Return Value

Type: bool

true on successful trash, false otherwise.