--- ../gtk-sharp/glib/Argv.cs 2005-03-08 22:28:08.000000000 +0100 +++ glib-sharp/Argv.cs 2009-08-05 16:48:02.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/Boxed.cs 2004-10-21 03:08:10.000000000 +0200 +++ glib-sharp/Boxed.cs 2009-08-05 16:48:02.000000000 +0200 @@ -18,7 +18,7 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; --- ../gtk-sharp/glib/CDeclCallbackAttribute.cs 2009-07-02 22:18:10.000000000 +0200 +++ glib-sharp/CDeclCallbackAttribute.cs 2009-08-05 16:48:02.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; --- ../gtk-sharp/glib/ClassInitializerAttribute.cs 2007-09-07 16:40:46.000000000 +0200 +++ glib-sharp/ClassInitializerAttribute.cs 2009-08-05 16:48:02.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; --- ../gtk-sharp/glib/ConnectBeforeAttribute.cs 2004-06-25 20:42:19.000000000 +0200 +++ glib-sharp/ConnectBeforeAttribute.cs 2009-08-05 16:48:02.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; --- ../gtk-sharp/glib/DefaultSignalHandlerAttribute.cs 2004-06-25 20:42:19.000000000 +0200 +++ glib-sharp/DefaultSignalHandlerAttribute.cs 2009-08-05 16:48:02.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; --- ../gtk-sharp/glib/DelegateWrapper.cs 2009-07-02 22:18:10.000000000 +0200 +++ glib-sharp/DelegateWrapper.cs 2009-08-05 16:48:02.000000000 +0200 @@ -22,7 +22,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/DestroyNotify.cs 2009-07-02 22:18:10.000000000 +0200 +++ glib-sharp/DestroyNotify.cs 2009-08-05 16:48:02.000000000 +0200 @@ -18,7 +18,7 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/EnumWrapper.cs 2005-07-22 20:36:50.000000000 +0200 +++ glib-sharp/EnumWrapper.cs 2009-08-05 16:48:02.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/ExceptionManager.cs 2007-03-08 21:28:24.000000000 +0100 +++ glib-sharp/ExceptionManager.cs 2009-08-05 16:48:02.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; --- ../gtk-sharp/glib/FileUtils.cs 2005-03-08 22:28:08.000000000 +0100 +++ glib-sharp/FileUtils.cs 2009-08-05 16:48:02.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Text; --- ../gtk-sharp/glib/Format.cs 2008-11-21 17:42:46.000000000 +0100 +++ glib-sharp/Format.cs 2009-08-05 16:48:02.000000000 +0200 @@ -23,7 +23,7 @@ using System; using System.Runtime.InteropServices; -namespace GLib { +namespace Gst.GLib { #if GTK_SHARP_2_14 public class Format { [DllImport("libglib-2.0-0.dll")] --- ../gtk-sharp/glib/GException.cs 2008-12-19 19:57:42.000000000 +0100 +++ glib-sharp/GException.cs 2009-08-05 16:48:02.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/GInterfaceAdapter.cs 2009-07-21 08:51:10.000000000 +0200 +++ glib-sharp/GInterfaceAdapter.cs 2009-08-05 16:48:02.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/GInterfaceAttribute.cs 2007-09-11 22:34:24.000000000 +0200 +++ glib-sharp/GInterfaceAttribute.cs 2009-08-05 16:48:02.000000000 +0200 @@ -17,7 +17,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; --- ../gtk-sharp/glib/Global.cs 2008-11-21 17:54:10.000000000 +0100 +++ glib-sharp/Global.cs 2009-08-05 16:48:02.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Text; --- ../gtk-sharp/glib/GString.cs 2005-03-08 22:28:08.000000000 +0100 +++ glib-sharp/GString.cs 2009-08-05 16:48:02.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/GTypeAttribute.cs 2005-05-04 18:54:24.000000000 +0200 +++ glib-sharp/GTypeAttribute.cs 2009-08-05 16:48:02.000000000 +0200 @@ -17,7 +17,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; --- ../gtk-sharp/glib/GType.cs 2009-08-01 19:20:35.000000000 +0200 +++ glib-sharp/GType.cs 2009-08-05 16:48:02.000000000 +0200 @@ -20,7 +20,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/Idle.cs 2009-07-02 22:18:10.000000000 +0200 +++ glib-sharp/Idle.cs 2009-08-05 16:48:03.000000000 +0200 @@ -24,7 +24,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/IgnoreClassInitializersAttribute.cs 2007-09-07 16:40:46.000000000 +0200 +++ glib-sharp/IgnoreClassInitializersAttribute.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; --- ../gtk-sharp/glib/InitiallyUnowned.cs 2006-05-10 19:13:30.000000000 +0200 +++ glib-sharp/InitiallyUnowned.cs 2009-08-05 16:48:03.000000000 +0200 @@ -20,7 +20,7 @@ #if GTK_SHARP_2_10 -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/IOChannel.cs 2009-07-02 22:18:10.000000000 +0200 +++ glib-sharp/IOChannel.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLibSharp { +namespace Gst.GLibSharp { using System; using System.Runtime.InteropServices; @@ -51,7 +51,7 @@ } } -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/IWrapper.cs 2004-06-25 20:42:19.000000000 +0200 +++ glib-sharp/IWrapper.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib +namespace Gst.GLib { using System; --- ../gtk-sharp/glib/ListBase.cs 2009-04-09 16:38:16.000000000 +0200 +++ glib-sharp/ListBase.cs 2009-08-05 16:48:03.000000000 +0200 @@ -20,7 +20,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/List.cs 2008-12-19 19:57:42.000000000 +0100 +++ glib-sharp/List.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/Log.cs 2005-03-08 22:28:08.000000000 +0100 +++ glib-sharp/Log.cs 2009-08-05 16:48:03.000000000 +0200 @@ -22,7 +22,7 @@ // -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/MainContext.cs 2005-10-07 23:33:30.000000000 +0200 +++ glib-sharp/MainContext.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/MainLoop.cs 2004-08-25 20:11:41.000000000 +0200 +++ glib-sharp/MainLoop.cs 2009-08-05 16:48:03.000000000 +0200 @@ -21,7 +21,7 @@ using System; using System.Runtime.InteropServices; -namespace GLib { +namespace Gst.GLib { public class MainLoop { private IntPtr handle; --- ../gtk-sharp/glib/ManagedValue.cs 2009-07-02 22:18:10.000000000 +0200 +++ glib-sharp/ManagedValue.cs 2009-08-05 16:54:43.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; using System.Runtime.InteropServices; @@ -76,7 +76,7 @@ copy = new CopyFunc (Copy); free = new FreeFunc (Free); - IntPtr name = Marshaller.StringToPtrGStrdup ("GtkSharpValue"); + IntPtr name = Marshaller.StringToPtrGStrdup ("GstGLibSharpValue"); boxed_type = new GLib.GType (g_boxed_type_register_static (name, copy, free)); Marshaller.Free (name); } --- ../gtk-sharp/glib/Markup.cs 2005-03-08 22:28:08.000000000 +0100 +++ glib-sharp/Markup.cs 2009-08-05 16:48:03.000000000 +0200 @@ -23,7 +23,7 @@ using System; using System.Runtime.InteropServices; -namespace GLib { +namespace Gst.GLib { public class Markup { --- ../gtk-sharp/glib/Marshaller.cs 2009-01-08 19:43:00.000000000 +0100 +++ glib-sharp/Marshaller.cs 2009-08-05 16:48:03.000000000 +0200 @@ -21,7 +21,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/MissingIntPtrCtorException.cs 2004-06-25 20:42:19.000000000 +0200 +++ glib-sharp/MissingIntPtrCtorException.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/NotifyHandler.cs 2005-03-08 22:28:08.000000000 +0100 +++ glib-sharp/NotifyHandler.cs 2009-08-05 16:48:03.000000000 +0200 @@ -14,7 +14,7 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/Object.cs 2009-07-02 22:18:10.000000000 +0200 +++ glib-sharp/Object.cs 2009-08-05 16:48:03.000000000 +0200 @@ -20,7 +20,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; @@ -185,21 +185,23 @@ } } + [StructLayout(LayoutKind.Sequential)] struct GTypeClass { public IntPtr gtype; } + [StructLayout(LayoutKind.Sequential)] struct GObjectClass { GTypeClass type_class; IntPtr construct_props; - IntPtr constructor_cb; + public ConstructorDelegate constructor_cb; public SetPropertyDelegate set_prop_cb; public GetPropertyDelegate get_prop_cb; IntPtr dispose; IntPtr finalize; IntPtr dispatch_properties_changed; IntPtr notify; - IntPtr constructed; + public ConstructedDelegate constructed_cb; IntPtr dummy1; IntPtr dummy2; IntPtr dummy3; @@ -209,13 +211,36 @@ IntPtr dummy7; } + static Hashtable class_structs; + + static GObjectClass GetClassStruct (GLib.GType gtype, bool use_cache) + { + if (class_structs == null) + class_structs = new Hashtable (); + + if (use_cache && class_structs.Contains (gtype)) + return (GObjectClass) class_structs [gtype]; + else { + IntPtr class_ptr = gtype.ClassPtr; + GObjectClass class_struct = (GObjectClass) Marshal.PtrToStructure (class_ptr, typeof (GObjectClass)); + if (use_cache) + class_structs.Add (gtype, class_struct); + return class_struct; + } + } + + static void OverrideClassStruct (GLib.GType gtype, GObjectClass class_struct) + { + IntPtr class_ptr = gtype.ClassPtr; + Marshal.StructureToPtr (class_struct, class_ptr, false); + } + static void OverridePropertyHandlers (GType gtype, GetPropertyDelegate get_cb, SetPropertyDelegate set_cb) { - IntPtr class_ptr = gtype.ClassPtr; - GObjectClass klass = (GObjectClass) Marshal.PtrToStructure (class_ptr, typeof (GObjectClass)); + GObjectClass klass = GetClassStruct (gtype, false); klass.get_prop_cb = get_cb; klass.set_prop_cb = set_cb; - Marshal.StructureToPtr (klass, class_ptr, false); + OverrideClassStruct (gtype, klass); } [DllImport("libgobject-2.0-0.dll")] @@ -230,9 +255,68 @@ return pspec.Handle; } + static ConstructorDelegate Constructor_cb = new ConstructorDelegate (constructor_cb); + delegate IntPtr ConstructorDelegate (IntPtr gtype, uint n_construct_properties, IntPtr construct_properties); + + [StructLayout(LayoutKind.Sequential)] + struct GObjectConstructParam { + public IntPtr pspec; + public IntPtr value; + } + + static IntPtr constructor_cb (IntPtr gtype, uint n_construct_properties, IntPtr construct_properties) + { + GType type = new GLib.GType (gtype); + IntPtr instance = GetClassStruct (type.ThresholdType, false).constructor_cb (gtype, n_construct_properties, construct_properties); + for (int i = 0; i < n_construct_properties; i++) { + IntPtr p = new IntPtr ((long) construct_properties + i * Marshal.SizeOf (typeof (GObjectConstructParam))); + + GObjectConstructParam cparam = (GObjectConstructParam) Marshal.PtrToStructure (p, typeof (GObjectConstructParam)); + + ParamSpec pspec = new ParamSpec (cparam.pspec); + GLib.Value val = (Value) Marshal.PtrToStructure (cparam.value, typeof (Value)); + + if (pspec.Name == "gtk-sharp-managed-instance" && (IntPtr) val.Val != IntPtr.Zero) { + GCHandle gch = (GCHandle) (IntPtr) val.Val; + Object o = (GLib.Object) gch.Target; + o.Raw = instance; + } + } + + return instance; + } + + static ConstructedDelegate Constructed_cb = new ConstructedDelegate (constructed_cb); + [GLib.CDeclCallback] + delegate void ConstructedDelegate (IntPtr o); + + static void constructed_cb (IntPtr o) + { + GLib.Object __obj = GLib.Object.GetObject (o, false) as GLib.Object; + ConstructedDelegate unmanaged = GetClassStruct (__obj.LookupGType ().ThresholdType, true).constructed_cb; + if (unmanaged != null) + unmanaged (__obj.Handle); + } + + static SetPropertyDelegate Set_prop_dummy_cb = new SetPropertyDelegate (set_prop_dummy_cb); + static void set_prop_dummy_cb (IntPtr GObject, uint property_id, ref GLib.Value value, IntPtr pspec) {} + static void AddProperties (GType gtype, System.Type t) { uint idx = 1; + + if (gtype.BaseType == gtype.ThresholdType) { + GObjectClass gobject_class = GetClassStruct (gtype, false); + gobject_class.constructor_cb = Constructor_cb; + gobject_class.constructed_cb = Constructed_cb; + gobject_class.set_prop_cb = Set_prop_dummy_cb; + OverrideClassStruct (gtype, gobject_class); + + IntPtr declaring_class = gtype.ClassPtr; + ParamSpec pspec = new ParamSpec ("gtk-sharp-managed-instance", "", "", GType.Pointer, ParamFlags.Writable | ParamFlags.ConstructOnly); + g_object_class_install_property (declaring_class, idx, pspec.Handle); + idx++; + } bool handlers_overridden = false; foreach (PropertyInfo pinfo in t.GetProperties (BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly)) { @@ -262,6 +346,9 @@ static void GetPropertyCallback (IntPtr handle, uint property_id, ref GLib.Value value, IntPtr param_spec) { + if (!Properties.Contains (param_spec)) + return; + GLib.Object obj = GLib.Object.GetObject (handle, false); value.Val = (Properties [param_spec] as PropertyInfo).GetValue (obj, new object [0]); } @@ -280,6 +367,9 @@ static void SetPropertyCallback(IntPtr handle, uint property_id, ref GLib.Value value, IntPtr param_spec) { + if (!Properties.Contains (param_spec)) + return; + GLib.Object obj = GLib.Object.GetObject (handle, false); (Properties [param_spec] as PropertyInfo).SetValue (obj, value.Val, new object [0]); } @@ -366,12 +456,28 @@ protected virtual void CreateNativeObject (string[] names, GLib.Value[] vals) { - GParameter[] parms = new GParameter [names.Length]; + GLib.GType gtype = LookupGType (); + bool managed_type = gtype.ToString().StartsWith ("__gtksharp_"); + + GParameter[] parms = new GParameter [names.Length + ((managed_type) ? 1 : 0)]; + for (int i = 0; i < names.Length; i++) { parms [i].name = GLib.Marshaller.StringToPtrGStrdup (names [i]); parms [i].val = vals [i]; } - Raw = g_object_newv (LookupGType ().Val, parms.Length, parms); + + if (managed_type) { + GCHandle gch = GCHandle.Alloc (this); + parms[names.Length].name = GLib.Marshaller.StringToPtrGStrdup ("gtk-sharp-managed-instance"); + parms[names.Length].val = new GLib.Value ((IntPtr) gch); + + Raw = g_object_newv (gtype.Val, parms.Length, parms); + + gch.Free (); + } else { + Raw = g_object_newv (gtype.Val, parms.Length, parms); + } + foreach (GParameter p in parms) GLib.Marshaller.Free (p.name); } @@ -599,10 +705,12 @@ return g_type_check_instance_is_a (obj, GType.Object.Val); } + [StructLayout(LayoutKind.Sequential)] struct GTypeInstance { public IntPtr g_class; } + [StructLayout(LayoutKind.Sequential)] struct GObject { public GTypeInstance type_instance; public uint ref_count; --- ../gtk-sharp/glib/ObjectManager.cs 2008-12-19 19:57:42.000000000 +0100 +++ glib-sharp/ObjectManager.cs 2009-08-05 16:48:03.000000000 +0200 @@ -20,7 +20,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/Opaque.cs 2009-01-29 17:26:09.000000000 +0100 +++ glib-sharp/Opaque.cs 2009-08-05 16:48:03.000000000 +0200 @@ -24,7 +24,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/ParamSpec.cs 2009-04-21 10:11:35.000000000 +0200 +++ glib-sharp/ParamSpec.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,50 +19,49 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; internal enum ParamFlags { - None = 0, - Readable = 1 << 0, - Writable = 1 << 1, + None = 0, + Readable = 1 << 0, + Writable = 1 << 1, + Construct = 1 << 2, + ConstructOnly = 1 << 3, } public class ParamSpec { IntPtr handle; - public ParamSpec (string name, string nick, string blurb, GType type, bool readable, bool writable) - { - ParamFlags pflags = ParamFlags.None; - if (readable) pflags |= ParamFlags.Readable; - if (writable) pflags |= ParamFlags.Writable; + private static IntPtr CreateParamSpec (string name, string nick, string blurb, GType type, ParamFlags pflags) { int flags = (int) pflags; + IntPtr ret; IntPtr p_name = GLib.Marshaller.StringToPtrGStrdup (name); IntPtr p_nick = GLib.Marshaller.StringToPtrGStrdup (nick); IntPtr p_blurb = GLib.Marshaller.StringToPtrGStrdup (blurb); if (type == GType.Char) - handle = g_param_spec_char (p_name, p_nick, p_blurb, SByte.MinValue, SByte.MaxValue, 0, flags); + ret = g_param_spec_char (p_name, p_nick, p_blurb, SByte.MinValue, SByte.MaxValue, 0, flags); else if (type == GType.UChar) - handle = g_param_spec_uchar (p_name, p_nick, p_blurb, Byte.MinValue, Byte.MaxValue, 0, flags); + ret = g_param_spec_uchar (p_name, p_nick, p_blurb, Byte.MinValue, Byte.MaxValue, 0, flags); else if (type == GType.Boolean) - handle = g_param_spec_boolean (p_name, p_nick, p_blurb, false, flags); + ret = g_param_spec_boolean (p_name, p_nick, p_blurb, false, flags); else if (type == GType.Int) - handle = g_param_spec_int (p_name, p_nick, p_blurb, Int32.MinValue, Int32.MaxValue, 0, flags); + ret = g_param_spec_int (p_name, p_nick, p_blurb, Int32.MinValue, Int32.MaxValue, 0, flags); else if (type == GType.UInt) - handle = g_param_spec_uint (p_name, p_nick, p_blurb, 0, UInt32.MaxValue, 0, flags); + ret = g_param_spec_uint (p_name, p_nick, p_blurb, 0, UInt32.MaxValue, 0, flags); else if (type == GType.Long) - handle = g_param_spec_long (p_name, p_nick, p_blurb, IntPtr.Zero, IntPtr.Size == 4 ? new IntPtr (Int32.MaxValue) : new IntPtr (Int64.MaxValue), IntPtr.Zero, flags); + ret = g_param_spec_long (p_name, p_nick, p_blurb, IntPtr.Zero, IntPtr.Size == 4 ? new IntPtr (Int32.MaxValue) : new IntPtr (Int64.MaxValue), IntPtr.Zero, flags); else if (type == GType.ULong) - handle = g_param_spec_ulong (p_name, p_nick, p_blurb, UIntPtr.Zero, UIntPtr.Size == 4 ? new UIntPtr (UInt32.MaxValue) : new UIntPtr (UInt64.MaxValue), UIntPtr.Zero, flags); + ret = g_param_spec_ulong (p_name, p_nick, p_blurb, UIntPtr.Zero, UIntPtr.Size == 4 ? new UIntPtr (UInt32.MaxValue) : new UIntPtr (UInt64.MaxValue), UIntPtr.Zero, flags); else if (type == GType.Int64) - handle = g_param_spec_int64 (p_name, p_nick, p_blurb, Int64.MinValue, Int64.MaxValue, 0, flags); + ret = g_param_spec_int64 (p_name, p_nick, p_blurb, Int64.MinValue, Int64.MaxValue, 0, flags); else if (type == GType.UInt64) - handle = g_param_spec_uint64 (p_name, p_nick, p_blurb, 0, UInt64.MaxValue, 0, flags); + ret = g_param_spec_uint64 (p_name, p_nick, p_blurb, 0, UInt64.MaxValue, 0, flags); /* else if (type == GType.Enum) else if (type == GType.Flags) @@ -70,25 +69,40 @@ * Both g_param_spec_enum and g_param_spec_flags expect default property values and the members of the enum seemingly cannot be enumerated */ else if (type == GType.Float) - handle = g_param_spec_float (p_name, p_nick, p_blurb, Single.MinValue, Single.MaxValue, 0.0f, flags); + ret = g_param_spec_float (p_name, p_nick, p_blurb, Single.MinValue, Single.MaxValue, 0.0f, flags); else if (type == GType.Double) - handle = g_param_spec_double (p_name, p_nick, p_blurb, Double.MinValue, Double.MaxValue, 0.0, flags); + ret = g_param_spec_double (p_name, p_nick, p_blurb, Double.MinValue, Double.MaxValue, 0.0, flags); else if (type == GType.String) - handle = g_param_spec_string (p_name, p_nick, p_blurb, IntPtr.Zero, flags); + ret = g_param_spec_string (p_name, p_nick, p_blurb, IntPtr.Zero, flags); else if (type == GType.Pointer) - handle = g_param_spec_pointer (p_name, p_nick, p_blurb, flags); + ret = g_param_spec_pointer (p_name, p_nick, p_blurb, flags); else if (type.Val == g_gtype_get_type ()) - handle = g_param_spec_gtype (p_name, p_nick, p_blurb, GType.None.Val, flags); + ret = g_param_spec_gtype (p_name, p_nick, p_blurb, GType.None.Val, flags); else if (g_type_is_a (type.Val, GType.Boxed.Val)) - handle = g_param_spec_boxed (p_name, p_nick, p_blurb, type.Val, flags); + ret = g_param_spec_boxed (p_name, p_nick, p_blurb, type.Val, flags); else if (g_type_is_a (type.Val, GType.Object.Val)) - handle = g_param_spec_object (p_name, p_nick, p_blurb, type.Val, flags); + ret = g_param_spec_object (p_name, p_nick, p_blurb, type.Val, flags); else throw new ArgumentException ("type"); GLib.Marshaller.Free (p_name); GLib.Marshaller.Free (p_nick); GLib.Marshaller.Free (p_blurb); + + return ret; + } + + internal ParamSpec (string name, string nick, string blurb, GType type, ParamFlags pflags) { + handle = CreateParamSpec (name, nick, blurb, type, pflags); + } + + public ParamSpec (string name, string nick, string blurb, GType type, bool readable, bool writable) + { + ParamFlags pflags = ParamFlags.None; + if (readable) pflags |= ParamFlags.Readable; + if (writable) pflags |= ParamFlags.Writable; + + handle = CreateParamSpec (name, nick, blurb, type, pflags); } public ParamSpec (IntPtr native) @@ -107,6 +121,13 @@ } } + public string Name { + get { + GParamSpec spec = (GParamSpec) Marshal.PtrToStructure (Handle, typeof (GParamSpec)); + return GLib.Marshaller.Utf8PtrToString (spec.name); + } + } + struct GTypeInstance { IntPtr g_class; } @@ -114,7 +135,7 @@ struct GParamSpec { GTypeInstance g_type_instance; - IntPtr name; + public IntPtr name; ParamFlags flags; public IntPtr value_type; IntPtr owner_type; --- ../gtk-sharp/glib/Priority.cs 2009-05-03 21:34:22.000000000 +0200 +++ glib-sharp/Priority.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { public enum Priority { High = -100, --- ../gtk-sharp/glib/PropertyAttribute.cs 2008-06-06 18:55:00.000000000 +0200 +++ glib-sharp/PropertyAttribute.cs 2009-08-05 16:48:03.000000000 +0200 @@ -17,7 +17,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; --- ../gtk-sharp/glib/PtrArray.cs 2008-12-19 19:57:42.000000000 +0100 +++ glib-sharp/PtrArray.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/SignalArgs.cs 2004-06-25 20:42:19.000000000 +0200 +++ glib-sharp/SignalArgs.cs 2009-08-05 16:48:03.000000000 +0200 @@ -20,7 +20,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/SignalAttribute.cs 2005-10-08 23:08:04.000000000 +0200 +++ glib-sharp/SignalAttribute.cs 2009-08-05 16:48:03.000000000 +0200 @@ -20,7 +20,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; --- ../gtk-sharp/glib/SignalCallback.cs 2005-03-08 22:28:08.000000000 +0100 +++ glib-sharp/SignalCallback.cs 2009-08-05 16:48:03.000000000 +0200 @@ -20,7 +20,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/SignalClosure.cs 2009-07-02 22:18:10.000000000 +0200 +++ glib-sharp/SignalClosure.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/Signal.cs 2009-07-02 22:18:10.000000000 +0200 +++ glib-sharp/Signal.cs 2009-08-05 16:48:03.000000000 +0200 @@ -20,7 +20,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/SList.cs 2008-12-19 19:57:42.000000000 +0100 +++ glib-sharp/SList.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/Source.cs 2008-02-21 17:32:03.000000000 +0100 +++ glib-sharp/Source.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/Spawn.cs 2009-07-02 22:18:10.000000000 +0200 +++ glib-sharp/Spawn.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/Thread.cs 2005-12-30 13:14:59.000000000 +0100 +++ glib-sharp/Thread.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/Timeout.cs 2009-07-02 22:18:10.000000000 +0200 +++ glib-sharp/Timeout.cs 2009-08-05 16:48:03.000000000 +0200 @@ -22,7 +22,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/ToggleRef.cs 2009-07-02 22:18:10.000000000 +0200 +++ glib-sharp/ToggleRef.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/TypeConverter.cs 2005-05-04 18:54:24.000000000 +0200 +++ glib-sharp/TypeConverter.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; public class TypeConverter { --- ../gtk-sharp/glib/TypeFundamentals.cs 2004-07-09 17:25:39.000000000 +0200 +++ glib-sharp/TypeFundamentals.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { public enum TypeFundamentals { TypeInvalid = 0 << 2, --- ../gtk-sharp/glib/TypeInitializerAttribute.cs 2007-09-07 16:40:46.000000000 +0200 +++ glib-sharp/TypeInitializerAttribute.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; --- ../gtk-sharp/glib/UnwrappedObject.cs 2005-07-22 20:36:50.000000000 +0200 +++ glib-sharp/UnwrappedObject.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Runtime.InteropServices; --- ../gtk-sharp/glib/ValueArray.cs 2009-05-13 21:04:40.000000000 +0200 +++ glib-sharp/ValueArray.cs 2009-08-05 16:48:03.000000000 +0200 @@ -19,7 +19,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections; --- ../gtk-sharp/glib/Value.cs 2009-05-13 21:27:39.000000000 +0200 +++ glib-sharp/Value.cs 2009-08-05 16:48:03.000000000 +0200 @@ -20,7 +20,7 @@ // Boston, MA 02111-1307, USA. -namespace GLib { +namespace Gst.GLib { using System; using System.Collections;