gstreamer/gstreamer-sharp/glib-sharp/gst-glib-sharp.diff
2009-09-11 10:14:42 +02:00

1069 lines
35 KiB
Diff

diff -Naur glib-sharp-upstream/Argv.cs glib-sharp/Argv.cs
--- glib-sharp-upstream/Argv.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/Argv.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
diff -Naur glib-sharp-upstream/Boxed.cs glib-sharp/Boxed.cs
--- glib-sharp-upstream/Boxed.cs 2004-10-21 03:08:10.000000000 +0200
+++ glib-sharp/Boxed.cs 2009-09-11 08:35:22.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;
diff -Naur glib-sharp-upstream/CDeclCallbackAttribute.cs glib-sharp/CDeclCallbackAttribute.cs
--- glib-sharp-upstream/CDeclCallbackAttribute.cs 2009-07-02 22:18:10.000000000 +0200
+++ glib-sharp/CDeclCallbackAttribute.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
diff -Naur glib-sharp-upstream/ClassInitializerAttribute.cs glib-sharp/ClassInitializerAttribute.cs
--- glib-sharp-upstream/ClassInitializerAttribute.cs 2007-09-07 16:40:46.000000000 +0200
+++ glib-sharp/ClassInitializerAttribute.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
diff -Naur glib-sharp-upstream/ConnectBeforeAttribute.cs glib-sharp/ConnectBeforeAttribute.cs
--- glib-sharp-upstream/ConnectBeforeAttribute.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/ConnectBeforeAttribute.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
diff -Naur glib-sharp-upstream/DefaultSignalHandlerAttribute.cs glib-sharp/DefaultSignalHandlerAttribute.cs
--- glib-sharp-upstream/DefaultSignalHandlerAttribute.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/DefaultSignalHandlerAttribute.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
diff -Naur glib-sharp-upstream/DelegateWrapper.cs glib-sharp/DelegateWrapper.cs
--- glib-sharp-upstream/DelegateWrapper.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/DelegateWrapper.cs 2009-09-11 08:35:22.000000000 +0200
@@ -22,7 +22,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/DestroyNotify.cs glib-sharp/DestroyNotify.cs
--- glib-sharp-upstream/DestroyNotify.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/DestroyNotify.cs 2009-09-11 08:35:22.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;
diff -Naur glib-sharp-upstream/EnumWrapper.cs glib-sharp/EnumWrapper.cs
--- glib-sharp-upstream/EnumWrapper.cs 2005-07-22 20:36:50.000000000 +0200
+++ glib-sharp/EnumWrapper.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
diff -Naur glib-sharp-upstream/ExceptionManager.cs glib-sharp/ExceptionManager.cs
--- glib-sharp-upstream/ExceptionManager.cs 2007-03-08 21:28:24.000000000 +0100
+++ glib-sharp/ExceptionManager.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
diff -Naur glib-sharp-upstream/FileUtils.cs glib-sharp/FileUtils.cs
--- glib-sharp-upstream/FileUtils.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/FileUtils.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Text;
diff -Naur glib-sharp-upstream/Format.cs glib-sharp/Format.cs
--- glib-sharp-upstream/Format.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/Format.cs 2009-09-11 08:35:22.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", CallingConvention = CallingConvention.Cdecl)]
diff -Naur glib-sharp-upstream/GException.cs glib-sharp/GException.cs
--- glib-sharp-upstream/GException.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/GException.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
diff -Naur glib-sharp-upstream/GInterfaceAdapter.cs glib-sharp/GInterfaceAdapter.cs
--- glib-sharp-upstream/GInterfaceAdapter.cs 2009-07-21 08:51:10.000000000 +0200
+++ glib-sharp/GInterfaceAdapter.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
diff -Naur glib-sharp-upstream/GInterfaceAttribute.cs glib-sharp/GInterfaceAttribute.cs
--- glib-sharp-upstream/GInterfaceAttribute.cs 2007-09-11 22:34:24.000000000 +0200
+++ glib-sharp/GInterfaceAttribute.cs 2009-09-11 08:35:22.000000000 +0200
@@ -17,7 +17,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
diff -Naur glib-sharp-upstream/glib-api.xml glib-sharp/glib-api.xml
diff -Naur glib-sharp-upstream/glib-sharp-3.0.pc.in glib-sharp/glib-sharp-3.0.pc.in
diff -Naur glib-sharp-upstream/glib-sharp.dll.config.in glib-sharp/glib-sharp.dll.config.in
diff -Naur glib-sharp-upstream/Global.cs glib-sharp/Global.cs
--- glib-sharp-upstream/Global.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/Global.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Text;
diff -Naur glib-sharp-upstream/glue/Makefile.am glib-sharp/glue/Makefile.am
diff -Naur glib-sharp-upstream/glue/thread.c glib-sharp/glue/thread.c
diff -Naur glib-sharp-upstream/glue/win32dll.c glib-sharp/glue/win32dll.c
diff -Naur glib-sharp-upstream/gst-glib-sharp.diff glib-sharp/gst-glib-sharp.diff
diff -Naur glib-sharp-upstream/GString.cs glib-sharp/GString.cs
--- glib-sharp-upstream/GString.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/GString.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
diff -Naur glib-sharp-upstream/GTypeAttribute.cs glib-sharp/GTypeAttribute.cs
--- glib-sharp-upstream/GTypeAttribute.cs 2005-05-04 18:54:24.000000000 +0200
+++ glib-sharp/GTypeAttribute.cs 2009-09-11 08:35:22.000000000 +0200
@@ -17,7 +17,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
diff -Naur glib-sharp-upstream/GType.cs glib-sharp/GType.cs
--- glib-sharp-upstream/GType.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/GType.cs 2009-09-11 08:35:22.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/Idle.cs glib-sharp/Idle.cs
--- glib-sharp-upstream/Idle.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/Idle.cs 2009-09-11 08:35:22.000000000 +0200
@@ -24,7 +24,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/IgnoreClassInitializersAttribute.cs glib-sharp/IgnoreClassInitializersAttribute.cs
--- glib-sharp-upstream/IgnoreClassInitializersAttribute.cs 2007-09-07 16:40:46.000000000 +0200
+++ glib-sharp/IgnoreClassInitializersAttribute.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
diff -Naur glib-sharp-upstream/InitiallyUnowned.cs glib-sharp/InitiallyUnowned.cs
--- glib-sharp-upstream/InitiallyUnowned.cs 2009-08-08 05:06:53.000000000 +0200
+++ glib-sharp/InitiallyUnowned.cs 2009-09-11 08:35:22.000000000 +0200
@@ -20,7 +20,7 @@
#if GTK_SHARP_2_10
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/IOChannel.cs glib-sharp/IOChannel.cs
--- glib-sharp-upstream/IOChannel.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/IOChannel.cs 2009-09-11 08:35:22.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;
diff -Naur glib-sharp-upstream/IWrapper.cs glib-sharp/IWrapper.cs
--- glib-sharp-upstream/IWrapper.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/IWrapper.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib
+namespace Gst.GLib
{
using System;
diff -Naur glib-sharp-upstream/ListBase.cs glib-sharp/ListBase.cs
--- glib-sharp-upstream/ListBase.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/ListBase.cs 2009-09-11 08:35:22.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/List.cs glib-sharp/List.cs
--- glib-sharp-upstream/List.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/List.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
diff -Naur glib-sharp-upstream/Log.cs glib-sharp/Log.cs
--- glib-sharp-upstream/Log.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/Log.cs 2009-09-11 08:35:22.000000000 +0200
@@ -22,7 +22,7 @@
//
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/MainContext.cs glib-sharp/MainContext.cs
--- glib-sharp-upstream/MainContext.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/MainContext.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
diff -Naur glib-sharp-upstream/MainLoop.cs glib-sharp/MainLoop.cs
--- glib-sharp-upstream/MainLoop.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/MainLoop.cs 2009-09-11 08:35:22.000000000 +0200
@@ -21,7 +21,7 @@
using System;
using System.Runtime.InteropServices;
-namespace GLib {
+namespace Gst.GLib {
public class MainLoop {
private IntPtr handle;
diff -Naur glib-sharp-upstream/Makefile.am glib-sharp/Makefile.am
diff -Naur glib-sharp-upstream/ManagedValue.cs glib-sharp/ManagedValue.cs
--- glib-sharp-upstream/ManagedValue.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/ManagedValue.cs 2009-09-11 08:35:22.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);
}
diff -Naur glib-sharp-upstream/Markup.cs glib-sharp/Markup.cs
--- glib-sharp-upstream/Markup.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/Markup.cs 2009-09-11 08:35:22.000000000 +0200
@@ -23,7 +23,7 @@
using System;
using System.Runtime.InteropServices;
-namespace GLib {
+namespace Gst.GLib {
public class Markup {
diff -Naur glib-sharp-upstream/Marshaller.cs glib-sharp/Marshaller.cs
--- glib-sharp-upstream/Marshaller.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/Marshaller.cs 2009-09-11 08:35:22.000000000 +0200
@@ -21,7 +21,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
diff -Naur glib-sharp-upstream/MissingIntPtrCtorException.cs glib-sharp/MissingIntPtrCtorException.cs
--- glib-sharp-upstream/MissingIntPtrCtorException.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/MissingIntPtrCtorException.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
diff -Naur glib-sharp-upstream/NotifyHandler.cs glib-sharp/NotifyHandler.cs
--- glib-sharp-upstream/NotifyHandler.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/NotifyHandler.cs 2009-09-11 08:35:22.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;
diff -Naur glib-sharp-upstream/Object.cs glib-sharp/Object.cs
--- glib-sharp-upstream/Object.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/Object.cs 2009-09-11 08:35:22.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,37 @@
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.GetClassPtr ();
+ 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.GetClassPtr ();
+ Marshal.StructureToPtr (class_struct, class_ptr, false);
+ }
+
+
static void OverridePropertyHandlers (GType gtype, GetPropertyDelegate get_cb, SetPropertyDelegate set_cb)
{
- IntPtr class_ptr = gtype.GetClassPtr ();
- 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", CallingConvention = CallingConvention.Cdecl)]
@@ -230,9 +256,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.GetThresholdType (), 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 ().GetThresholdType (), 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.GetBaseType () == gtype.GetThresholdType ()) {
+ 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.GetClassPtr ();
+ 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 +347,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 +368,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]);
}
@@ -360,12 +451,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);
}
@@ -593,10 +700,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;
diff -Naur glib-sharp-upstream/ObjectManager.cs glib-sharp/ObjectManager.cs
--- glib-sharp-upstream/ObjectManager.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/ObjectManager.cs 2009-09-11 08:35:22.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
diff -Naur glib-sharp-upstream/Opaque.cs glib-sharp/Opaque.cs
--- glib-sharp-upstream/Opaque.cs 2009-01-29 17:26:09.000000000 +0100
+++ glib-sharp/Opaque.cs 2009-09-11 08:35:22.000000000 +0200
@@ -24,7 +24,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/ParamSpec.cs glib-sharp/ParamSpec.cs
--- glib-sharp-upstream/ParamSpec.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/ParamSpec.cs 2009-09-11 08:35:22.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;
diff -Naur glib-sharp-upstream/Priority.cs glib-sharp/Priority.cs
--- glib-sharp-upstream/Priority.cs 2009-05-03 21:34:22.000000000 +0200
+++ glib-sharp/Priority.cs 2009-09-11 08:35:22.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,
diff -Naur glib-sharp-upstream/PropertyAttribute.cs glib-sharp/PropertyAttribute.cs
--- glib-sharp-upstream/PropertyAttribute.cs 2008-06-06 18:55:00.000000000 +0200
+++ glib-sharp/PropertyAttribute.cs 2009-09-11 08:35:22.000000000 +0200
@@ -17,7 +17,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
diff -Naur glib-sharp-upstream/PtrArray.cs glib-sharp/PtrArray.cs
--- glib-sharp-upstream/PtrArray.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/PtrArray.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/SignalArgs.cs glib-sharp/SignalArgs.cs
--- glib-sharp-upstream/SignalArgs.cs 2004-06-25 20:42:19.000000000 +0200
+++ glib-sharp/SignalArgs.cs 2009-09-11 08:35:22.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/SignalAttribute.cs glib-sharp/SignalAttribute.cs
--- glib-sharp-upstream/SignalAttribute.cs 2005-10-08 23:08:04.000000000 +0200
+++ glib-sharp/SignalAttribute.cs 2009-09-11 08:35:22.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
diff -Naur glib-sharp-upstream/SignalCallback.cs glib-sharp/SignalCallback.cs
--- glib-sharp-upstream/SignalCallback.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/SignalCallback.cs 2009-09-11 08:35:22.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;
diff -Naur glib-sharp-upstream/SignalClosure.cs glib-sharp/SignalClosure.cs
--- glib-sharp-upstream/SignalClosure.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/SignalClosure.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/Signal.cs glib-sharp/Signal.cs
--- glib-sharp-upstream/Signal.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/Signal.cs 2009-09-11 08:35:22.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/SList.cs glib-sharp/SList.cs
--- glib-sharp-upstream/SList.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/SList.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
diff -Naur glib-sharp-upstream/Source.cs glib-sharp/Source.cs
--- glib-sharp-upstream/Source.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/Source.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/Spawn.cs glib-sharp/Spawn.cs
--- glib-sharp-upstream/Spawn.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/Spawn.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
diff -Naur glib-sharp-upstream/Thread.cs glib-sharp/Thread.cs
--- glib-sharp-upstream/Thread.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/Thread.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib
+namespace Gst.GLib
{
using System;
using System.Runtime.InteropServices;
@@ -36,13 +36,13 @@
g_thread_init (IntPtr.Zero);
}
- [DllImport("glibsharpglue-3")]
- static extern bool glibsharp_g_thread_supported ();
+ [DllImport("gstreamersharpglue-0.10")]
+ static extern bool gstglibsharp_g_thread_supported ();
public static bool Supported
{
get {
- return glibsharp_g_thread_supported ();
+ return gstglibsharp_g_thread_supported ();
}
}
}
diff -Naur glib-sharp-upstream/Timeout.cs glib-sharp/Timeout.cs
--- glib-sharp-upstream/Timeout.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/Timeout.cs 2009-09-11 08:35:22.000000000 +0200
@@ -22,7 +22,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/ToggleRef.cs glib-sharp/ToggleRef.cs
--- glib-sharp-upstream/ToggleRef.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/ToggleRef.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/TypeConverter.cs glib-sharp/TypeConverter.cs
--- glib-sharp-upstream/TypeConverter.cs 2005-05-04 18:54:24.000000000 +0200
+++ glib-sharp/TypeConverter.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
public class TypeConverter {
diff -Naur glib-sharp-upstream/TypeFundamentals.cs glib-sharp/TypeFundamentals.cs
--- glib-sharp-upstream/TypeFundamentals.cs 2004-07-09 17:25:39.000000000 +0200
+++ glib-sharp/TypeFundamentals.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
public enum TypeFundamentals {
TypeInvalid = 0 << 2,
diff -Naur glib-sharp-upstream/TypeInitializerAttribute.cs glib-sharp/TypeInitializerAttribute.cs
--- glib-sharp-upstream/TypeInitializerAttribute.cs 2007-09-07 16:40:46.000000000 +0200
+++ glib-sharp/TypeInitializerAttribute.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
diff -Naur glib-sharp-upstream/UnwrappedObject.cs glib-sharp/UnwrappedObject.cs
--- glib-sharp-upstream/UnwrappedObject.cs 2005-07-22 20:36:50.000000000 +0200
+++ glib-sharp/UnwrappedObject.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Runtime.InteropServices;
diff -Naur glib-sharp-upstream/ValueArray.cs glib-sharp/ValueArray.cs
--- glib-sharp-upstream/ValueArray.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/ValueArray.cs 2009-09-11 08:35:22.000000000 +0200
@@ -19,7 +19,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;
diff -Naur glib-sharp-upstream/Value.cs glib-sharp/Value.cs
--- glib-sharp-upstream/Value.cs 2009-09-03 21:50:53.000000000 +0200
+++ glib-sharp/Value.cs 2009-09-11 08:35:22.000000000 +0200
@@ -20,7 +20,7 @@
// Boston, MA 02111-1307, USA.
-namespace GLib {
+namespace Gst.GLib {
using System;
using System.Collections;