mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
2008-12-22 Andrés G. Aragoneses <aaragoneses@novell.com>
* generator/InterfaceGen.cs: use the new GLib API to detect instances that don't implement GInterfaces. * glib/GType.cs: add new API for checking if an IntPtr instance implements a certain GType. [Fixes #448009] svn path=/trunk/gtk-sharp/; revision=121990
This commit is contained in:
parent
3a87d8d650
commit
8191911b26
@ -1,3 +1,11 @@
|
||||
2008-12-22 Andrés G. Aragoneses <aaragoneses@novell.com>
|
||||
|
||||
* generator/InterfaceGen.cs: use the new GLib API to detect
|
||||
instances that don't implement GInterfaces.
|
||||
* glib/GType.cs: add new API for checking if an IntPtr instance
|
||||
implements a certain GType.
|
||||
[Fixes #448009]
|
||||
|
||||
2008-12-20 Stephane Delcroix <sdelcroix@novell.con>
|
||||
|
||||
* glib/Timeout.cs: map AddSeconds ().
|
||||
|
@ -177,6 +177,8 @@ namespace GtkSharp.Generation {
|
||||
sw.WriteLine ();
|
||||
sw.WriteLine ("\t\tpublic " + Name + "Adapter (IntPtr handle)");
|
||||
sw.WriteLine ("\t\t{");
|
||||
sw.WriteLine ("\t\t\tif (!GLib.GType.IsInstance (handle, _gtype))");
|
||||
sw.WriteLine ("\t\t\t\tthrow new ArgumentException (\"The gobject doesn't implement the GInterface of this adapter\", \"handle\");");
|
||||
sw.WriteLine ("\t\t\tthis.handle = handle;");
|
||||
sw.WriteLine ("\t\t}");
|
||||
sw.WriteLine ();
|
||||
|
@ -334,6 +334,16 @@ namespace GLib {
|
||||
return Marshal.ReadIntPtr (klass);
|
||||
}
|
||||
|
||||
internal static bool Is (IntPtr type, GType is_a_type)
|
||||
{
|
||||
return g_type_is_a (type, is_a_type.Val);
|
||||
}
|
||||
|
||||
public static bool IsInstance (IntPtr raw, GType type)
|
||||
{
|
||||
return GType.Is (ValFromInstancePtr (raw), type);
|
||||
}
|
||||
|
||||
[DllImport("libgobject-2.0-0.dll")]
|
||||
static extern IntPtr g_type_class_peek (IntPtr gtype);
|
||||
|
||||
@ -354,5 +364,8 @@ namespace GLib {
|
||||
|
||||
[DllImport("libgobject-2.0-0.dll")]
|
||||
static extern IntPtr g_type_register_static (IntPtr parent, IntPtr name, ref GTypeInfo info, int flags);
|
||||
|
||||
[DllImport("libgobject-2.0-0.dll")]
|
||||
static extern bool g_type_is_a (IntPtr type, IntPtr is_a_type);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user