  Let (M,J) be an almost complex manifold. We show that the
infinite-dimensional space Tau of totally real submanifolds in M carries a
natural connection. This induces a canonical notion of geodesics in Tau and a
corresponding definition of when a functional, defined on Tau, is convex.
  Geodesics in Tau can be expressed in terms of families of J-holomorphic
curves in M; we prove a uniqueness result and study their existence. When M is
K\"ahler we define a canonical functional on Tau; it is convex if M has
non-positive Ricci curvature.
  Our construction is formally analogous to the notion of geodesics and the
Mabuchi functional on the space of K\"ahler potentials, as studied by
Donaldson, Fujiki and Semmes. Motivated by this analogy, we discuss possible
applications of our theory to the study of minimal Lagrangians in negative
K\"ahler-Einstein manifolds.
