Use GString for appending strings

It can take a very long time to print a _NET_WM_ICON property for firefox with the previous code, several minutes. Fixes bug #6042 and also implements the change for append_string.