Never use selected_images in control_jobs (remove/delete).

Indeed between the time we click on delete and the time where the
SQL statements get executed there is a small window where the
user could click on some images and change the selection.

This could even been far more a problem with scripts like Lua.

Instead of using the selected_images table we now properly get the images
to work on from the list associated with the job.

Take the opportunity to refactor some code for better sharing. This fix
an obvious bug where in dt_control_delete_images_job_run we where getting
only the first images for checking for duplicates.