Widom's method for uniform and non-uniform electrolyte solutions