A variational approach to double-porosity problems