The spectrum of binding energies approach to grain boundary segregation