diff options
author | Ondrej Holy <oholy@redhat.com> | 2023-01-27 11:06:39 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2023-04-06 10:40:31 +0200 |
commit | 2f20024fab143671f1bdee8637872ee3f115a4eb (patch) | |
tree | 6841eb3649fa4d5dc86b94766a58e379f46ede69 | |
parent | 6814a8cfc914980ff0658051d290610d433be3a0 (diff) | |
download | nautilus-2f20024fab143671f1bdee8637872ee3f115a4eb.tar.gz |
file: Mark file as gone when enclosing mount disappears
Currently, the `GFileMonitor` object on GVfs locations never emits
the `G_FILE_MONITOR_EVENT_UNMOUNTED`, nor `_DELETED` events when the
location is unmounted. Let's mark the file as gone when the `unmounted`
signal is emitted for the enclosing mount.
-rw-r--r-- | src/nautilus-file.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nautilus-file.c b/src/nautilus-file.c index a66e8b457..a123088c6 100644 --- a/src/nautilus-file.c +++ b/src/nautilus-file.c @@ -7710,10 +7710,22 @@ enclosing_mount_unmounted (GMount *mount, gpointer data) { NautilusFile *file; + g_autoptr (GFile) location = NULL; file = NAUTILUS_FILE (data); + location = nautilus_file_get_location (file); nautilus_file_invalidate_attributes (file, NAUTILUS_FILE_ATTRIBUTE_MOUNT); + + /* Currently, the GFileMonitor on GVfs locations never emits + * G_FILE_MONITOR_EVENT_UNMOUNTED, nor _DELETED events when the location is + * unmounted. Thus this is the only way to know that the file is gone. + */ + if (!g_file_is_native (location)) + { + nautilus_file_mark_gone (file); + nautilus_file_changed (file); + } } void |