core/ui: allow specifying port and protocol for gateways (bgo #712710)

The original commit cb81bdce that brought multiple gateway support didn't take
port and protocol into account.

https://bugzilla.gnome.org/show_bug.cgi?id=712710
service: fix a memory leak on an error

We must free arguments in GPtrArray.