### Virtual Method

# Gio File trash

#### Declaration [src]

    gboolean
    trash (
      GFile* file,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Sends `file` to the “Trashcan”, if possible. This is similar to deleting it, but the user can recover it before emptying the trashcan. Trashing is disabled for system mounts by default (see g_unix_mount_entry_is_system_internal()), 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 particular mounts, the `G_IO_ERROR_NOT_SUPPORTED` error will be returned in that case. Since 2.82, the `x-gvfs-trash` unix mount option can be used to enable `g_file_trash()` support for particular system mounts.

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.

#### Parameters

`cancellable`

  Type: `GCancellable`

  Optional `GCancellable` object, `NULL` to ignore.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the virtual function if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

`TRUE` on successful trash, `FALSE` otherwise.