Re: gvalue type conversions

Sven Neumann <sven gimp org> writes:

> Havoc Pennington <hp redhat com> writes:
> > It would seem useful to support conversions from most primitive types
> > (int, float, etc.) to strings, for the purposes of the TreeView. If
> > you have a GtkListStore containing integers, for example, it would be
> > convenient if GtkCellRendererText could automatically display those as
> > text.  It looks like adding an int->string conversion makes this
> > happen automatically, because you can set the "text" property from a
> > GValue with type G_VALUE_INT.
> Yes please. At the moment we do this by hand when serializing/deserializing
> values. Having the string conversion routines in glib would be nice.

We can't do this, because there is no support for failure in
the GValue conversion API. So you can do int => string, but
string => int doesn't work - something built on top
of that won't be robust.


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