From 88a7a7305c3a88a42a99ba44f24d66b384b39889 Mon Sep 17 00:00:00 2001 From: Christian Hoff Date: Mon, 23 Nov 2009 17:19:46 +0000 Subject: [PATCH] 2009-11-23 Christian Hoff * generator/Signal.cs: Return a GInterfaceAdapter in the signalargs's accessor properties instead of trying to return the implementor as stored in the arguments array. svn path=/trunk/gtk-sharp/; revision=146744 --- ChangeLog | 6 ++++++ generator/Signal.cs | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78ac85b66..e930b3729 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-11-23 Christian Hoff + + * generator/Signal.cs: Return a GInterfaceAdapter in the signalargs's + accessor properties instead of trying to return the implementor as stored in + the arguments array. + 2009-11-01 Mike Kestner * glib/Value.cs: avoid cast exceptions passing ints as objects on diff --git a/generator/Signal.cs b/generator/Signal.cs index bd6937b0b..fa499bcfa 100644 --- a/generator/Signal.cs +++ b/generator/Signal.cs @@ -271,12 +271,18 @@ namespace GtkSharp.Generation { sw.WriteLine ("\t\tpublic " + parms[i].CSType + " " + parms[i].StudlyName + "{"); if (parms[i].PassAs != "out") { sw.WriteLine ("\t\t\tget {"); - sw.WriteLine ("\t\t\t\treturn (" + parms[i].CSType + ") Args[" + i + "];"); + if (SymbolTable.Table.IsInterface (parms [i].CType)) + sw.WriteLine ("\t\t\t\treturn {0}Adapter.GetObject (Args [{1}] as GLib.Object);", parms [i].CSType, i); + else + sw.WriteLine ("\t\t\t\treturn ({0}) Args [{1}];", parms [i].CSType, i); sw.WriteLine ("\t\t\t}"); } if (parms[i].PassAs != "") { sw.WriteLine ("\t\t\tset {"); - sw.WriteLine ("\t\t\t\tArgs[" + i + "] = (" + parms[i].CSType + ")value;"); + if (SymbolTable.Table.IsInterface (parms [i].CType)) + sw.WriteLine ("\t\t\t\tArgs [{0}] = value is {1}Adapter ? (value as {1}Adapter).Implementor : value;", i, parms [i].CSType); + else + sw.WriteLine ("\t\t\t\tArgs[" + i + "] = (" + parms[i].CSType + ")value;"); sw.WriteLine ("\t\t\t}"); } sw.WriteLine ("\t\t}");