Pacman 4.2 support

I'm not sure about all the g_return_if_fail().
Most of the changes are inspired from pacman 4.2 's  src/pacman/callback.c