Change GTK TextView dynamically

Hi there!
I’m trying to “print” a log-file dynamically to a gtk::TextView, like tail -f in the shell. I thought on spawning a thread, which actualizes the File after some time, but since gtk is not thread-safe, I think that’s not gonna work. Has somebody an Idea on how to implement this?

I did it from Python, but I’m sure it will translate to Rust well. You need to do it with the help of GObject::idle_add().

See this question on Stackoverflow on the issue: https://stackoverflow.com/questions/39556006/how-can-i-update-a-gtk-textview-from-events-from-a-different-thread