2009-05-13 Sebastian Dröge <sebastian.droege@collabora.co.uk>

* glib/Value.cs: return int object value for GType.Enum values if
	the explicit gtype is not found.  [Fixes #503060]

svn path=/trunk/gtk-sharp/; revision=134075
This commit is contained in:
Mike Kestner 2009-05-13 19:27:39 +00:00
parent 95c418fe40
commit 8bb550b893
2 changed files with 20 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2009-05-13 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* glib/Value.cs: return int object value for GType.Enum values if
the explicit gtype is not found. [Fixes #503060]
2009-05-13 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* glib/ValueArray.cs: use type specific PtrToStructure marshaling to

View file

@ -393,6 +393,20 @@ namespace GLib {
this = (GLib.Value) parameters[0];
}
object ToEnum ()
{
Type t = GType.LookupType (type);
if (t == null) {
if (HoldsFlags)
return g_value_get_flags (ref this);
else
return g_value_get_enum (ref this);
} else {
return (Enum) this;
}
}
object ToBoxed ()
{
IntPtr boxed_ptr = g_value_get_boxed (ref this);
@ -428,7 +442,7 @@ namespace GLib {
return (ulong) this;
else if (GType.Is (type, GType.Enum) ||
GType.Is (type, GType.Flags))
return (Enum) this;
return ToEnum ();
else if (type == GType.Float.Val)
return (float) this;
else if (type == GType.Double.Val)