internal void LoadDefaultValues()
{
// This is a hack because there is no managed way of getting
// the default value of a GObject property.
// This method creates an dummy instance of this class and
// gets the values for their properties. Those values are
// considered the default
if (defaultValuesLoaded)
{
return;
}
defaultValuesLoaded = true;
object ob = NewInstance(null, false);
foreach (ItemGroup group in ItemGroups)
{
foreach (ItemDescriptor item in group)
{
TypedPropertyDescriptor prop = item as TypedPropertyDescriptor;
if (prop == null)
{
continue;
}
if (!prop.HasDefault)
{
prop.SetDefault(null);
}
else
{
object val = prop.GetValue(ob);
prop.SetDefault(val);
}
}
}
ObjectWrapper ww = ObjectWrapper.Lookup(ob);
ww.Dispose();
}