Re: a question about gtk_tree_view_column_set_cell_renderer()



Vitaly Tishkov <tvv sparc spb su> writes:

> Hi,
> 
> The documentation for gtk_tree_view_column_set_cell_renderer () says:
> "Sets the cell renderer of the tree_column. If there is a cell renderer already
> set, then it is removed. If cell is
> NULL, then the cell renderer is unset."

Doc bug.  It actually does a pack_start.

> If you look into gtktreeviewcolumn.c you note that this function actually adds
> the specified cell renderer to the list of cell renderers.
> 
> If you want ot get this cell renderer you should call
> gtk_tree_view_column_get_cell_renderers () (BTW, why is it absent in the
> API Reference?)

It was added after the last time the API docs were updated.  This needs
to be fixed.

> The questions:
> 1) why do we need a list of renderers, why not only one renderer?
> 2) if we really need a list of renderers, is it better to rename this function
> to gtk_tree_view_column_add_cell_renderer()?

The list of Cell renderers is so the columns can act like boxes, holding
cell renderers.  This means that you can get a pixbuf/text combination
without writing a separate cell renderer to do both.  set_cell_renderer
was mainly there as backwards compatibility while the packing stuff
didn't work.  It is somewhat equivilent to doing a gtk_container_add ()
on a GtkBox.  I don't really care too much what happens to this
function.  We can either remove it, or redocument it so that people have
less to learn when using the tree.  Anyone have an opinion?

-Jonathan




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