g_file_trash (
  GFile* file,
  GCancellable* cancellable,
  GError** error


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 G_IO_ERROR_NOT_SUPPORTED error. Since GLib 2.66, the x-gvfs-notrash unix mount option can be used to disable g_file_trash() support for certain mounts, the G_IO_ERROR_NOT_SUPPORTED 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 G_IO_ERROR_CANCELLED will be returned.


cancellable GCancellable

Optional GCancellable object, NULL to ignore.

 The argument can be NULL.
 The data is owned by the caller of the function.
error GError **
  The return location for a GError*, or NULL.

Return value

Returns: gboolean

TRUE on successful trash, FALSE otherwise.