Re: Opening dialogs outside the Gtk thread?
- From: Tim Janik <timj gtk org>
- To: Matthias Kaeppler <matthias finitestate org>
- Cc: Gtk+ MList <gtk-list gnome org>
- Subject: Re: Opening dialogs outside the Gtk thread?
- Date: Thu, 27 Oct 2005 23:55:36 +0200 (CEST)
On Thu, 27 Oct 2005, Matthias Kaeppler wrote:
Hi,
I want to display a message dialog from a thread B running parallel to the
Gtk main thread A (it's a thread invoked by the async transfer methods from
gnome-vfs). When running the dialog directly, the program locks up, which is
what I expected since Gtk is not thread safe.
So I downloaded the nautilus source code to see how they do it but they open
the dialog directly in a function which is not called from the Gtk main
thread using eel_run_simple_dialog() (I also downloaded the eel sources and I
couldn't find anything related to thread tunneling and dialogs in the
respective functions).
How come it works for them without dispatching the call to the main thread,
but not for me? I already started to implement the mechanics to synchronize
both threads, but it's really a lot of code just to show a dialog from a
second thread... Am I missing something?
you can use gtk functions from any thread, as long as you take care to
acquire the gtk lock around any gtk functions:
GDK_THREADS_ENTER ();
fire up dialog here.
GDK_THREADS_LEAVE ();
Regards,
Matthias
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]