Gah.

(For context as to why there are weird indentation errors, I originally had all this code in GLib / Gtk+ style and only found out yesterday that Gjs uses something totally different. So I had to hand re-indent the whole thing. Not fun).