GNOME Bugzilla – Bug 158818
glib has no G_TYPE_SHORT
Last modified: 2011-02-18 16:14:11 UTC
It would be nice if gobject had G_TYPE_SHORT and G_TYPE_USHORT as well as the existing basic types, such as G_TYPE_INT, with appropriate transformation functions. In gtkmm, developers never need to use these G_TYPE_* identifiers, because gtkmm uses them internally if the developer uses a native C/C++ short type with a GValue. So, they don't see what basic types are really supported by default. So when they use a short for a GtkTreeModelColumn with a GtkCellRendererText, they get a confusing "unable to set property" warning, because no transformation exists for our on-the-fly GType. I think that we could register a new transformation in gtkmm, but it would be simpler to just add it to C.
the list of types in gtype.h is meant to be resonably short. for most (property) uses, "short" types can be handled as TYPE_INT with param specs ranges like -32768..+32767 or 0..65535. so there's no apparent need to add more fundamentals to libgobject for shorts.
Ok not add fundamentals types, but what about to set/get short values in a GValue, unless you need to derive a GType for shots using the fundamental type G_TYPE_INT, and have any way to convert to a gshort. Please, take in a count, that using generic store like GValue, needs allow the developer to know the current value stored in the GValue and have a transformation function to/from INT or STRING in order to create a generic code to handle values (for example, transform to/from a STRING a list of GValues, to store them in a GtkTreeStore or so).
Note that Daniel is using GValue in the libgda API for database values, so he really does need to preserve the extra types, without morphing everything into a few basic types.
he can easily create his own short type if he needs one...