Skip to content

Notify changes in metadata

Rastersoft requested to merge rastersoft/gvfs:add_modification_signal into master

When a program (like Nautilus) modifies the metadata in a file (like metadata::custom-icon) there is no way of detecting that change from other programs: neither inotify generates an event in the file or the directory holding it, nor is possible to use it in the files at, or the folder itself, ~/.local/share/gvfs-metadata, because writting in them is delayed for nearly a minute.

Unfortunately, there are cases where it is needed to be able to detect that. An example (and the reason for this patch) is when Nautilus (or another file manager) modifies the custom icon in a file from the desktop, and the desktop is managed by a different program (in this case, Desktop Icons NG), because the later can't detect the change made by the former and, thus, the file will keep the old icon until the whole desktop is refreshed.

To fix this, this patch proposes to add a signal to the org.gtk.vfs.Metadata DBus interface, which will be triggered whenever a key is modified. To avoid saturating the system in case of modifying a lot of keys, it is triggered up to once per second. Also, to avoid security problems, it only specifies that a key has been modified, but neither the key, nor the value. It is responsibility of each application to check the the entries for their managed files. Since changes in metadata aren't very common, this is acceptable.

Edited by Rastersoft

Merge request reports