A model of supernova feedback in galaxy formation