GTK is not thread-safe, but thread-aware – it can be used from multiple threads ensuring that global lock is used to protect GTK API calls. If i need to post a message from worker thread to GTK GUI thread i just call gdk_threads_add_idle() and specified callback will be called in GUI thread after some time.
But what is the easy way to do opposite thing – call specified callback from non-GUI thread as user clicks a button?
Nothing prevents you from creating a new non-GUI loop with
g_main_loop_new, run it from your non-GUI thread withg_main_loop_runand callg_idle_addfrom your GUI thread when needed.