Fix su/sudo detection.

Commit 1244dbb6f0381ced states that gnome-terminal doesn't work under sudo. To
detect this that checks whether the uid or gid have changed or that the
e[uid|gid] are 0.

If the user already belongs to the group wheel or was root without doing any su or sudo
gnome-terminal will exit.

What we need to check is whether e[uid|gid] have changed (because the user was
root already or because the user belongs to the wheel/root group) and
check if the e[uid|gid] are 0. In that case the gnome-terminal is run under
su/sudo and gnome-terminal should bail out.

https://bugzilla.gnome.org/show_bug.cgi?id=727799
(cherry picked from commit 612345d2e47585f691006fa488125b2dc687117a)