Re: dialog enhancements



Owen Taylor wrote:
> 
> gtk_main(), like any other GTK+ function when threading must be called
> inside the GTK+ lock. Unlike most other functions, gtk_main()
> releases the lock while waiting so other threads can get accses
> 
> So, as long as you are calling it from the main thread, and within
> the main loop, a recursive gtk_main() will work with no problems
> with threads.
> 
> (One thing that is NOT handled well now is doing the equivalent of a
> recursive main from a different thread, since the GMain functions can
> only be called from the main loop thread. To do this now, you
> need to use a semaphore or some such mechanism in the secondary thread.
> This would be nice address for GTK+-1.4.)
> 
> > So when rethinking the GtkDialog API one should possibly rethink whether
> > the call to gtk_main is really necessary. Apart from not being able to
> > use the preset dialog routines it also took me ages to actually find
> > that bug...
> 
> I don't actually follow the problem. The only one I see is that
> gnome_dialog_run() is only going to work in the main thread.
> 
> Regards,
>                                         Owen

Consider a GTK application that allows multiple concurrent calls to ssh
to connect to remote machines. Of course at some point the remote ssh
server will ask for a password, and the local GTK application should
respond to that. This introduces the possibility of having multiple
gnome_dialogs at the same time (e.g. to let the user type in the
password). This of course requires multithreading, and furthermore,
calls to gtk_main() from other than the main thread.

This may sound as a very specific solution but IMHO it is not. In my
case, it is just an application that allows to run file integrity
checkers on multiple hosts; but the mechanism is the same for any app
that calls several shell commands concurrently and has to react on their
output in some way or the other.

Now how about just hacking gnome/gtk_dialog_run to allow the user
passing the blocking function to it?

Fritz



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]