• Barnabás Pőcze's avatar
    files-view: Do not copy wallpaper unnecessarily · 5de4c1fc
    Barnabás Pőcze authored and António Fernandes's avatar António Fernandes committed
    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.
    5de4c1fc