diff --git a/ChangeLog b/ChangeLog index 69331123a..3ea540fd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-10-15 Mike Kestner + + * 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 * gtk/Gtk.metadata : rule for ClipboardGetFunc diff --git a/generator/Property.cs b/generator/Property.cs index 623c0d4c6..bb6666a04 100644 --- a/generator/Property.cs +++ b/generator/Property.cs @@ -119,13 +119,16 @@ namespace GtkSharp.Generation { sw.WriteLine("\t\t\tget {"); sw.WriteLine("\t\t\t\tGLib.Value val = new GLib.Value (Handle, " + cname + ");"); 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); if (table.IsObject (c_type)) sw.WriteLine ("\t\t\t\tbool ref_owned = false;"); sw.WriteLine("\t\t\t\t" + cs_type + " ret = " + table.FromNativeReturn(c_type, "raw_ret") + ";"); if (!table.IsBoxed (c_type) && !table.IsObject (c_type)) 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 { sw.Write("\t\t\t\t" + cs_type + " ret = "); 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"); } else if (table.IsBoxed (c_type)) { sw.WriteLine("Handle, " + cname + ", new GLib.Boxed (value)));"); + } else if (table.IsOpaque (c_type)) { + sw.WriteLine("Handle, " + cname + ", value));"); } else { if (v_type != "" && !(table.IsObject (c_type) || table.IsOpaque (c_type))) { sw.Write(v_type + " "); diff --git a/glib/Opaque.cs b/glib/Opaque.cs index 24c15cd5f..2074d4010 100644 --- a/glib/Opaque.cs +++ b/glib/Opaque.cs @@ -130,9 +130,5 @@ namespace GLib { { return Handle.GetHashCode (); } - - public static explicit operator System.IntPtr (Opaque opaque) { - return opaque.Handle; - } } } diff --git a/glib/Value.cs b/glib/Value.cs index a54cde52a..d4d09446b 100755 --- a/glib/Value.cs +++ b/glib/Value.cs @@ -132,9 +132,9 @@ namespace GLib { //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); }