add gui.MetadataController (+related fixes)

To allow different editor UIs sharing also the metadata setting/getting and change notification.

Unit testing also showed a few bugs in the current code. To be expected, as that code was so far in no real code path. Now hardended.

One issue is still open, but no regression from this PR: currently OpUpdateMetadata silently deals with removing metadata which is not present, including emitting a changed signal. See #607