Re: GtkTreeView
- From: Jonathan Blandford <jrb redhat com>
- To: Tim Janik <timj gtk org>
- Cc: David Bryant <daveb acres com au>, Charlie Schmidt <ishamael themes org>, Gtk+ MList <gtk-list gnome org>, Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: GtkTreeView
- Date: 13 Aug 2001 12:09:47 -0400
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.
[ Actually, I think most people will be doing a:
gtk_tree_model_get (model, iiter, col, &my_string, -1);
anyway, so this probably isn't that important. ]
Thanks,
-Jonathan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]