mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
2004-08-25 Mike Kestner <mkestner@ximian.com>
* generator/Signal.cs : use typeof instead of Type.GetType to specify the event args type. * glib/ObjectManager.cs : beef up the type lookup code using Assembly.LoadWithPartialName to fix a very popular win32 bug. [Fixes #61139 and friends] Thanks to John Luke for expert patch testing on win32. svn path=/trunk/gtk-sharp/; revision=32831
This commit is contained in:
parent
0343bf93e6
commit
7a395905ac
@ -1,3 +1,12 @@
|
||||
2004-08-25 Mike Kestner <mkestner@ximian.com>
|
||||
|
||||
* generator/Signal.cs : use typeof instead of Type.GetType to
|
||||
specify the event args type.
|
||||
* glib/ObjectManager.cs : beef up the type lookup code using
|
||||
Assembly.LoadWithPartialName to fix a very popular win32 bug.
|
||||
[Fixes #61139 and friends] Thanks to John Luke for expert
|
||||
patch testing on win32.
|
||||
|
||||
2004-08-25 John Luke <john.luke@gmail.com>
|
||||
|
||||
* glib/MainLoop.cs: MainLoop implementation by Jeroen
|
||||
|
@ -268,20 +268,14 @@ namespace GtkSharp.Generation {
|
||||
sw.WriteLine("\t\t\t\tif (value.Method.GetCustomAttributes(typeof(GLib.ConnectBeforeAttribute), false).Length > 0) {");
|
||||
sw.WriteLine("\t\t\t\t\tif (BeforeHandlers[" + cname + "] == null)");
|
||||
sw.Write("\t\t\t\t\t\tBeforeSignals[" + cname + "] = new " + qual_marsh);
|
||||
sw.Write("(this, " + cname + ", value, System.Type.GetType(\"" + EventArgsQualifiedName);
|
||||
if (EventArgsQualifiedName != "System.EventArgs")
|
||||
sw.Write("," + gen_info.AssemblyName);
|
||||
sw.WriteLine("\"), 0);");
|
||||
sw.Write("(this, " + cname + ", value, typeof (" + EventArgsQualifiedName + "), 0);");
|
||||
sw.WriteLine("\t\t\t\t\telse");
|
||||
sw.WriteLine("\t\t\t\t\t\t((GLib.SignalCallback) BeforeSignals [{0}]).AddDelegate (value);", cname);
|
||||
sw.WriteLine("\t\t\t\t\tBeforeHandlers.AddHandler(" + cname + ", value);");
|
||||
sw.WriteLine("\t\t\t\t} else {");
|
||||
sw.WriteLine("\t\t\t\t\tif (AfterHandlers[" + cname + "] == null)");
|
||||
sw.Write("\t\t\t\t\t\tAfterSignals[" + cname + "] = new " + qual_marsh);
|
||||
sw.Write("(this, " + cname + ", value, System.Type.GetType(\"" + EventArgsQualifiedName);
|
||||
if (EventArgsQualifiedName != "System.EventArgs")
|
||||
sw.Write("," + gen_info.AssemblyName);
|
||||
sw.WriteLine("\"), 1);");
|
||||
sw.Write("(this, " + cname + ", value, typeof (" + EventArgsQualifiedName + "), 1);");
|
||||
sw.WriteLine("\t\t\t\t\telse");
|
||||
sw.WriteLine("\t\t\t\t\t\t((GLib.SignalCallback) AfterSignals [{0}]).AddDelegate (value);", cname);
|
||||
sw.WriteLine("\t\t\t\t\tAfterHandlers.AddHandler(" + cname + ", value);");
|
||||
|
@ -46,7 +46,7 @@ namespace GLib {
|
||||
mangled = (string)types[typename];
|
||||
else
|
||||
mangled = GetExpected (typename);
|
||||
Type t = Type.GetType (mangled);
|
||||
Type t = LookupType (mangled);
|
||||
|
||||
// if null, try to get a parent type
|
||||
if (t == null)
|
||||
@ -116,6 +116,20 @@ namespace GLib {
|
||||
[DllImport("glibsharpglue")]
|
||||
static extern IntPtr gtksharp_get_type_name_for_id (int typ);
|
||||
|
||||
static Type LookupType (string mangled)
|
||||
{
|
||||
string[] toks = mangled.Split (',');
|
||||
if (toks.Length < 2)
|
||||
throw new ArgumentException ("mangled not properly formatted: " + mangled);
|
||||
|
||||
Assembly a = Assembly.LoadWithPartialName (toks [1]);
|
||||
|
||||
if (a == null)
|
||||
return null;
|
||||
|
||||
return a.GetType (toks [0]);
|
||||
}
|
||||
|
||||
static Type GetValidParentType (IntPtr raw)
|
||||
{
|
||||
int type_id = gtksharp_get_type_id (raw);
|
||||
@ -130,7 +144,7 @@ namespace GLib {
|
||||
mangled = (string)types[typename];
|
||||
else
|
||||
mangled = GetExpected (typename);
|
||||
t = Type.GetType (mangled);
|
||||
t = LookupType (mangled);
|
||||
if (t != null) {
|
||||
return t;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user