Threads and GUI



I'm trying to put Coaster's gnome-vfs file reading operations into a
thread that runs separate from the GUI.  The reason for this is that
using the file adding notification is very slow and I would like to only
have the dialog update every so many milliseconds while file reading
operations are taking place (to improve speed).  Right now, I'm using
the while(Gtk::Main::events_pending()) Gtk::Main::iteration(); method,
but this severely slows down how fast the files are read in.  Here is
how I think it should work (I could be wrong):

1. User chooses files or directory to add.
2. Pass the list of files to the thread and start it working on opening
the files and reading them into the TreeStore.
3. While the thread is working, poll the thread every so many seconds to
find out which file it is reading and update the GUI with that file
name.

I've been looking at some of the threading examples in Glibmm, but they
really don't make much sense to me (some are not very well commented)
and there's not a chapter on threading with Glibmm in the Gtkmm book.
Any help would be greatly appreciated.  Thanks in advance!
-- 
======================================================================
Bryan Forbes
bryan reigndropsfall net
http://www.reigndropsfall.net

"It does not take a majority to prevail, but rather an irate, tireless
minority keen to set brush fires in people's minds."
        - Samuel Adams, an architect of the Constitution

Key fingerprint = 3D7D B728 713A BB7B B8B1  5B61 3888 17E0 70CA 0F3D

Attachment: signature.asc
Description: This is a digitally signed message part



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