Re: Should cell renderer properties be cleared

On Tue, 2003-09-09 at 14:21, Jonathan Blandford wrote:

> This is a documented and intended effect.  If you set a property in a
> data_func, you need to set it consistently.  The advantage of not
> resetting it is that you can do:
> cell = g_object_new (GTK_TYPE_CELL_RENDERER_TEXT,
>                      "editable", TRUE,
>                      "weight", PANGO_WEIGHT_BOLD,
>                      NULL);
> and have properties set for the entire column without needing to reset
> them every time we render/measure a cell.

OK, from talking on IRC it seems that the real problem is that the
"markup" property is equivalent to setting both "text" and "attributes",
but GtkCellRendererText doesn't remember if that was the case if you
later reset just the "text" or "attributes" properties.  Would it make
sense to have a boolean field in the GtkCRText structure that identifies
this situation?  The setter code for the "text" and "attributes"
properties would then check this flag and clear the other property if
the flag is true.

Does anyone ever set the "attributes" property without setting "text" at
the same time?


1.1. Set "markup"
1.2. Set "text" -- "attributes" needs to be cleared.

2.1. Set "markup"
2.2. Set "attributes" -- I don't think this makes sense, since you can't
tell how Pango will break things.

3.1. Set "text"
3.2. Set "attributes" -- presumably from having done the Pango work
3.3. Set "text" -- same as 2.2; Pango may break things differently for
this text, so "attributes" needs to be cleared.

Does this make sense?


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