Manage app state in a reactive single-threaded glib loop
Right now we have a global mutex holding the state of the whole application, both for the model and the widget tree. This MR turns that mutex into a reactive loop that brings the right execution context for operations on the state and forces it, and at the same time it allows to define any set of operations atomically.
This loop can be used from any event handler as-is, so this paves the way to remove all Rc<RefCell<T>>
and weak pointer stuff and at the same time it makes access and mutation to the state from other threads panic-free, while avoiding most deadlocks because it prevents the caller from taking any return value directly.
Edited by Alejandro Domínguez