Skip to content
Commit 5de4c1fc authored by Barnabás Pőcze's avatar Barnabás Pőcze Committed by António Fernandes
Browse files

files-view: Do not copy wallpaper unnecessarily

Previously, when an image was selected as wallpaper it would
be copied unconditionally into the "Wallpapers" directory.
The image would be copied even if it was already in the "Wallpapers"
directory, resulting in copies of the image being created in
the same directory. This made it incovenient to potentially store
multiple backgrounds in the "Wallpapers" directory and switch
between them due to the fact that each wallpaper change would
result in the selected image being copied.

To avoid this, introduce a check, and only copy the image
if its parent is not the "Wallpapers" directory (as determined
by `g_file_equal()`).

For local files, `g_file_equal()` only compares the absolute
paths - at least at the moment. Comparing paths is not enough
to decide whether two entities are really the same in the presence
of e.g. bind mounts. However, such configuration is arguably a
very rare (if not non-existent). Nonetheless, users should not
experience any regressions even in that case since when
`g_file_equal()` returns a false negative, the old behaviour
applies.
parent c82c31d9
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment