A Trust and Bradford Council have reached an agreement on how the replacement of a listed building's roof will be funded.