Using GParam in GtkTLCell.



<This email is mostly directed to Tim, but I'm posting it here for
 posterity's sake>

I've been contemplating using GParam's in the cell renderers for
GtkTLView.  In particular, I'd like to have the following behavior:

 * Have renderers have a number of parameters that are setable by the
   user.  For example, a text renderer could have "text", "fg color",
   "bg color", "font", "underline", and "strikethrough" attributes.  I
   could create a renderer for a column that had a default font, etc.

 * You can map an attribute to a column in the model.  For the example
   given previously, I could create a column in the view where the
   "text" attribute comes from column 1, and the "fg_color" attribute
   comes from column 5.

I had a few questions about this.

1) I will be doing this every expose event, and in the initial
   calculation of height stage.  I assumed (perhaps incorrectly) that
   measuring/rendering text and the model lookup would be the slow step,
   but given that I may doing a number of g_object_set_param's per cell,
   I'd like to get an idea of how fast it is.  Tim, could you check in
   your modified copy of Havoc's benchmark program so we could add some
   tests of this.

2) Tim, why is GValue:

struct _GValue
{
  /*< private >*/
  GType		g_type;

  /* public for GTypeValueTable methods */
  union {
    gint	v_int;
    ...
    gpointer	v_pointer;
  } data[4];
};
         ^ an array of size 4?

Am I missing something here?  You only seem to use the first one.  The
reason I ask is that I would like to have the model fill in a GValue
when queried.  As a result, I was going to store the data for the model
as the data field of the GValue, but would rather not have it be any
bigger then it has to be.

Thanks,
-Jonathan





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