[gst-cvs] gstreamer-sharp: The MiniObject.CreateNativeObject method does not and can' t have parameters

Sebastian Dröge slomo at kemper.freedesktop.org
Wed Jun 3 01:22:43 PDT 2009


Module: gstreamer-sharp
Branch: master
Commit: 0efb6ed5870b96b14b9c34c101bdcb719b31b562
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer-sharp/commit/?id=0efb6ed5870b96b14b9c34c101bdcb719b31b562

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Tue Jun  2 12:39:07 2009 +0200

The MiniObject.CreateNativeObject method does not and can't have parameters

---

 generator/Ctor.cs |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/generator/Ctor.cs b/generator/Ctor.cs
index e4ef118..9284ed4 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++) {





More information about the Gstreamer-commits mailing list