API improvements from Jan's review.

This goes with https://github.com/cockpit-project/cockpit/pull/190