Re: GtkTreeView



Tim Janik <timj gtk org> writes:

> On 13 Aug 2001, Jonathan Blandford wrote:
> 
> > Tim Janik <timj gtk org> writes:
> > 
> > > On 13 Aug 2001, David Bryant wrote:
> > > 
> > > > GValue value;
> > > > memset(&value, 0, sizeof(value));	// not sure about this
> > > > gtk_tree_model_get_value(model, iter, 2, &value);
> > > > gpointer user_data = value.data[0].v_pointer;	// is this "right" ?
> > > 
> > > 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..)

Regards,
                                        Owen 




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