2003-10-15 Mike Kestner <mkestner@ximian.com>

* generator/Property.cs : use new Opaque value ctor and
	rework get/set blocks for Opaque types. [Fixes #47959]
	* glib/Opaque.cs : kill explicit IntPtr operator.
	* glib/Value.cs : rework Opaque value ctor.

svn path=/trunk/gtk-sharp/; revision=19088
This commit is contained in:
Mike Kestner 2003-10-15 20:13:50 +00:00
parent 63887acbb5
commit 686688d760
4 changed files with 16 additions and 7 deletions

View file

@ -1,3 +1,11 @@
2003-10-15 Mike Kestner <mkestner@ximian.com>
* generator/Property.cs : use new Opaque value ctor and
rework get/set blocks for Opaque types. [Fixes #47959]
* glib/Opaque.cs : kill explicit IntPtr operator.
* glib/Value.cs : rework Opaque value ctor.
2003-10-14 Mike Kestner <mkestner@ximian.com> 2003-10-14 Mike Kestner <mkestner@ximian.com>
* gtk/Gtk.metadata : rule for ClipboardGetFunc * gtk/Gtk.metadata : rule for ClipboardGetFunc

View file

@ -119,13 +119,16 @@ namespace GtkSharp.Generation {
sw.WriteLine("\t\t\tget {"); sw.WriteLine("\t\t\tget {");
sw.WriteLine("\t\t\t\tGLib.Value val = new GLib.Value (Handle, " + cname + ");"); sw.WriteLine("\t\t\t\tGLib.Value val = new GLib.Value (Handle, " + cname + ");");
sw.WriteLine("\t\t\t\tGetProperty(" + cname + ", val);"); sw.WriteLine("\t\t\t\tGetProperty(" + cname + ", val);");
if (table.IsObject (c_type) || table.IsOpaque (c_type) || table.IsBoxed (c_type)) { if (table.IsObject (c_type)) {
sw.WriteLine("\t\t\t\tSystem.IntPtr raw_ret = (System.IntPtr) {0} val;", v_type); sw.WriteLine("\t\t\t\tSystem.IntPtr raw_ret = (System.IntPtr) {0} val;", v_type);
if (table.IsObject (c_type)) if (table.IsObject (c_type))
sw.WriteLine ("\t\t\t\tbool ref_owned = false;"); sw.WriteLine ("\t\t\t\tbool ref_owned = false;");
sw.WriteLine("\t\t\t\t" + cs_type + " ret = " + table.FromNativeReturn(c_type, "raw_ret") + ";"); sw.WriteLine("\t\t\t\t" + cs_type + " ret = " + table.FromNativeReturn(c_type, "raw_ret") + ";");
if (!table.IsBoxed (c_type) && !table.IsObject (c_type)) if (!table.IsBoxed (c_type) && !table.IsObject (c_type))
sw.WriteLine("\t\t\t\tif (ret == null) ret = new " + cs_type + "(raw_ret);"); sw.WriteLine("\t\t\t\tif (ret == null) ret = new " + cs_type + "(raw_ret);");
} else if (table.IsOpaque (c_type) || table.IsBoxed (c_type)) {
sw.WriteLine("\t\t\t\tSystem.IntPtr raw_ret = val.Handle;");
sw.WriteLine("\t\t\t\t" + cs_type + " ret = " + table.FromNativeReturn(c_type, "raw_ret") + ";");
} else { } else {
sw.Write("\t\t\t\t" + cs_type + " ret = "); sw.Write("\t\t\t\t" + cs_type + " ret = ");
sw.Write ("(" + cs_type + ") "); sw.Write ("(" + cs_type + ") ");
@ -150,6 +153,8 @@ namespace GtkSharp.Generation {
sw.WriteLine("Handle, " + cname + ", new GLib.EnumWrapper ((int) value, {0})));", table.IsEnumFlags (c_type) ? "true" : "false"); sw.WriteLine("Handle, " + cname + ", new GLib.EnumWrapper ((int) value, {0})));", table.IsEnumFlags (c_type) ? "true" : "false");
} else if (table.IsBoxed (c_type)) { } else if (table.IsBoxed (c_type)) {
sw.WriteLine("Handle, " + cname + ", new GLib.Boxed (value)));"); sw.WriteLine("Handle, " + cname + ", new GLib.Boxed (value)));");
} else if (table.IsOpaque (c_type)) {
sw.WriteLine("Handle, " + cname + ", value));");
} else { } else {
if (v_type != "" && !(table.IsObject (c_type) || table.IsOpaque (c_type))) { if (v_type != "" && !(table.IsObject (c_type) || table.IsOpaque (c_type))) {
sw.Write(v_type + " "); sw.Write(v_type + " ");

View file

@ -130,9 +130,5 @@ namespace GLib {
{ {
return Handle.GetHashCode (); return Handle.GetHashCode ();
} }
public static explicit operator System.IntPtr (Opaque opaque) {
return opaque.Handle;
}
} }
} }

View file

@ -132,9 +132,9 @@ namespace GLib {
//g_value_set_boxed (_val, val.Handle); //g_value_set_boxed (_val, val.Handle);
} }
public Value (GLib.Opaque val) public Value (IntPtr obj, string prop_name, Opaque val)
{ {
_val = gtksharp_value_create((uint) TypeFundamentals.TypeBoxed); _val = gtksharp_value_create_from_property (obj, prop_name);
g_value_set_boxed (_val, val.Handle); g_value_set_boxed (_val, val.Handle);
} }