2004-02-17 Radek Doulik <rodo@ximian.com>

* glib/Value.cs: use g_value_set_pointer for
	GType.Pointer/IWrapper objects

	* glib/TypeConverter.cs: return GType.Pointer for Opaque objects
	which do not have GType property

svn path=/trunk/gtk-sharp/; revision=23197
This commit is contained in:
Radek Doulik 2004-02-17 21:49:24 +00:00
parent d8fa643aca
commit 21ddf92108
3 changed files with 14 additions and 0 deletions

View file

@ -1,3 +1,11 @@
2004-02-17 Radek Doulik <rodo@ximian.com>
* glib/Value.cs: use g_value_set_pointer for
GType.Pointer/IWrapper objects
* glib/TypeConverter.cs: return GType.Pointer for Opaque objects
which do not have GType property
2004-02-17 John Luke <jluke@cfl.rr.com>
* gdk/Gdk.metadata: set Gdk.Window.Cursor null_ok

View file

@ -42,6 +42,8 @@ namespace GLibSharp {
PropertyInfo pi = type.GetProperty ("GType", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
if (pi != null)
return (GType) pi.GetValue (null, null);
if (type.IsSubclassOf (typeof (GLib.Opaque)))
return GType.Pointer;
if (type.IsValueType)
return GType.Pointer;

View file

@ -392,6 +392,10 @@ namespace GLib {
else if (type == GType.Object)
g_value_set_object (_val, ((GLib.Object) obj).Handle);
else if (type == GType.Pointer) {
if (obj is IWrapper) {
g_value_set_pointer (_val, ((IWrapper)obj).Handle);
return;
}
buf = Marshal.AllocHGlobal (Marshal.SizeOf (obj.GetType()));
Marshal.StructureToPtr (obj, buf, false);
g_value_set_pointer (_val, buf);