Re: Making rows bold in GtkTreeView



On Mon, Sep 24, 2007 at 06:30:36PM +0930, Kieran Clancy wrote:
In the list store I have a string field which is displayed in the
column, and a boolean field which should make the text bold or not. In
the code linked, if I set COL_BOLD to TRUE in all three rows, all of
them become bold. If any of them are FALSE, none of them are made
bold. I was not expecting this behaviour - am I doing something wrong?

No, you are not ;)  However due to a Pango API change a while back
setting weight-set to FALSE now resets the value that was set for
weight.  So, what is happening in your case is once GtkTreeView will
render a row with COL_BOLD set to FALSE, the weight-set property would
be set to FALSE also clearing the value of the weight property.  The
next time weight-set is set to TRUE again the value of weight is of
course still cleared, so none of the rows will appear in bold any
longer.  (See #350882 and #355214 at bugzilla.gnome.org).

After reading the tutorial and documentation, I was under the
impression that assigning the COL_BOLD field to the "weight-set"
property would allow certain rows to have a custom weight set or not.

Unfortunately this was not fixable in Pango anymore, making the -set
properties not usuable as independent properties of their own.  We've
updated gtk-demo by setting the "style" attribute of the cell renderer
instead of "style-set".  In your code you would change COL_BOLD to be an
integer (or even PANGO_TYPE_WEIGHT) column and setting the values for
that column in the model to be PANGO_WEIGHT_NORMAL and PANGO_WEIGHT_BOLD
instead of FALSE and TRUE.



regards,

-kris.



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