A huge pile of gui component cleanups.

- Move strdup stuff to a compat.c/.h file
- Move stuff over to component.c/.h, add some boilerplate.