Electronic structure and magnetic properties of rare-earth perovskite gallates from first principles