Re: List/TreeStore and threads
- From: Kevin Brightwell <kevin brightwell2 gmail com>
- To: Yann Leydier <yann leydier info>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: List/TreeStore and threads
- Date: Fri, 2 Aug 2013 10:22:47 -0400
Well, if you wanted to go the route of dispatcher, I'll outline how I did it in a past life:
1. "Queue" object which holds "TreeStore items for insertion"
- insert method, ability for window to get queue and lock it (mutex)
2. MainWindow which holds the TreeView
- contains dispatcher that is bound to a method that does insertion into the Gtk::TreeStore
On inserting an item into the queue (outside ui thread),
have the method emit the dispatcher signal, the dispatcher then will run
and dequeue the item, inserting it from the ui thread. This would
create the "update as we go" behaviour you're going for, I think....
The dispatcher is more useful than it seems, and I am 95% sure there is no "thread-safe" insert otherwise.
As for swapping a tree store, I think you can do it, just have to invalidate the TreeView after changing it.
Sorry I don't have pseudo-code or particularly exact answers, I am at work and don't have access to a C++ editor/gtk install.
Cheers,
Kevin
P.S. Sorry Yann, didn't mean to hit reply instead of reply-all
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]