From 0efb6ed5870b96b14b9c34c101bdcb719b31b562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 2 Jun 2009 12:39:07 +0200 Subject: [PATCH] The MiniObject.CreateNativeObject method does not and can't have parameters --- generator/Ctor.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/generator/Ctor.cs b/generator/Ctor.cs index e4ef118176..9284ed4bd0 100644 --- a/generator/Ctor.cs +++ b/generator/Ctor.cs @@ -32,6 +32,7 @@ namespace GtkSharp.Generation { private bool preferred; private string name; private bool needs_chaining = false; + private bool mini_object = false; public Ctor (XmlElement elem, ClassBase implementor) : base (elem, implementor) { @@ -40,6 +41,7 @@ namespace GtkSharp.Generation { if (implementor is ObjectGen || implementor is MiniObjectGen) needs_chaining = true; name = implementor.Name; + mini_object = implementor is MiniObjectGen; } public bool Preferred { @@ -110,9 +112,14 @@ namespace GtkSharp.Generation { sw.WriteLine ("\t\t\tif (GetType () != typeof (" + name + ")) {"); if (Parameters.Count == 0) { - sw.WriteLine ("\t\t\t\tCreateNativeObject (new string [0], new GLib.Value[0]);"); + if (mini_object) + sw.WriteLine ("\t\t\t\tCreateNativeObject ();"); + else + sw.WriteLine ("\t\t\t\tCreateNativeObject (new string [0], new GLib.Value[0]);"); sw.WriteLine ("\t\t\t\treturn;"); } else { + if (mini_object) + throw new Exception ("MiniObject subclasses can't have ctors with parameters"); ArrayList names = new ArrayList (); ArrayList values = new ArrayList (); for (int i = 0; i < Parameters.Count; i++) {