diff --git a/gapi.xsd b/gapi.xsd index e0316c19e..7eae62f9a 100644 --- a/gapi.xsd +++ b/gapi.xsd @@ -77,6 +77,7 @@ + diff --git a/generator/StructBase.cs b/generator/StructBase.cs index 9288fc3a4..2953d4709 100644 --- a/generator/StructBase.cs +++ b/generator/StructBase.cs @@ -123,8 +123,6 @@ namespace GtkSharp.Generation { StringBuilder hashcode = new StringBuilder (); StringBuilder equals = new StringBuilder (); - sw.WriteLine ("\t\tpublic bool Equals ({0} other)", Name); - sw.WriteLine ("\t\t{"); hashcode.Append ("this.GetType ().FullName.GetHashCode ()"); equals.Append ("true"); @@ -156,15 +154,20 @@ namespace GtkSharp.Generation { hashcode.Append (".GetHashCode ()"); } } - sw.WriteLine ("\t\t\treturn {0};", equals.ToString ()); - sw.WriteLine ("\t\t}"); - sw.WriteLine (); + + if (!Elem.GetAttributeAsBoolean ("noequals")) { + sw.WriteLine ("\t\tpublic bool Equals ({0} other)", Name); + sw.WriteLine ("\t\t{"); + sw.WriteLine ("\t\t\treturn {0};", equals.ToString ()); + sw.WriteLine ("\t\t}"); + sw.WriteLine (); + } sw.WriteLine ("\t\tpublic override bool Equals (object other)"); sw.WriteLine ("\t\t{"); sw.WriteLine ("\t\t\treturn other is {0} && Equals (({0}) other);", Name); sw.WriteLine ("\t\t}"); sw.WriteLine (); - if (Elem.GetAttribute ("nohash") == "true") + if (Elem.GetAttributeAsBoolean ("nohash")) return; sw.WriteLine ("\t\tpublic override int GetHashCode ()"); sw.WriteLine ("\t\t{");