man: add sample glib/sd-event integration

This should be moved to man pages, but for now the C code is included directly.

Suggested by Zbyszek.