Great, thanks a lot! I've updated the Gist and wrapped everything in Glib.idle_add so everything is called from the main thread, and more importantly not from within a callback.
See updated version here if that's useful for anyone, (and original version for reference)