Quasithermodynamic treatment of nonuniform systems. I. Adsorption