On 9/7/18 8:19 PM, Russel Winder wrote:

This seems fine. I can even put a `PgFontDescription` object in with:

setValue(iter, ColumnNumber.fontDescription, fontDescription);

However I have no idea which version of `ListStore.setValue` is being used. In particular:

assert(Value.typeCompatible(PgFontDescription.getType, Value.getType));

always fails. The real problem I have is that:

auto object = model.getValue(iter, ColumnNumber.fontDescription);

returns but I have no idea how to get the actual `PgFontDescription` as:

assert(Value.typeCompatible(object.getType, PgFontDescription.getType));

fails. Clearly the `setValue` is not doing what I think it is doing,i.e. it is not creating a `Value` instance. Is it that `fontDescription` is actually being treated as an integer value?

Unfortunately there is currently no easy way to access the gType of the
thing contained in the Value as Value.getType or in this case
object.getType returns the GType of the Value its self.

The contained type is accessible in the C struct as a workaround:

object.getValueStruct().gType;

The actual setting of the value is handled by the gobject.Value
constructor:
https://github.com/gtkd-developers/GtkD/blob/master/generated/gtkd/gobject/Value.d#L86
So it's ultimately stored as a pointer.

We will need to ad a get template to Value to handle this properly,
but a pointer to the C version can be obtained with Value.getPointer.

Of course if you are using the FontDescription to change the font of a
row or cell you can use TreeViewCloumn.addAttribute to set the font
attribute of a CellRenderer.

column.addAttribute(aTextRenderer, "font-desc", 
ColumnNumber.fontDescription);