Re: GtkTreeView



On 15 Aug 2001, Owen Taylor wrote:

> > > > jonathan, if this is really possible with the tree model API, then it's
> > > > fundamentally broken. you should not accept a 0-type-value from the user and
> > > > g_value_init() it with a type. GValues should always be passed around
> > > > properly type initialized, i.e. treemodel should assert that the type
> > > > of the value to get is_a
> > > > G_VALUE_TYPE (value_passed_to_gtk_tree_model_get_value).
> > > 
> > > I think it should indeed handle both.  Currently, it expects a zeroed
> > > out GValue, but certainly should allow a type to be passed in so it can
> > > do a transform, if necessary.  However, if I don't allow an
> > > uninitialized value, then every single instance that wants a value will
> > > have to do:
> > > 
> > > GValue value = {0, };
> > > g_value_init (&value, gtk_tree_model_get_column_type (model, col));
> > > gtk_tree_model_get_value (model, iter, &value, col);
> > > 
> > > I'd rather let people skip that second step, if possible.
> > 
> > well, as you say, people are probably going to use gtk_tree_model_get() anyways.
> > the main purpose in _get_value() variants are for LB or builder backends,
> > so a bit additional work doesn't do much harmn here.
> > and i'd rather keep these APIs consistent.
> 
> Yeah, who cares if language bindings are fast or not. ;-)
> 
> (More than this, I'd  _really_ like to set g_object_get_property()
> allow taking a type-0 GValue. I remember pretty strongly discussing
> with you, and you agreeing that it might make sense..)

hm, i don't remember that discussion (not implying we didn't have it
though). either way, we should be consistent in what we allow for
GValue usage. allowing 0-type values can gain us a bit of efficiency
in places, since we can get rid of one value copy/transform in the
getter code for 0-type values.

> 
> Regards,
>                                         Owen 
> 
> 

---
ciaoTJ





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