Re: Run menu action in background



On 1/11/07, Philipp E. Letschert <phil uni-koblenz de> wrote:
snip
the main window freezes until do_the_thing() finishes.
snip

If your subroutine is basicaly just a loop then you can generally get
away with adding

   Gtk2->main_iteration while Gtk2->events_pending;

inside the loop.  The problem here is that the application is not
threaded, so you either have to launch another process or run the
event loop yourself (giving the rest of the application a chance to
run).  If you have a fast loop (such as fetching rows from a database)
that runs for a long time then using the code above will suffice, but
if you have a loop whose commands that take a long time finish (such
as copying large files from one directory to another)  it won't.



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