code review from @ingorichter. rewrite ReadFile to use glib.