Re: GtkTreeView : why so many "refresh"



Hello, and thanks for your answers.
But I still have some questions.


1. I have specified a function 'my_cell_data_func()' using
gtk_tree_view_column_set_cell_data_func() on each column of a view.
By calling gtk_tree_model_row_changed() on one of the rows of the model,
I
am called into my_cell_data_func() for each column of the view for the
changed row (it's seem logical).
But, if the changed row is  visible (even partially), I am then called
into
my_cell_data_func() again: for each visible rows and for each columns of
the view (including the changed row itself) ! Are these calls necessary
?
Note that there is no auto sort on the view, nor auto-resize on the
columns.

To avoid those calls the treeview would have to make a copy of your
data and store it inside the treeview; which would use a lot of memory
and time and in most cases would not be useful.

In fact, I don't see why the treeview needs to refresh its whole view
when one of its row has been changed, especially as there is no
auto-sort of the lines nor auto-resize of the columns, and if the size
(especially the height) of the cells does not change.
Can you explain me what those calls are intended to do, and why the
refresh of the changed row, and only of this one, is not enough ?
Is there a way to curb the treeview to refresh/access data only for the
refreshed row and not to all visible lines of the treeview.


If for some reason your data is too slow to access, you can create
your own cached copy and return that from the cell data func.

It is exacly what I did !
More over, using an unique 'my_cell_data_func()', I have to distinguish
which cell (i.e., which column) I supposed to render. To do that, I
identify
columns with an id set into their "user-data" property and retreived by
g_object_get_property(column, "user-data", &gvalue_of_type_pointer);
By gprof'ing my program, this access appears in the top ten of the most
cpu eater functions. Is there another quicker way to set and get a client
data into a GtkTreeViewColumn in order to identify it ?



2. Is there a way to prevent 'my_cell_data_func()' from being called
each
time the mouse pointer moves over a row (enters and leaves the row area
in
fact), while keeping selection enabled ?

If the treeview doesn't copy your data, it has to ask for the data
each time it wants to display it.

If the treeview copied your data, there would be no point in using the
model-view architecture.

Ok, perhaps my question was confusing. I think its logical that the
treeview
ask for data of a row about to be selected, as well when a row appears
visible
by scrolling, etc (as you say, to prevent the treeview from storing copy of
data).
But, it is a bit cpu intensive to do that just when the mouse pointer is
simply
hovering over a cell, without selecting it !
Is there a way to deactivate/ignore the "prelit" status without overriding
my
own cell renderer ?


Note that you can also stuff all your data into one of the prebuilt
models such as GtkListStore, rather than using a cell_data_func();
that would give the behavior you're asking for.

I am quite sure all those access are still done, even if we don't see
them since there are "internal".


Havoc

frmar

"This message,  including any attachments may contain confidential and
privileged material;  it is intended only for the person to whom it is
addressed.  Its  contents  do not  constitute  a commitment  by Crédit
Agricole Indosuez Cheuvreux  except  where  provided  for in a written
agreement.  Crédit Agricole Indosuez Cheuvreux assumes no liability or
responsibility for the consequences arising out of a delay and/or loss
in  transit  of  this  message,  or for corruption  or other  error(s)
arising in its transmission and for any misuse or fraudulent use which
may  be made thereof.  If you are not the  intended recipient,  please
contact us  and abstain from  any disclosure, use or dissemination. To
the extent  that  this message  contains  research information  and/or
recommendations,  these  are  provided  on  the  same  basis as Crédit
Agricole Indosuez Cheuvreux's  published  research  and  the recipient
must  have  regard  to  all   disclosures  and  disclaimers  contained
therein."






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