mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 23:46:17 +01:00
Merge branch 'wip/oholy/x-gvfs-trash' into 'main'
gfile: Add support for x-gvfs-trash mount option See merge request GNOME/glib!4155
This commit is contained in:
commit
d5c088e730
@ -4744,10 +4744,13 @@ g_file_delete_finish (GFile *file,
|
|||||||
*
|
*
|
||||||
* Sends @file to the "Trashcan", if possible. This is similar to
|
* Sends @file to the "Trashcan", if possible. This is similar to
|
||||||
* deleting it, but the user can recover it before emptying the trashcan.
|
* deleting it, but the user can recover it before emptying the trashcan.
|
||||||
* Not all file systems support trashing, so this call can return the
|
* Trashing is disabled for system mounts by default (see
|
||||||
|
* g_unix_mount_is_system_internal()), so this call can return the
|
||||||
* %G_IO_ERROR_NOT_SUPPORTED error. Since GLib 2.66, the `x-gvfs-notrash` unix
|
* %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
|
* 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.
|
* 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
|
* If @cancellable is not %NULL, then the operation can be cancelled by
|
||||||
* triggering the cancellable object from another thread. If the operation
|
* triggering the cancellable object from another thread. If the operation
|
||||||
|
@ -1807,10 +1807,6 @@ ignore_trash_mount (GUnixMountEntry *mount)
|
|||||||
{
|
{
|
||||||
GUnixMountPoint *mount_point = NULL;
|
GUnixMountPoint *mount_point = NULL;
|
||||||
const gchar *mount_options;
|
const gchar *mount_options;
|
||||||
gboolean retval = TRUE;
|
|
||||||
|
|
||||||
if (g_unix_mount_is_system_internal (mount))
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
mount_options = g_unix_mount_get_options (mount);
|
mount_options = g_unix_mount_get_options (mount);
|
||||||
if (mount_options == NULL)
|
if (mount_options == NULL)
|
||||||
@ -1819,15 +1815,23 @@ ignore_trash_mount (GUnixMountEntry *mount)
|
|||||||
NULL);
|
NULL);
|
||||||
if (mount_point != NULL)
|
if (mount_point != NULL)
|
||||||
mount_options = g_unix_mount_point_get_options (mount_point);
|
mount_options = g_unix_mount_point_get_options (mount_point);
|
||||||
|
|
||||||
|
g_clear_pointer (&mount_point, g_unix_mount_point_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mount_options == NULL ||
|
if (mount_options != NULL)
|
||||||
strstr (mount_options, "x-gvfs-notrash") == NULL)
|
{
|
||||||
retval = FALSE;
|
if (strstr (mount_options, "x-gvfs-trash") != NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
g_clear_pointer (&mount_point, g_unix_mount_point_free);
|
if (strstr (mount_options, "x-gvfs-notrash") != NULL)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
return retval;
|
if (g_unix_mount_is_system_internal (mount))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user