Subject: Re: How to update the content of a tree view
Date: Sat, 23 Feb 2013 14:52:03 -0800
On Sat, Feb 23, 2013 at 9:39 AM, John Tall <mjtallx gmail com> wrote:
However, every now and then the progress bars has to be updated and
this is where I don't follow. I don't get how I should do to properly
update the value of a specific row.
I would put a pointer to your job object in the TreeModel set up a
Glib::signal_timeout. In the timeout, iterate through your treemodel and use
iter->get_value(columns.job)->get_progress();
Be sure to disconnect the signal_timeout when there are no jobs in progress.
And you should only have one of these timeouts, even if you have several jobs
running.
Using signal_timeout for updating progress bars usually results in a much
smoother looking result--especially in this case, where you do have to iterate
through on average half the treemodel for each update. Its up to you to choose
a sensible period. 50 ms might be sensible for a job that completes in under a
minute. Using signal_timeout().connect_seconds() might be more reasonable if