Koopmans' condition for density-functional theory