factor out GIO channel helper method

Related to #657

Signed-off-by: Jakub Filak <jfilak@redhat.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>