Skip to content

Instantly share code, notes, and snippets.

@Therzok
Created December 11, 2017 08:01
Show Gist options
  • Save Therzok/92cf083b3e1157fa9f2a197e189648e7 to your computer and use it in GitHub Desktop.
Save Therzok/92cf083b3e1157fa9f2a197e189648e7 to your computer and use it in GitHub Desktop.
diff --git a/atk/generated/AtkSharp.EventListenerInitNative.cs b/atk/generated/AtkSharp.EventListenerInitNative.cs
index 2ba193b8c..7a2b1d7cc 100644
--- a/atk/generated/AtkSharp.EventListenerInitNative.cs
+++ b/atk/generated/AtkSharp.EventListenerInitNative.cs
@@ -10,65 +10,19 @@ namespace AtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void EventListenerInitNative();
- internal class EventListenerInitInvoker {
-
- EventListenerInitNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~EventListenerInitInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal EventListenerInitInvoker (EventListenerInitNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal EventListenerInitInvoker (EventListenerInitNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal EventListenerInitInvoker (EventListenerInitNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Atk.EventListenerInit Handler {
- get {
- return new Atk.EventListenerInit(InvokeNative);
- }
- }
-
- void InvokeNative ()
- {
- native_cb ();
- }
- }
-
internal class EventListenerInitWrapper {
public void NativeCallback ()
{
try {
managed ();
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal EventListenerInitNative NativeDelegate;
+ internal readonly EventListenerInitNative NativeDelegate;
Atk.EventListenerInit managed;
public EventListenerInitWrapper (Atk.EventListenerInit managed)
@@ -78,15 +32,6 @@ namespace AtkSharp {
NativeDelegate = new EventListenerInitNative (NativeCallback);
}
- public static Atk.EventListenerInit GetManagedDelegate (EventListenerInitNative native)
- {
- if (native == null)
- return null;
- EventListenerInitWrapper wrapper = (EventListenerInitWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/atk/generated/AtkSharp.EventListenerNative.cs b/atk/generated/AtkSharp.EventListenerNative.cs
index 06ca20979..d897dcbbd 100644
--- a/atk/generated/AtkSharp.EventListenerNative.cs
+++ b/atk/generated/AtkSharp.EventListenerNative.cs
@@ -10,65 +10,19 @@ namespace AtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void EventListenerNative(IntPtr obj);
- internal class EventListenerInvoker {
-
- EventListenerNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~EventListenerInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal EventListenerInvoker (EventListenerNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal EventListenerInvoker (EventListenerNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal EventListenerInvoker (EventListenerNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Atk.EventListener Handler {
- get {
- return new Atk.EventListener(InvokeNative);
- }
- }
-
- void InvokeNative (Atk.Object obj)
- {
- native_cb (obj == null ? IntPtr.Zero : obj.Handle);
- }
- }
-
internal class EventListenerWrapper {
public void NativeCallback (IntPtr obj)
{
try {
managed (GLib.Object.GetObject(obj) as Atk.Object);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal EventListenerNative NativeDelegate;
+ internal readonly EventListenerNative NativeDelegate;
Atk.EventListener managed;
public EventListenerWrapper (Atk.EventListener managed)
@@ -78,15 +32,6 @@ namespace AtkSharp {
NativeDelegate = new EventListenerNative (NativeCallback);
}
- public static Atk.EventListener GetManagedDelegate (EventListenerNative native)
- {
- if (native == null)
- return null;
- EventListenerWrapper wrapper = (EventListenerWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/atk/generated/AtkSharp.FocusHandlerNative.cs b/atk/generated/AtkSharp.FocusHandlerNative.cs
index eda840b75..1fc8b90c9 100644
--- a/atk/generated/AtkSharp.FocusHandlerNative.cs
+++ b/atk/generated/AtkSharp.FocusHandlerNative.cs
@@ -52,23 +52,13 @@ namespace AtkSharp {
{
try {
managed (GLib.Object.GetObject(arg1) as Atk.Object, arg2);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal FocusHandlerNative NativeDelegate;
+ internal readonly FocusHandlerNative NativeDelegate;
Atk.FocusHandler managed;
public FocusHandlerWrapper (Atk.FocusHandler managed)
@@ -78,15 +68,6 @@ namespace AtkSharp {
NativeDelegate = new FocusHandlerNative (NativeCallback);
}
- public static Atk.FocusHandler GetManagedDelegate (FocusHandlerNative native)
- {
- if (native == null)
- return null;
- FocusHandlerWrapper wrapper = (FocusHandlerWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/atk/generated/AtkSharp.FunctionNative.cs b/atk/generated/AtkSharp.FunctionNative.cs
index 2b58b8a33..aabfe9b7d 100644
--- a/atk/generated/AtkSharp.FunctionNative.cs
+++ b/atk/generated/AtkSharp.FunctionNative.cs
@@ -10,51 +10,14 @@ namespace AtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool FunctionNative(IntPtr data);
- internal class FunctionInvoker {
+ internal static class FunctionWrapper {
- FunctionNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~FunctionInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal FunctionInvoker (FunctionNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal FunctionInvoker (FunctionNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal FunctionInvoker (FunctionNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Atk.Function Handler {
- get {
- return new Atk.Function(InvokeNative);
- }
- }
-
- bool InvokeNative ()
- {
- bool result = native_cb (__data);
- return result;
- }
- }
-
- internal class FunctionWrapper {
-
- public bool NativeCallback (IntPtr data)
+ public static bool NativeCallback (IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Atk.Function)gch.Target;
bool __ret = managed ();
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -62,34 +25,8 @@ namespace AtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal FunctionNative NativeDelegate;
- Atk.Function managed;
-
- public FunctionWrapper (Atk.Function managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new FunctionNative (NativeCallback);
- }
-
- public static Atk.Function GetManagedDelegate (FunctionNative native)
- {
- if (native == null)
- return null;
- FunctionWrapper wrapper = (FunctionWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly FunctionNative NativeDelegate = new FunctionNative (NativeCallback);
}
#endregion
}
diff --git a/atk/generated/AtkSharp.KeySnoopFuncNative.cs b/atk/generated/AtkSharp.KeySnoopFuncNative.cs
index 3394d245a..c07961e7c 100644
--- a/atk/generated/AtkSharp.KeySnoopFuncNative.cs
+++ b/atk/generated/AtkSharp.KeySnoopFuncNative.cs
@@ -10,53 +10,14 @@ namespace AtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate int KeySnoopFuncNative(IntPtr evnt, IntPtr func_data);
- internal class KeySnoopFuncInvoker {
+ internal static class KeySnoopFuncWrapper {
- KeySnoopFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~KeySnoopFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal KeySnoopFuncInvoker (KeySnoopFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal KeySnoopFuncInvoker (KeySnoopFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal KeySnoopFuncInvoker (KeySnoopFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Atk.KeySnoopFunc Handler {
- get {
- return new Atk.KeySnoopFunc(InvokeNative);
- }
- }
-
- int InvokeNative (Atk.KeyEventStruct evnt)
- {
- IntPtr native_evnt = GLib.Marshaller.StructureToPtrAlloc<Atk.KeyEventStruct> (evnt);
- int result = native_cb (native_evnt, __data);
- Marshal.FreeHGlobal (native_evnt);
- return result;
- }
- }
-
- internal class KeySnoopFuncWrapper {
-
- public int NativeCallback (IntPtr evnt, IntPtr func_data)
+ public static int NativeCallback (IntPtr evnt, IntPtr func_data)
{
try {
+ var gch = (GCHandle)func_data;
+ var managed = (Atk.KeySnoopFunc)gch.Target;
int __ret = managed (Atk.KeyEventStruct.New (evnt));
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
@@ -65,34 +26,8 @@ namespace AtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal KeySnoopFuncNative NativeDelegate;
- Atk.KeySnoopFunc managed;
-
- public KeySnoopFuncWrapper (Atk.KeySnoopFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new KeySnoopFuncNative (NativeCallback);
- }
-
- public static Atk.KeySnoopFunc GetManagedDelegate (KeySnoopFuncNative native)
- {
- if (native == null)
- return null;
- KeySnoopFuncWrapper wrapper = (KeySnoopFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly KeySnoopFuncNative NativeDelegate = new KeySnoopFuncNative (NativeCallback);
}
#endregion
}
diff --git a/atk/generated/AtkSharp.PropertyChangeHandlerNative.cs b/atk/generated/AtkSharp.PropertyChangeHandlerNative.cs
index d88190101..b92ae4873 100644
--- a/atk/generated/AtkSharp.PropertyChangeHandlerNative.cs
+++ b/atk/generated/AtkSharp.PropertyChangeHandlerNative.cs
@@ -10,67 +10,19 @@ namespace AtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void PropertyChangeHandlerNative(IntPtr arg1, IntPtr arg2);
- internal class PropertyChangeHandlerInvoker {
-
- PropertyChangeHandlerNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~PropertyChangeHandlerInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal PropertyChangeHandlerInvoker (PropertyChangeHandlerNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal PropertyChangeHandlerInvoker (PropertyChangeHandlerNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal PropertyChangeHandlerInvoker (PropertyChangeHandlerNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Atk.PropertyChangeHandler Handler {
- get {
- return new Atk.PropertyChangeHandler(InvokeNative);
- }
- }
-
- void InvokeNative (Atk.Object arg1, Atk.PropertyValues arg2)
- {
- IntPtr native_arg2 = GLib.Marshaller.StructureToPtrAlloc<Atk.PropertyValues> (arg2);
- native_cb (arg1 == null ? IntPtr.Zero : arg1.Handle, native_arg2);
- Marshal.FreeHGlobal (native_arg2);
- }
- }
-
internal class PropertyChangeHandlerWrapper {
public void NativeCallback (IntPtr arg1, IntPtr arg2)
{
try {
managed (GLib.Object.GetObject(arg1) as Atk.Object, Atk.PropertyValues.New (arg2));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal PropertyChangeHandlerNative NativeDelegate;
+ internal readonly PropertyChangeHandlerNative NativeDelegate;
Atk.PropertyChangeHandler managed;
public PropertyChangeHandlerWrapper (Atk.PropertyChangeHandler managed)
@@ -80,15 +32,6 @@ namespace AtkSharp {
NativeDelegate = new PropertyChangeHandlerNative (NativeCallback);
}
- public static Atk.PropertyChangeHandler GetManagedDelegate (PropertyChangeHandlerNative native)
- {
- if (native == null)
- return null;
- PropertyChangeHandlerWrapper wrapper = (PropertyChangeHandlerWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/atk/generated/Global.cs b/atk/generated/Global.cs
index b7fdd172a..8cae826c2 100644
--- a/atk/generated/Global.cs
+++ b/atk/generated/Global.cs
@@ -79,9 +79,10 @@ namespace Atk {
static extern uint atk_add_key_event_listener(AtkSharp.KeySnoopFuncNative listener, IntPtr data);
public static uint AddKeyEventListener(Atk.KeySnoopFunc listener) {
- AtkSharp.KeySnoopFuncWrapper listener_wrapper = new AtkSharp.KeySnoopFuncWrapper (listener);
- uint raw_ret = atk_add_key_event_listener(listener_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (listener);
+ uint raw_ret = atk_add_key_event_listener(AtkSharp.KeySnoopFuncWrapper.NativeDelegate, (IntPtr)gch);
uint ret = raw_ret;
+ gch.Free();
return ret;
}
diff --git a/configure.in.in b/configure.in.in
index dde7bce7c..774c0afbc 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -116,6 +116,7 @@ if test "x$has_mono" = "xfalse" ; then
else
PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $FIRST_MONO_VERSION_WITH_NET_4_6_SUPPORT, NET_4_6_SUPPORT=true, NET_4_6_SUPPORT=false)
fi
+has_mono=true
if test "x$platform_win32" = "xyes"; then
NET_4_6_SUPPORT=true
diff --git a/gdk/generated/Display.cs b/gdk/generated/Display.cs
index 2de0ba507..b723c13f5 100644
--- a/gdk/generated/Display.cs
+++ b/gdk/generated/Display.cs
@@ -455,12 +455,8 @@ namespace Gdk {
public void AddClientMessageFilter (Gdk.Atom message_type, Gdk.FilterFunc func)
{
- GdkSharp.FilterFuncWrapper func_wrapper = new GdkSharp.FilterFuncWrapper (func);
- if (!PersistentData.Contains ("client_message_filter_func_list"))
- PersistentData ["client_message_filter_func_list"] = new ArrayList ();
- ArrayList func_list = PersistentData ["client_message_filter_func_list"] as ArrayList;
- func_list.Add (func_wrapper);
- gdk_display_add_client_message_filter (Handle, message_type == null ? IntPtr.Zero : message_type.Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ var gch = GCHandle.Alloc (func);
+ gdk_display_add_client_message_filter (Handle, message_type == null ? IntPtr.Zero : message_type.Handle, GdkSharp.FilterFuncWrapper.NativeDelegate, (IntPtr)gch);
}
[DllImport("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gdk/generated/GLibSharp.GSourceFuncNative.cs b/gdk/generated/GLibSharp.GSourceFuncNative.cs
index 6d4196a19..a7eb4cb24 100644
--- a/gdk/generated/GLibSharp.GSourceFuncNative.cs
+++ b/gdk/generated/GLibSharp.GSourceFuncNative.cs
@@ -10,51 +10,14 @@ namespace GLibSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool GSourceFuncNative(IntPtr data);
- internal class GSourceFuncInvoker {
+ internal static class GSourceFuncWrapper {
- GSourceFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~GSourceFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal GSourceFuncInvoker (GSourceFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal GSourceFuncInvoker (GSourceFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal GSourceFuncInvoker (GSourceFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal GLib.GSourceFunc Handler {
- get {
- return new GLib.GSourceFunc(InvokeNative);
- }
- }
-
- bool InvokeNative ()
- {
- bool result = native_cb (__data);
- return result;
- }
- }
-
- internal class GSourceFuncWrapper {
-
- public bool NativeCallback (IntPtr data)
+ public static bool NativeCallback (IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (GLib.GSourceFunc)gch.Target;
bool __ret = managed ();
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -62,34 +25,8 @@ namespace GLibSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal GSourceFuncNative NativeDelegate;
- GLib.GSourceFunc managed;
-
- public GSourceFuncWrapper (GLib.GSourceFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new GSourceFuncNative (NativeCallback);
- }
-
- public static GLib.GSourceFunc GetManagedDelegate (GSourceFuncNative native)
- {
- if (native == null)
- return null;
- GSourceFuncWrapper wrapper = (GSourceFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly GSourceFuncNative NativeDelegate = new GSourceFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gdk/generated/GLibSharp.SpawnChildSetupFuncNative.cs b/gdk/generated/GLibSharp.SpawnChildSetupFuncNative.cs
index f4654c503..d40b9ccb4 100644
--- a/gdk/generated/GLibSharp.SpawnChildSetupFuncNative.cs
+++ b/gdk/generated/GLibSharp.SpawnChildSetupFuncNative.cs
@@ -10,83 +10,22 @@ namespace GLibSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void SpawnChildSetupFuncNative(IntPtr data);
- internal class SpawnChildSetupFuncInvoker {
+ internal static class SpawnChildSetupFuncWrapper {
- SpawnChildSetupFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~SpawnChildSetupFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal SpawnChildSetupFuncInvoker (SpawnChildSetupFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal SpawnChildSetupFuncInvoker (SpawnChildSetupFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal SpawnChildSetupFuncInvoker (SpawnChildSetupFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal GLib.SpawnChildSetupFunc Handler {
- get {
- return new GLib.SpawnChildSetupFunc(InvokeNative);
- }
- }
-
- void InvokeNative ()
- {
- native_cb (__data);
- }
- }
-
- internal class SpawnChildSetupFuncWrapper {
-
- public void NativeCallback (IntPtr data)
+ public static void NativeCallback (IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (GLib.SpawnChildSetupFunc)gch.Target;
managed ();
- if (release_on_call)
gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal SpawnChildSetupFuncNative NativeDelegate;
- GLib.SpawnChildSetupFunc managed;
-
- public SpawnChildSetupFuncWrapper (GLib.SpawnChildSetupFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new SpawnChildSetupFuncNative (NativeCallback);
- }
-
- public static GLib.SpawnChildSetupFunc GetManagedDelegate (SpawnChildSetupFuncNative native)
- {
- if (native == null)
- return null;
- SpawnChildSetupFuncWrapper wrapper = (SpawnChildSetupFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly SpawnChildSetupFuncNative NativeDelegate = new SpawnChildSetupFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gdk/generated/GdkSharp.DestroyNotifyNative.cs b/gdk/generated/GdkSharp.DestroyNotifyNative.cs
index 2e0679036..796052bff 100644
--- a/gdk/generated/GdkSharp.DestroyNotifyNative.cs
+++ b/gdk/generated/GdkSharp.DestroyNotifyNative.cs
@@ -10,83 +10,21 @@ namespace GdkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void DestroyNotifyNative(IntPtr data);
- internal class DestroyNotifyInvoker {
+ internal static class DestroyNotifyWrapper {
- DestroyNotifyNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~DestroyNotifyInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal DestroyNotifyInvoker (DestroyNotifyNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal DestroyNotifyInvoker (DestroyNotifyNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal DestroyNotifyInvoker (DestroyNotifyNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gdk.DestroyNotify Handler {
- get {
- return new Gdk.DestroyNotify(InvokeNative);
- }
- }
-
- void InvokeNative ()
- {
- native_cb (__data);
- }
- }
-
- internal class DestroyNotifyWrapper {
-
- public void NativeCallback (IntPtr data)
+ public static void NativeCallback (IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gdk.DestroyNotify)gch.Target;
managed ();
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal DestroyNotifyNative NativeDelegate;
- Gdk.DestroyNotify managed;
-
- public DestroyNotifyWrapper (Gdk.DestroyNotify managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new DestroyNotifyNative (NativeCallback);
- }
-
- public static Gdk.DestroyNotify GetManagedDelegate (DestroyNotifyNative native)
- {
- if (native == null)
- return null;
- DestroyNotifyWrapper wrapper = (DestroyNotifyWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly DestroyNotifyNative NativeDelegate = new DestroyNotifyNative (NativeCallback);
}
#endregion
}
diff --git a/gdk/generated/GdkSharp.EventFuncNative.cs b/gdk/generated/GdkSharp.EventFuncNative.cs
index 17930e642..d34b62da0 100644
--- a/gdk/generated/GdkSharp.EventFuncNative.cs
+++ b/gdk/generated/GdkSharp.EventFuncNative.cs
@@ -10,83 +10,21 @@ namespace GdkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void EventFuncNative(IntPtr evnt, IntPtr data);
- internal class EventFuncInvoker {
+ internal static class EventFuncWrapper {
- EventFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~EventFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal EventFuncInvoker (EventFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal EventFuncInvoker (EventFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal EventFuncInvoker (EventFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gdk.EventFunc Handler {
- get {
- return new Gdk.EventFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gdk.Event evnt)
- {
- native_cb (evnt == null ? IntPtr.Zero : evnt.Handle, __data);
- }
- }
-
- internal class EventFuncWrapper {
-
- public void NativeCallback (IntPtr evnt, IntPtr data)
+ public static void NativeCallback (IntPtr evnt, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gdk.EventFunc)gch.Target;
managed (Gdk.Event.GetEvent (evnt));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal EventFuncNative NativeDelegate;
- Gdk.EventFunc managed;
-
- public EventFuncWrapper (Gdk.EventFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new EventFuncNative (NativeCallback);
- }
-
- public static Gdk.EventFunc GetManagedDelegate (EventFuncNative native)
- {
- if (native == null)
- return null;
- EventFuncWrapper wrapper = (EventFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly EventFuncNative NativeDelegate = new EventFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gdk/generated/GdkSharp.FilterFuncNative.cs b/gdk/generated/GdkSharp.FilterFuncNative.cs
index af832313a..9f4966bf7 100644
--- a/gdk/generated/GdkSharp.FilterFuncNative.cs
+++ b/gdk/generated/GdkSharp.FilterFuncNative.cs
@@ -10,51 +10,14 @@ namespace GdkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate int FilterFuncNative(IntPtr xevent, IntPtr evnt, IntPtr data);
- internal class FilterFuncInvoker {
+ internal static class FilterFuncWrapper {
- FilterFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~FilterFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal FilterFuncInvoker (FilterFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal FilterFuncInvoker (FilterFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal FilterFuncInvoker (FilterFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gdk.FilterFunc Handler {
- get {
- return new Gdk.FilterFunc(InvokeNative);
- }
- }
-
- Gdk.FilterReturn InvokeNative (System.IntPtr xevent, Gdk.Event evnt)
- {
- Gdk.FilterReturn result = (Gdk.FilterReturn) native_cb (xevent, evnt == null ? IntPtr.Zero : evnt.Handle, __data);
- return result;
- }
- }
-
- internal class FilterFuncWrapper {
-
- public int NativeCallback (IntPtr xevent, IntPtr evnt, IntPtr data)
+ public static int NativeCallback (IntPtr xevent, IntPtr evnt, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gdk.FilterFunc)gch.Target;
Gdk.FilterReturn __ret = managed (xevent, Gdk.Event.GetEvent (evnt));
- if (release_on_call)
- gch.Free ();
return (int) __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
@@ -63,34 +26,8 @@ namespace GdkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal FilterFuncNative NativeDelegate;
- Gdk.FilterFunc managed;
-
- public FilterFuncWrapper (Gdk.FilterFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new FilterFuncNative (NativeCallback);
- }
-
- public static Gdk.FilterFunc GetManagedDelegate (FilterFuncNative native)
- {
- if (native == null)
- return null;
- FilterFuncWrapper wrapper = (FilterFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly FilterFuncNative NativeDelegate = new FilterFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gdk/generated/GdkSharp.InputFunctionNative.cs b/gdk/generated/GdkSharp.InputFunctionNative.cs
index b12212f0a..5a4848bac 100644
--- a/gdk/generated/GdkSharp.InputFunctionNative.cs
+++ b/gdk/generated/GdkSharp.InputFunctionNative.cs
@@ -10,83 +10,21 @@ namespace GdkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void InputFunctionNative(IntPtr data, int source, int condition);
- internal class InputFunctionInvoker {
+ internal static class InputFunctionWrapper {
- InputFunctionNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~InputFunctionInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal InputFunctionInvoker (InputFunctionNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal InputFunctionInvoker (InputFunctionNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal InputFunctionInvoker (InputFunctionNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gdk.InputFunction Handler {
- get {
- return new Gdk.InputFunction(InvokeNative);
- }
- }
-
- void InvokeNative (IntPtr data, int source, Gdk.InputCondition condition)
- {
- native_cb (__data, source, (int) condition);
- }
- }
-
- internal class InputFunctionWrapper {
-
- public void NativeCallback (IntPtr data, int source, int condition)
+ public static void NativeCallback (IntPtr data, int source, int condition)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gdk.InputFunction)gch.Target;
managed (data, source, (Gdk.InputCondition) condition);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal InputFunctionNative NativeDelegate;
- Gdk.InputFunction managed;
-
- public InputFunctionWrapper (Gdk.InputFunction managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new InputFunctionNative (NativeCallback);
- }
-
- public static Gdk.InputFunction GetManagedDelegate (InputFunctionNative native)
- {
- if (native == null)
- return null;
- InputFunctionWrapper wrapper = (InputFunctionWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly InputFunctionNative NativeDelegate = new InputFunctionNative (NativeCallback);
}
#endregion
}
diff --git a/gdk/generated/GdkSharp.InvalidateMaybeRecurseChildFuncNative.cs b/gdk/generated/GdkSharp.InvalidateMaybeRecurseChildFuncNative.cs
index 0c497179c..703d1c359 100644
--- a/gdk/generated/GdkSharp.InvalidateMaybeRecurseChildFuncNative.cs
+++ b/gdk/generated/GdkSharp.InvalidateMaybeRecurseChildFuncNative.cs
@@ -10,51 +10,12 @@ namespace GdkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool InvalidateMaybeRecurseChildFuncNative(IntPtr arg1, IntPtr data);
- internal class InvalidateMaybeRecurseChildFuncInvoker {
-
- InvalidateMaybeRecurseChildFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~InvalidateMaybeRecurseChildFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal InvalidateMaybeRecurseChildFuncInvoker (InvalidateMaybeRecurseChildFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal InvalidateMaybeRecurseChildFuncInvoker (InvalidateMaybeRecurseChildFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal InvalidateMaybeRecurseChildFuncInvoker (InvalidateMaybeRecurseChildFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gdk.InvalidateMaybeRecurseChildFunc Handler {
- get {
- return new Gdk.InvalidateMaybeRecurseChildFunc(InvokeNative);
- }
- }
-
- bool InvokeNative (Gdk.Window arg1)
- {
- bool result = native_cb (arg1 == null ? IntPtr.Zero : arg1.Handle, __data);
- return result;
- }
- }
-
internal class InvalidateMaybeRecurseChildFuncWrapper {
public bool NativeCallback (IntPtr arg1, IntPtr data)
{
try {
bool __ret = managed (GLib.Object.GetObject(arg1) as Gdk.Window);
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -62,16 +23,8 @@ namespace GdkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal InvalidateMaybeRecurseChildFuncNative NativeDelegate;
+ internal readonly InvalidateMaybeRecurseChildFuncNative NativeDelegate;
Gdk.InvalidateMaybeRecurseChildFunc managed;
public InvalidateMaybeRecurseChildFuncWrapper (Gdk.InvalidateMaybeRecurseChildFunc managed)
@@ -81,15 +34,6 @@ namespace GdkSharp {
NativeDelegate = new InvalidateMaybeRecurseChildFuncNative (NativeCallback);
}
- public static Gdk.InvalidateMaybeRecurseChildFunc GetManagedDelegate (InvalidateMaybeRecurseChildFuncNative native)
- {
- if (native == null)
- return null;
- InvalidateMaybeRecurseChildFuncWrapper wrapper = (InvalidateMaybeRecurseChildFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/gdk/generated/GdkSharp.PixbufDestroyNotifyNative.cs b/gdk/generated/GdkSharp.PixbufDestroyNotifyNative.cs
index 023ce89f9..a1d3157e8 100644
--- a/gdk/generated/GdkSharp.PixbufDestroyNotifyNative.cs
+++ b/gdk/generated/GdkSharp.PixbufDestroyNotifyNative.cs
@@ -10,83 +10,21 @@ namespace GdkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void PixbufDestroyNotifyNative(byte[] pixels, IntPtr data);
- internal class PixbufDestroyNotifyInvoker {
+ internal static class PixbufDestroyNotifyWrapper {
- PixbufDestroyNotifyNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~PixbufDestroyNotifyInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal PixbufDestroyNotifyInvoker (PixbufDestroyNotifyNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal PixbufDestroyNotifyInvoker (PixbufDestroyNotifyNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal PixbufDestroyNotifyInvoker (PixbufDestroyNotifyNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gdk.PixbufDestroyNotify Handler {
- get {
- return new Gdk.PixbufDestroyNotify(InvokeNative);
- }
- }
-
- void InvokeNative (byte[] pixels)
- {
- native_cb (pixels, __data);
- }
- }
-
- internal class PixbufDestroyNotifyWrapper {
-
- public void NativeCallback (byte[] pixels, IntPtr data)
+ public static void NativeCallback (byte[] pixels, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gdk.PixbufDestroyNotify)gch.Target;
managed (pixels);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal PixbufDestroyNotifyNative NativeDelegate;
- Gdk.PixbufDestroyNotify managed;
-
- public PixbufDestroyNotifyWrapper (Gdk.PixbufDestroyNotify managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new PixbufDestroyNotifyNative (NativeCallback);
- }
-
- public static Gdk.PixbufDestroyNotify GetManagedDelegate (PixbufDestroyNotifyNative native)
- {
- if (native == null)
- return null;
- PixbufDestroyNotifyWrapper wrapper = (PixbufDestroyNotifyWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly PixbufDestroyNotifyNative NativeDelegate = new PixbufDestroyNotifyNative (NativeCallback);
}
#endregion
}
diff --git a/gdk/generated/GdkSharp.PixbufSaveFuncNative.cs b/gdk/generated/GdkSharp.PixbufSaveFuncNative.cs
index 552d879d3..ae10da310 100644
--- a/gdk/generated/GdkSharp.PixbufSaveFuncNative.cs
+++ b/gdk/generated/GdkSharp.PixbufSaveFuncNative.cs
@@ -10,56 +10,16 @@ namespace GdkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool PixbufSaveFuncNative(IntPtr buf, UIntPtr count, out IntPtr error, IntPtr data);
- internal class PixbufSaveFuncInvoker {
+ internal static class PixbufSaveFuncWrapper {
- PixbufSaveFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~PixbufSaveFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal PixbufSaveFuncInvoker (PixbufSaveFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal PixbufSaveFuncInvoker (PixbufSaveFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal PixbufSaveFuncInvoker (PixbufSaveFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gdk.PixbufSaveFunc Handler {
- get {
- return new Gdk.PixbufSaveFunc(InvokeNative);
- }
- }
-
- bool InvokeNative (string buf, ulong count)
- {
- IntPtr native_buf = GLib.Marshaller.StringToPtrGStrdup (buf);
- IntPtr error = IntPtr.Zero;
- bool result = native_cb (native_buf, new UIntPtr (count), out error, __data);
- GLib.Marshaller.Free (native_buf);
- return result;
- }
- }
-
- internal class PixbufSaveFuncWrapper {
-
- public bool NativeCallback (IntPtr buf, UIntPtr count, out IntPtr error, IntPtr data)
+ public static bool NativeCallback (IntPtr buf, UIntPtr count, out IntPtr error, IntPtr data)
{
error = IntPtr.Zero;
try {
+ var gch = (GCHandle)data;
+ var managed = (Gdk.PixbufSaveFunc)gch.Target;
bool __ret = managed (GLib.Marshaller.Utf8PtrToString (buf), (ulong) count);
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -67,34 +27,8 @@ namespace GdkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal PixbufSaveFuncNative NativeDelegate;
- Gdk.PixbufSaveFunc managed;
-
- public PixbufSaveFuncWrapper (Gdk.PixbufSaveFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new PixbufSaveFuncNative (NativeCallback);
- }
-
- public static Gdk.PixbufSaveFunc GetManagedDelegate (PixbufSaveFuncNative native)
- {
- if (native == null)
- return null;
- PixbufSaveFuncWrapper wrapper = (PixbufSaveFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly PixbufSaveFuncNative NativeDelegate = new PixbufSaveFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gdk/generated/GdkSharp.SpanFuncNative.cs b/gdk/generated/GdkSharp.SpanFuncNative.cs
index d651aad8b..367c70978 100644
--- a/gdk/generated/GdkSharp.SpanFuncNative.cs
+++ b/gdk/generated/GdkSharp.SpanFuncNative.cs
@@ -10,85 +10,21 @@ namespace GdkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void SpanFuncNative(IntPtr span, IntPtr data);
- internal class SpanFuncInvoker {
+ internal static class SpanFuncWrapper {
- SpanFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~SpanFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal SpanFuncInvoker (SpanFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal SpanFuncInvoker (SpanFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal SpanFuncInvoker (SpanFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gdk.SpanFunc Handler {
- get {
- return new Gdk.SpanFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gdk.Span span)
- {
- IntPtr native_span = GLib.Marshaller.StructureToPtrAlloc<Gdk.Span> (span);
- native_cb (native_span, __data);
- Marshal.FreeHGlobal (native_span);
- }
- }
-
- internal class SpanFuncWrapper {
-
- public void NativeCallback (IntPtr span, IntPtr data)
+ public static void NativeCallback (IntPtr span, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gdk.SpanFunc)gch.Target;
managed (Gdk.Span.New (span));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal SpanFuncNative NativeDelegate;
- Gdk.SpanFunc managed;
-
- public SpanFuncWrapper (Gdk.SpanFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new SpanFuncNative (NativeCallback);
- }
-
- public static Gdk.SpanFunc GetManagedDelegate (SpanFuncNative native)
- {
- if (native == null)
- return null;
- SpanFuncWrapper wrapper = (SpanFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly SpanFuncNative NativeDelegate = new SpanFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gdk/generated/Input.cs b/gdk/generated/Input.cs
index 91c0e93ea..6b41ecf23 100644
--- a/gdk/generated/Input.cs
+++ b/gdk/generated/Input.cs
@@ -55,17 +55,15 @@ namespace Gdk {
[Obsolete]
public static int AddFull (int source, Gdk.InputCondition condition, Gdk.InputFunction function, IntPtr data, Gdk.DestroyNotify destroy)
{
- GdkSharp.InputFunctionWrapper function_wrapper = new GdkSharp.InputFunctionWrapper (function);
- GCHandle gch = GCHandle.Alloc (function_wrapper);
- return gdk_input_add_full (source, (int) condition, function_wrapper.NativeDelegate, (IntPtr) gch, GLib.DestroyHelper.NotifyHandler);
+ GCHandle gch = GCHandle.Alloc (function);
+ return gdk_input_add_full (source, (int) condition, GdkSharp.InputFunctionWrapper.NativeDelegate, (IntPtr) gch, GLib.DestroyHelper.NotifyHandler);
}
[Obsolete]
public static int Add (int source, Gdk.InputCondition condition, Gdk.InputFunction function)
{
- GdkSharp.InputFunctionWrapper function_wrapper = new GdkSharp.InputFunctionWrapper (function);
- GCHandle gch = GCHandle.Alloc (function_wrapper);
- return gdk_input_add_full (source, (int) condition, function_wrapper.NativeDelegate, (IntPtr) gch, GLib.DestroyHelper.NotifyHandler);
+ GCHandle gch = GCHandle.Alloc (function);
+ return gdk_input_add_full (source, (int) condition, GdkSharp.InputFunctionWrapper.NativeDelegate, (IntPtr) gch, GLib.DestroyHelper.NotifyHandler);
}
#endregion
diff --git a/gdk/generated/Pixbuf.cs b/gdk/generated/Pixbuf.cs
index 3b11a29d7..760c67354 100644
--- a/gdk/generated/Pixbuf.cs
+++ b/gdk/generated/Pixbuf.cs
@@ -752,12 +752,13 @@ namespace Gdk {
public unsafe void SaveToCallback (PixbufSaveFunc save_func, string type, string[] option_keys, string[] option_values)
{
- GdkSharp.PixbufSaveFuncWrapper save_func_wrapper = new GdkSharp.PixbufSaveFuncWrapper (save_func);
+ GCHandle gch = GCHandle.Alloc (save_func);
IntPtr error = IntPtr.Zero;
IntPtr ntype = GLib.Marshaller.StringToPtrGStrdup (type);
IntPtr[] nkeys = NullTerm (option_keys);
IntPtr[] nvals = NullTerm (option_values);
- bool saved = gdk_pixbuf_save_to_callbackv (Handle, save_func_wrapper.NativeDelegate, IntPtr.Zero, ntype, nkeys, nvals, out error);
+ bool saved = gdk_pixbuf_save_to_callbackv (Handle, GdkSharp.PixbufSaveFuncWrapper.NativeDelegate, (IntPtr)gch, ntype, nkeys, nvals, out error);
+ gch.Free ();
GLib.Marshaller.Free (ntype);
ReleaseArray (nkeys);
ReleaseArray (nvals);
diff --git a/gdk/generated/PixbufFormat.cs b/gdk/generated/PixbufFormat.cs
index 8dcfa4438..e809d7e9f 100644
--- a/gdk/generated/PixbufFormat.cs
+++ b/gdk/generated/PixbufFormat.cs
@@ -92,7 +92,7 @@ namespace Gdk {
public string[] MimeTypes {
get {
IntPtr raw_ret = gdk_pixbuf_format_get_mime_types(Handle);
- string[] ret = GLib.Marshaller.NullTermPtrToStringArray (raw_ret, false);
+ string[] ret = GLib.Marshaller.NullTermPtrToStringArray (raw_ret, true);
return ret;
}
}
diff --git a/gdk/generated/Region.cs b/gdk/generated/Region.cs
index 564905b96..e11d5297b 100644
--- a/gdk/generated/Region.cs
+++ b/gdk/generated/Region.cs
@@ -22,8 +22,9 @@ namespace Gdk {
static extern void gdk_region_spans_intersect_foreach(IntPtr raw, ref Gdk.Span spans, int n_spans, bool sorted, GdkSharp.SpanFuncNative function, IntPtr data);
public void SpansIntersectForeach(Gdk.Span spans, int n_spans, bool sorted, Gdk.SpanFunc function) {
- GdkSharp.SpanFuncWrapper function_wrapper = new GdkSharp.SpanFuncWrapper (function);
- gdk_region_spans_intersect_foreach(Handle, ref spans, n_spans, sorted, function_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (function);
+ gdk_region_spans_intersect_foreach(Handle, ref spans, n_spans, sorted, GdkSharp.SpanFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gdk/generated/Spawn.cs b/gdk/generated/Spawn.cs
index 4860ecfbc..a97ae7510 100644
--- a/gdk/generated/Spawn.cs
+++ b/gdk/generated/Spawn.cs
@@ -26,10 +26,9 @@ namespace Gdk {
native_envp [i] = GLib.Marshaller.StringToPtrGStrdup(envp[i]);
}
native_envp [cnt_envp] = IntPtr.Zero;
- GLibSharp.SpawnChildSetupFuncWrapper child_setup_wrapper = new GLibSharp.SpawnChildSetupFuncWrapper (child_setup);
- child_setup_wrapper.PersistUntilCalled ();
+ GCHandle gch = GCHandle.Alloc (child_setup);
IntPtr error = IntPtr.Zero;
- bool raw_ret = gdk_spawn_on_screen(screen == null ? IntPtr.Zero : screen.Handle, native_working_directory, native_argv, native_envp, (int) flags, child_setup_wrapper.NativeDelegate, IntPtr.Zero, out child_pid, out error);
+ bool raw_ret = gdk_spawn_on_screen(screen == null ? IntPtr.Zero : screen.Handle, native_working_directory, native_argv, native_envp, (int) flags, GLibSharp.SpawnChildSetupFuncWrapper.NativeDelegate, (IntPtr)gch, out child_pid, out error);
bool ret = raw_ret;
GLib.Marshaller.Free (native_working_directory);
for (int i = 0; i < cnt_argv; i++) {
@@ -59,10 +58,9 @@ namespace Gdk {
native_envp [i] = GLib.Marshaller.StringToPtrGStrdup(envp[i]);
}
native_envp [cnt_envp] = IntPtr.Zero;
- GLibSharp.SpawnChildSetupFuncWrapper child_setup_wrapper = new GLibSharp.SpawnChildSetupFuncWrapper (child_setup);
- child_setup_wrapper.PersistUntilCalled ();
+ GCHandle gch = GCHandle.Alloc (child_setup);
IntPtr error = IntPtr.Zero;
- bool raw_ret = gdk_spawn_on_screen_with_pipes(screen == null ? IntPtr.Zero : screen.Handle, native_working_directory, native_argv, native_envp, (int) flags, child_setup_wrapper.NativeDelegate, IntPtr.Zero, out child_pid, out standard_input, out standard_output, out standard_error, out error);
+ bool raw_ret = gdk_spawn_on_screen_with_pipes(screen == null ? IntPtr.Zero : screen.Handle, native_working_directory, native_argv, native_envp, (int) flags, GLibSharp.SpawnChildSetupFuncWrapper.NativeDelegate, (IntPtr)gch, out child_pid, out standard_input, out standard_output, out standard_error, out error);
bool ret = raw_ret;
GLib.Marshaller.Free (native_working_directory);
for (int i = 0; i < cnt_argv; i++) {
diff --git a/gdk/generated/Threads.cs b/gdk/generated/Threads.cs
index 3139ca234..2934a9a28 100644
--- a/gdk/generated/Threads.cs
+++ b/gdk/generated/Threads.cs
@@ -13,17 +13,16 @@ namespace Gdk {
static extern uint gdk_threads_add_idle_full(int priority, GLibSharp.GSourceFuncNative function, IntPtr data, GLib.DestroyNotify notify);
public static uint AddIdle(int priority, GLib.GSourceFunc function) {
- GLibSharp.GSourceFuncWrapper function_wrapper = new GLibSharp.GSourceFuncWrapper (function);
IntPtr data;
GLib.DestroyNotify notify;
if (function == null) {
data = IntPtr.Zero;
notify = null;
} else {
- data = (IntPtr) GCHandle.Alloc (function_wrapper);
+ data = (IntPtr) GCHandle.Alloc (function);
notify = GLib.DestroyHelper.NotifyHandler;
}
- uint raw_ret = gdk_threads_add_idle_full(priority, function_wrapper.NativeDelegate, data, notify);
+ uint raw_ret = gdk_threads_add_idle_full(priority, GLibSharp.GSourceFuncWrapper.NativeDelegate, data, notify);
uint ret = raw_ret;
return ret;
}
@@ -32,17 +31,16 @@ namespace Gdk {
static extern uint gdk_threads_add_timeout_full(int priority, uint interval, GLibSharp.GSourceFuncNative function, IntPtr data, GLib.DestroyNotify notify);
public static uint AddTimeout(int priority, uint interval, GLib.GSourceFunc function) {
- GLibSharp.GSourceFuncWrapper function_wrapper = new GLibSharp.GSourceFuncWrapper (function);
IntPtr data;
GLib.DestroyNotify notify;
if (function == null) {
data = IntPtr.Zero;
notify = null;
} else {
- data = (IntPtr) GCHandle.Alloc (function_wrapper);
+ data = (IntPtr) GCHandle.Alloc (function);
notify = GLib.DestroyHelper.NotifyHandler;
}
- uint raw_ret = gdk_threads_add_timeout_full(priority, interval, function_wrapper.NativeDelegate, data, notify);
+ uint raw_ret = gdk_threads_add_timeout_full(priority, interval, GLibSharp.GSourceFuncWrapper.NativeDelegate, data, notify);
uint ret = raw_ret;
return ret;
}
diff --git a/gdk/generated/Window.cs b/gdk/generated/Window.cs
index 5714fee49..93268aaf7 100644
--- a/gdk/generated/Window.cs
+++ b/gdk/generated/Window.cs
@@ -995,18 +995,20 @@ namespace Gdk {
public static void AddFilterForAll (FilterFunc func)
{
- GdkSharp.FilterFuncWrapper wrapper = new GdkSharp.FilterFuncWrapper (func);
- FilterAllHash [func] = wrapper;
- gdk_window_add_filter (IntPtr.Zero, wrapper.NativeDelegate, IntPtr.Zero);
+ var gch = GCHandle.Alloc (func);
+ FilterAllHash [func] = gch;
+ gdk_window_add_filter (IntPtr.Zero, GdkSharp.FilterFuncWrapper.NativeDelegate, (IntPtr)gch);
}
public static void RemoveFilterForAll (FilterFunc func)
{
- GdkSharp.FilterFuncWrapper wrapper = FilterAllHash [func] as GdkSharp.FilterFuncWrapper;
- if (wrapper == null)
+ var ret = FilterAllHash [func];
+ if (ret == null)
return;
+ GCHandle gch = (GCHandle)ret;
FilterAllHash.Remove (func);
- gdk_window_remove_filter (IntPtr.Zero, wrapper.NativeDelegate, IntPtr.Zero);
+ gdk_window_remove_filter (IntPtr.Zero, GdkSharp.FilterFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
public void AddFilter (FilterFunc function)
@@ -1014,19 +1016,21 @@ namespace Gdk {
if (!PersistentData.Contains ("filter_func_hash"))
PersistentData ["filter_func_hash"] = new Hashtable ();
Hashtable hash = PersistentData ["filter_func_hash"] as Hashtable;
- GdkSharp.FilterFuncWrapper wrapper = new GdkSharp.FilterFuncWrapper (function);
- hash [function] = wrapper;
- gdk_window_add_filter (Handle, wrapper.NativeDelegate, IntPtr.Zero);
+ var gch = GCHandle.Alloc (function);
+ hash [function] = gch;
+ gdk_window_add_filter (Handle, GdkSharp.FilterFuncWrapper.NativeDelegate, (IntPtr)gch);
}
public void RemoveFilter (FilterFunc function)
{
Hashtable hash = PersistentData ["filter_func_hash"] as Hashtable;
- GdkSharp.FilterFuncWrapper wrapper = hash [function] as GdkSharp.FilterFuncWrapper;
- if (wrapper == null)
+ var ret = hash [function];
+ if (ret == null)
return;
+ GCHandle gch = (GCHandle)ret;
hash.Remove (function);
- gdk_window_remove_filter (Handle, wrapper.NativeDelegate, IntPtr.Zero);
+ gdk_window_remove_filter (Handle, GdkSharp.FilterFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
#if MANLY_ENOUGH_TO_INCLUDE
diff --git a/glade/generated/GladeSharp.ApplyCustomPropFuncNative.cs b/glade/generated/GladeSharp.ApplyCustomPropFuncNative.cs
index 8950a460c..1c1e06e8f 100644
--- a/glade/generated/GladeSharp.ApplyCustomPropFuncNative.cs
+++ b/glade/generated/GladeSharp.ApplyCustomPropFuncNative.cs
@@ -10,69 +10,19 @@ namespace GladeSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void ApplyCustomPropFuncNative(IntPtr xml, IntPtr widget, IntPtr propname, IntPtr value);
- internal class ApplyCustomPropFuncInvoker {
-
- ApplyCustomPropFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~ApplyCustomPropFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal ApplyCustomPropFuncInvoker (ApplyCustomPropFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal ApplyCustomPropFuncInvoker (ApplyCustomPropFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal ApplyCustomPropFuncInvoker (ApplyCustomPropFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Glade.ApplyCustomPropFunc Handler {
- get {
- return new Glade.ApplyCustomPropFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Glade.XML xml, Gtk.Widget widget, string propname, string value)
- {
- IntPtr native_propname = GLib.Marshaller.StringToPtrGStrdup (propname);
- IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
- native_cb (xml == null ? IntPtr.Zero : xml.Handle, widget == null ? IntPtr.Zero : widget.Handle, native_propname, native_value);
- GLib.Marshaller.Free (native_propname);
- GLib.Marshaller.Free (native_value);
- }
- }
-
internal class ApplyCustomPropFuncWrapper {
public void NativeCallback (IntPtr xml, IntPtr widget, IntPtr propname, IntPtr value)
{
try {
managed (GLib.Object.GetObject(xml) as Glade.XML, GLib.Object.GetObject(widget) as Gtk.Widget, GLib.Marshaller.Utf8PtrToString (propname), GLib.Marshaller.Utf8PtrToString (value));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal ApplyCustomPropFuncNative NativeDelegate;
+ internal readonly ApplyCustomPropFuncNative NativeDelegate;
Glade.ApplyCustomPropFunc managed;
public ApplyCustomPropFuncWrapper (Glade.ApplyCustomPropFunc managed)
@@ -82,15 +32,6 @@ namespace GladeSharp {
NativeDelegate = new ApplyCustomPropFuncNative (NativeCallback);
}
- public static Glade.ApplyCustomPropFunc GetManagedDelegate (ApplyCustomPropFuncNative native)
- {
- if (native == null)
- return null;
- ApplyCustomPropFuncWrapper wrapper = (ApplyCustomPropFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/glade/generated/GladeSharp.BuildChildrenFuncNative.cs b/glade/generated/GladeSharp.BuildChildrenFuncNative.cs
index eb1b15c19..5c1671087 100644
--- a/glade/generated/GladeSharp.BuildChildrenFuncNative.cs
+++ b/glade/generated/GladeSharp.BuildChildrenFuncNative.cs
@@ -10,67 +10,19 @@ namespace GladeSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void BuildChildrenFuncNative(IntPtr xml, IntPtr parent, IntPtr info);
- internal class BuildChildrenFuncInvoker {
-
- BuildChildrenFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~BuildChildrenFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal BuildChildrenFuncInvoker (BuildChildrenFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal BuildChildrenFuncInvoker (BuildChildrenFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal BuildChildrenFuncInvoker (BuildChildrenFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Glade.BuildChildrenFunc Handler {
- get {
- return new Glade.BuildChildrenFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Glade.XML xml, Gtk.Widget parent, Glade.WidgetInfo info)
- {
- IntPtr native_info = GLib.Marshaller.StructureToPtrAlloc<Glade.WidgetInfo> (info);
- native_cb (xml == null ? IntPtr.Zero : xml.Handle, parent == null ? IntPtr.Zero : parent.Handle, native_info);
- Marshal.FreeHGlobal (native_info);
- }
- }
-
internal class BuildChildrenFuncWrapper {
public void NativeCallback (IntPtr xml, IntPtr parent, IntPtr info)
{
try {
managed (GLib.Object.GetObject(xml) as Glade.XML, GLib.Object.GetObject(parent) as Gtk.Widget, Glade.WidgetInfo.New (info));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal BuildChildrenFuncNative NativeDelegate;
+ internal readonly BuildChildrenFuncNative NativeDelegate;
Glade.BuildChildrenFunc managed;
public BuildChildrenFuncWrapper (Glade.BuildChildrenFunc managed)
@@ -80,15 +32,6 @@ namespace GladeSharp {
NativeDelegate = new BuildChildrenFuncNative (NativeCallback);
}
- public static Glade.BuildChildrenFunc GetManagedDelegate (BuildChildrenFuncNative native)
- {
- if (native == null)
- return null;
- BuildChildrenFuncWrapper wrapper = (BuildChildrenFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/glade/generated/GladeSharp.FindInternalChildFuncNative.cs b/glade/generated/GladeSharp.FindInternalChildFuncNative.cs
index a4bd72804..0139ab3e4 100644
--- a/glade/generated/GladeSharp.FindInternalChildFuncNative.cs
+++ b/glade/generated/GladeSharp.FindInternalChildFuncNative.cs
@@ -10,53 +10,12 @@ namespace GladeSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate IntPtr FindInternalChildFuncNative(IntPtr xml, IntPtr parent, IntPtr childname);
- internal class FindInternalChildFuncInvoker {
-
- FindInternalChildFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~FindInternalChildFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal FindInternalChildFuncInvoker (FindInternalChildFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal FindInternalChildFuncInvoker (FindInternalChildFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal FindInternalChildFuncInvoker (FindInternalChildFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Glade.FindInternalChildFunc Handler {
- get {
- return new Glade.FindInternalChildFunc(InvokeNative);
- }
- }
-
- Gtk.Widget InvokeNative (Glade.XML xml, Gtk.Widget parent, string childname)
- {
- IntPtr native_childname = GLib.Marshaller.StringToPtrGStrdup (childname);
- Gtk.Widget result = GLib.Object.GetObject(native_cb (xml == null ? IntPtr.Zero : xml.Handle, parent == null ? IntPtr.Zero : parent.Handle, native_childname)) as Gtk.Widget;
- GLib.Marshaller.Free (native_childname);
- return result;
- }
- }
-
internal class FindInternalChildFuncWrapper {
public IntPtr NativeCallback (IntPtr xml, IntPtr parent, IntPtr childname)
{
try {
Gtk.Widget __ret = managed (GLib.Object.GetObject(xml) as Glade.XML, GLib.Object.GetObject(parent) as Gtk.Widget, GLib.Marshaller.Utf8PtrToString (childname));
- if (release_on_call)
- gch.Free ();
return __ret == null ? IntPtr.Zero : __ret.Handle;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
@@ -65,16 +24,8 @@ namespace GladeSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal FindInternalChildFuncNative NativeDelegate;
+ internal readonly FindInternalChildFuncNative NativeDelegate;
Glade.FindInternalChildFunc managed;
public FindInternalChildFuncWrapper (Glade.FindInternalChildFunc managed)
@@ -84,15 +35,6 @@ namespace GladeSharp {
NativeDelegate = new FindInternalChildFuncNative (NativeCallback);
}
- public static Glade.FindInternalChildFunc GetManagedDelegate (FindInternalChildFuncNative native)
- {
- if (native == null)
- return null;
- FindInternalChildFuncWrapper wrapper = (FindInternalChildFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/glade/generated/GladeSharp.NewFuncNative.cs b/glade/generated/GladeSharp.NewFuncNative.cs
index 10d335f9e..fb6cc1c2b 100644
--- a/glade/generated/GladeSharp.NewFuncNative.cs
+++ b/glade/generated/GladeSharp.NewFuncNative.cs
@@ -10,53 +10,12 @@ namespace GladeSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate IntPtr NewFuncNative(IntPtr xml, IntPtr widget_type, IntPtr info);
- internal class NewFuncInvoker {
-
- NewFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~NewFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal NewFuncInvoker (NewFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal NewFuncInvoker (NewFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal NewFuncInvoker (NewFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Glade.NewFunc Handler {
- get {
- return new Glade.NewFunc(InvokeNative);
- }
- }
-
- Gtk.Widget InvokeNative (Glade.XML xml, GLib.GType widget_type, Glade.WidgetInfo info)
- {
- IntPtr native_info = GLib.Marshaller.StructureToPtrAlloc<Glade.WidgetInfo> (info);
- Gtk.Widget result = GLib.Object.GetObject(native_cb (xml == null ? IntPtr.Zero : xml.Handle, widget_type.Val, native_info)) as Gtk.Widget;
- Marshal.FreeHGlobal (native_info);
- return result;
- }
- }
-
internal class NewFuncWrapper {
public IntPtr NativeCallback (IntPtr xml, IntPtr widget_type, IntPtr info)
{
try {
Gtk.Widget __ret = managed (GLib.Object.GetObject(xml) as Glade.XML, new GLib.GType(widget_type), Glade.WidgetInfo.New (info));
- if (release_on_call)
- gch.Free ();
return __ret == null ? IntPtr.Zero : __ret.Handle;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
@@ -65,16 +24,8 @@ namespace GladeSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal NewFuncNative NativeDelegate;
+ internal readonly NewFuncNative NativeDelegate;
Glade.NewFunc managed;
public NewFuncWrapper (Glade.NewFunc managed)
@@ -84,15 +35,6 @@ namespace GladeSharp {
NativeDelegate = new NewFuncNative (NativeCallback);
}
- public static Glade.NewFunc GetManagedDelegate (NewFuncNative native)
- {
- if (native == null)
- return null;
- NewFuncWrapper wrapper = (NewFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/glade/generated/GladeSharp.XMLConnectFuncNative.cs b/glade/generated/GladeSharp.XMLConnectFuncNative.cs
index 146eb9778..d74898dd7 100644
--- a/glade/generated/GladeSharp.XMLConnectFuncNative.cs
+++ b/glade/generated/GladeSharp.XMLConnectFuncNative.cs
@@ -10,89 +10,21 @@ namespace GladeSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void XMLConnectFuncNative(IntPtr handler_name, IntPtr objekt, IntPtr signal_name, IntPtr signal_data, IntPtr connect_object, bool after, IntPtr user_data);
- internal class XMLConnectFuncInvoker {
+ internal static class XMLConnectFuncWrapper {
- XMLConnectFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~XMLConnectFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal XMLConnectFuncInvoker (XMLConnectFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal XMLConnectFuncInvoker (XMLConnectFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal XMLConnectFuncInvoker (XMLConnectFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Glade.XMLConnectFunc Handler {
- get {
- return new Glade.XMLConnectFunc(InvokeNative);
- }
- }
-
- void InvokeNative (string handler_name, GLib.Object objekt, string signal_name, string signal_data, GLib.Object connect_object, bool after)
- {
- IntPtr native_handler_name = GLib.Marshaller.StringToPtrGStrdup (handler_name);
- IntPtr native_signal_name = GLib.Marshaller.StringToPtrGStrdup (signal_name);
- IntPtr native_signal_data = GLib.Marshaller.StringToPtrGStrdup (signal_data);
- native_cb (native_handler_name, objekt == null ? IntPtr.Zero : objekt.Handle, native_signal_name, native_signal_data, connect_object == null ? IntPtr.Zero : connect_object.Handle, after, __data);
- GLib.Marshaller.Free (native_handler_name);
- GLib.Marshaller.Free (native_signal_name);
- GLib.Marshaller.Free (native_signal_data);
- }
- }
-
- internal class XMLConnectFuncWrapper {
-
- public void NativeCallback (IntPtr handler_name, IntPtr objekt, IntPtr signal_name, IntPtr signal_data, IntPtr connect_object, bool after, IntPtr user_data)
+ public static void NativeCallback (IntPtr handler_name, IntPtr objekt, IntPtr signal_name, IntPtr signal_data, IntPtr connect_object, bool after, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Glade.XMLConnectFunc)gch.Target;
managed (GLib.Marshaller.Utf8PtrToString (handler_name), GLib.Object.GetObject (objekt), GLib.Marshaller.Utf8PtrToString (signal_name), GLib.Marshaller.Utf8PtrToString (signal_data), GLib.Object.GetObject (connect_object), after);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal XMLConnectFuncNative NativeDelegate;
- Glade.XMLConnectFunc managed;
-
- public XMLConnectFuncWrapper (Glade.XMLConnectFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new XMLConnectFuncNative (NativeCallback);
- }
-
- public static Glade.XMLConnectFunc GetManagedDelegate (XMLConnectFuncNative native)
- {
- if (native == null)
- return null;
- XMLConnectFuncWrapper wrapper = (XMLConnectFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly XMLConnectFuncNative NativeDelegate = new XMLConnectFuncNative (NativeCallback);
}
#endregion
}
diff --git a/glade/generated/GladeSharp.XMLCustomWidgetHandlerNative.cs b/glade/generated/GladeSharp.XMLCustomWidgetHandlerNative.cs
index c612d522c..2224c408e 100644
--- a/glade/generated/GladeSharp.XMLCustomWidgetHandlerNative.cs
+++ b/glade/generated/GladeSharp.XMLCustomWidgetHandlerNative.cs
@@ -10,59 +10,14 @@ namespace GladeSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate IntPtr XMLCustomWidgetHandlerNative(IntPtr xml, IntPtr func_name, IntPtr name, IntPtr string1, IntPtr string2, int int1, int int2, IntPtr user_data);
- internal class XMLCustomWidgetHandlerInvoker {
+ internal static class XMLCustomWidgetHandlerWrapper {
- XMLCustomWidgetHandlerNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~XMLCustomWidgetHandlerInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal XMLCustomWidgetHandlerInvoker (XMLCustomWidgetHandlerNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal XMLCustomWidgetHandlerInvoker (XMLCustomWidgetHandlerNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal XMLCustomWidgetHandlerInvoker (XMLCustomWidgetHandlerNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Glade.XMLCustomWidgetHandler Handler {
- get {
- return new Glade.XMLCustomWidgetHandler(InvokeNative);
- }
- }
-
- Gtk.Widget InvokeNative (Glade.XML xml, string func_name, string name, string string1, string string2, int int1, int int2)
- {
- IntPtr native_func_name = GLib.Marshaller.StringToPtrGStrdup (func_name);
- IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
- IntPtr native_string1 = GLib.Marshaller.StringToPtrGStrdup (string1);
- IntPtr native_string2 = GLib.Marshaller.StringToPtrGStrdup (string2);
- Gtk.Widget result = GLib.Object.GetObject(native_cb (xml == null ? IntPtr.Zero : xml.Handle, native_func_name, native_name, native_string1, native_string2, int1, int2, __data)) as Gtk.Widget;
- GLib.Marshaller.Free (native_func_name);
- GLib.Marshaller.Free (native_name);
- GLib.Marshaller.Free (native_string1);
- GLib.Marshaller.Free (native_string2);
- return result;
- }
- }
-
- internal class XMLCustomWidgetHandlerWrapper {
-
- public IntPtr NativeCallback (IntPtr xml, IntPtr func_name, IntPtr name, IntPtr string1, IntPtr string2, int int1, int int2, IntPtr user_data)
+ public static IntPtr NativeCallback (IntPtr xml, IntPtr func_name, IntPtr name, IntPtr string1, IntPtr string2, int int1, int int2, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Glade.XMLCustomWidgetHandler)gch.Target;
Gtk.Widget __ret = managed (GLib.Object.GetObject(xml) as Glade.XML, GLib.Marshaller.Utf8PtrToString (func_name), GLib.Marshaller.Utf8PtrToString (name), GLib.Marshaller.Utf8PtrToString (string1), GLib.Marshaller.Utf8PtrToString (string2), int1, int2);
- if (release_on_call)
- gch.Free ();
return __ret == null ? IntPtr.Zero : __ret.Handle;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
@@ -71,34 +26,8 @@ namespace GladeSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal XMLCustomWidgetHandlerNative NativeDelegate;
- Glade.XMLCustomWidgetHandler managed;
-
- public XMLCustomWidgetHandlerWrapper (Glade.XMLCustomWidgetHandler managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new XMLCustomWidgetHandlerNative (NativeCallback);
- }
-
- public static Glade.XMLCustomWidgetHandler GetManagedDelegate (XMLCustomWidgetHandlerNative native)
- {
- if (native == null)
- return null;
- XMLCustomWidgetHandlerWrapper wrapper = (XMLCustomWidgetHandlerWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly XMLCustomWidgetHandlerNative NativeDelegate = new XMLCustomWidgetHandlerNative (NativeCallback);
}
#endregion
}
diff --git a/glade/generated/XML.cs b/glade/generated/XML.cs
index 6d796cb6b..d892c5cd2 100644
--- a/glade/generated/XML.cs
+++ b/glade/generated/XML.cs
@@ -167,8 +167,9 @@ namespace Glade {
static extern void glade_xml_signal_autoconnect_full(IntPtr raw, GladeSharp.XMLConnectFuncNative func, IntPtr user_data);
public void SignalAutoconnectFull(Glade.XMLConnectFunc func) {
- GladeSharp.XMLConnectFuncWrapper func_wrapper = new GladeSharp.XMLConnectFuncWrapper (func);
- glade_xml_signal_autoconnect_full(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (func);
+ glade_xml_signal_autoconnect_full(Handle, GladeSharp.XMLConnectFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libglade-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -207,9 +208,10 @@ namespace Glade {
public void SignalConnectFull(string handler_name, Glade.XMLConnectFunc func) {
IntPtr native_handler_name = GLib.Marshaller.StringToPtrGStrdup (handler_name);
- GladeSharp.XMLConnectFuncWrapper func_wrapper = new GladeSharp.XMLConnectFuncWrapper (func);
- glade_xml_signal_connect_full(Handle, native_handler_name, func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (func);
+ glade_xml_signal_connect_full(Handle, native_handler_name, GladeSharp.XMLConnectFuncWrapper.NativeDelegate, (IntPtr)gch);
GLib.Marshaller.Free (native_handler_name);
+ gch.Free();
}
#endregion
@@ -242,15 +244,20 @@ namespace Glade {
// Boston, MA 02111-1307, USA.
// keep this around so it doesn't get GC'd
- static GladeSharp.XMLCustomWidgetHandlerWrapper callback_wrapper = null;
+ static GCHandle gch;
+ static Glade.XMLCustomWidgetHandler callback_wrapper = null;
[DllImport("libglade-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
static extern void glade_set_custom_handler (GladeSharp.XMLCustomWidgetHandlerNative handler, IntPtr user_data);
public static Glade.XMLCustomWidgetHandler CustomHandler {
set {
- callback_wrapper = new GladeSharp.XMLCustomWidgetHandlerWrapper (value);
- glade_set_custom_handler(callback_wrapper.NativeDelegate, IntPtr.Zero);
+ if (callback_wrapper != null) {
+ gch.Free ();
+ }
+
+ gch = GCHandle.Alloc (value);
+ glade_set_custom_handler(GladeSharp.XMLCustomWidgetHandlerWrapper.NativeDelegate, (IntPtr)gch);
}
}
diff --git a/gtk/generated/AboutDialog.cs b/gtk/generated/AboutDialog.cs
index 139b88016..f89a990d3 100644
--- a/gtk/generated/AboutDialog.cs
+++ b/gtk/generated/AboutDialog.cs
@@ -306,18 +306,17 @@ namespace Gtk {
public static Gtk.AboutDialogActivateLinkFunc SetUrlHook(Gtk.AboutDialogActivateLinkFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.AboutDialogActivateLinkFuncWrapper func_wrapper = new GtkSharp.AboutDialogActivateLinkFuncWrapper (func);
IntPtr data;
GLib.DestroyNotify destroy;
if (func == null) {
data = IntPtr.Zero;
destroy = null;
} else {
- data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ data = (IntPtr) GCHandle.Alloc (func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- GtkSharp.AboutDialogActivateLinkFuncNative raw_ret = gtk_about_dialog_set_url_hook(func_wrapper.NativeDelegate, data, destroy);
- Gtk.AboutDialogActivateLinkFunc ret = GtkSharp.AboutDialogActivateLinkFuncWrapper.GetManagedDelegate (raw_ret);
+ GtkSharp.AboutDialogActivateLinkFuncNative raw_ret = gtk_about_dialog_set_url_hook(GtkSharp.AboutDialogActivateLinkFuncWrapper.NativeDelegate, data, destroy);
+ Gtk.AboutDialogActivateLinkFunc ret = new GtkSharp.AboutDialogActivateLinkFuncInvoker (raw_ret).Handler;
return ret;
}
@@ -326,18 +325,17 @@ namespace Gtk {
public static Gtk.AboutDialogActivateLinkFunc SetEmailHook(Gtk.AboutDialogActivateLinkFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.AboutDialogActivateLinkFuncWrapper func_wrapper = new GtkSharp.AboutDialogActivateLinkFuncWrapper (func);
IntPtr data;
GLib.DestroyNotify destroy;
if (func == null) {
data = IntPtr.Zero;
destroy = null;
} else {
- data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ data = (IntPtr) GCHandle.Alloc (func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- GtkSharp.AboutDialogActivateLinkFuncNative raw_ret = gtk_about_dialog_set_email_hook(func_wrapper.NativeDelegate, data, destroy);
- Gtk.AboutDialogActivateLinkFunc ret = GtkSharp.AboutDialogActivateLinkFuncWrapper.GetManagedDelegate (raw_ret);
+ GtkSharp.AboutDialogActivateLinkFuncNative raw_ret = gtk_about_dialog_set_email_hook(GtkSharp.AboutDialogActivateLinkFuncWrapper.NativeDelegate, data, destroy);
+ Gtk.AboutDialogActivateLinkFunc ret = new GtkSharp.AboutDialogActivateLinkFuncInvoker (raw_ret).Handler;
return ret;
}
diff --git a/gtk/generated/AccelGroup.cs b/gtk/generated/AccelGroup.cs
index 491e39e50..217bce613 100644
--- a/gtk/generated/AccelGroup.cs
+++ b/gtk/generated/AccelGroup.cs
@@ -193,9 +193,10 @@ namespace Gtk {
public Gtk.AccelKey Find(Gtk.AccelGroupFindFunc find_func) {
Gtk.Application.AssertMainThread();
- GtkSharp.AccelGroupFindFuncWrapper find_func_wrapper = new GtkSharp.AccelGroupFindFuncWrapper (find_func);
- IntPtr raw_ret = gtk_accel_group_find(Handle, find_func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (find_func);
+ IntPtr raw_ret = gtk_accel_group_find(Handle, GtkSharp.AccelGroupFindFuncWrapper.NativeDelegate, (IntPtr)gch);
Gtk.AccelKey ret = Gtk.AccelKey.New (raw_ret);
+ gch.Free();
return ret;
}
diff --git a/gtk/generated/ActionGroup.cs b/gtk/generated/ActionGroup.cs
index 9a3c16db9..7c1327478 100644
--- a/gtk/generated/ActionGroup.cs
+++ b/gtk/generated/ActionGroup.cs
@@ -362,17 +362,16 @@ namespace Gtk {
public Gtk.TranslateFunc TranslateFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.TranslateFuncWrapper value_wrapper = new GtkSharp.TranslateFuncWrapper (value);
IntPtr data;
GLib.DestroyNotify notify;
if (value == null) {
data = IntPtr.Zero;
notify = null;
} else {
- data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ data = (IntPtr) GCHandle.Alloc (value);
notify = GLib.DestroyHelper.NotifyHandler;
}
- gtk_action_group_set_translate_func(Handle, value_wrapper.NativeDelegate, data, notify);
+ gtk_action_group_set_translate_func(Handle, GtkSharp.TranslateFuncWrapper.NativeDelegate, data, notify);
}
}
diff --git a/gtk/generated/Assistant.cs b/gtk/generated/Assistant.cs
index b92a460f2..a51edd600 100644
--- a/gtk/generated/Assistant.cs
+++ b/gtk/generated/Assistant.cs
@@ -503,17 +503,16 @@ namespace Gtk {
public Gtk.AssistantPageFunc ForwardPageFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.AssistantPageFuncWrapper value_wrapper = new GtkSharp.AssistantPageFuncWrapper (value);
IntPtr data;
GLib.DestroyNotify destroy;
if (value == null) {
data = IntPtr.Zero;
destroy = null;
} else {
- data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ data = (IntPtr) GCHandle.Alloc (value);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_assistant_set_forward_page_func(Handle, value_wrapper.NativeDelegate, data, destroy);
+ gtk_assistant_set_forward_page_func(Handle, GtkSharp.AssistantPageFuncWrapper.NativeDelegate, data, destroy);
}
}
diff --git a/gtk/generated/Builder.cs b/gtk/generated/Builder.cs
index c284b4040..e3607d8f2 100644
--- a/gtk/generated/Builder.cs
+++ b/gtk/generated/Builder.cs
@@ -354,8 +354,10 @@ class SignalConnector
static extern void gtk_builder_connect_signals_full(IntPtr raw, GtkSharp.BuilderConnectFuncNative func, IntPtr user_data);
public void ConnectSignals() {
- GtkSharp.BuilderConnectFuncWrapper func_wrapper = new GtkSharp.BuilderConnectFuncWrapper (ConnectFunc);
- gtk_builder_connect_signals_full(builder.Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ BuilderConnectFunc func = ConnectFunc;
+ var gch = GCHandle.Alloc (func);
+ gtk_builder_connect_signals_full(builder.Handle, GtkSharp.BuilderConnectFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free ();
}
public void ConnectFunc (Builder builder, GLib.Object objekt, string signal_name, string handler_name, GLib.Object connect_object, GLib.ConnectFlags flags)
diff --git a/gtk/generated/CellLayoutAdapter.cs b/gtk/generated/CellLayoutAdapter.cs
index 7783db66a..2bcf0ba63 100644
--- a/gtk/generated/CellLayoutAdapter.cs
+++ b/gtk/generated/CellLayoutAdapter.cs
@@ -282,17 +282,16 @@ namespace Gtk {
public void SetCellDataFunc(Gtk.CellRenderer cell, Gtk.CellLayoutDataFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.CellLayoutDataFuncWrapper func_wrapper = new GtkSharp.CellLayoutDataFuncWrapper (func);
IntPtr func_data;
GLib.DestroyNotify destroy;
if (func == null) {
func_data = IntPtr.Zero;
destroy = null;
} else {
- func_data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ func_data = (IntPtr) GCHandle.Alloc (func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_cell_layout_set_cell_data_func(Handle, cell == null ? IntPtr.Zero : cell.Handle, func_wrapper.NativeDelegate, func_data, destroy);
+ gtk_cell_layout_set_cell_data_func(Handle, cell == null ? IntPtr.Zero : cell.Handle, GtkSharp.CellLayoutDataFuncWrapper.NativeDelegate, func_data, destroy);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/CellView.cs b/gtk/generated/CellView.cs
index 04b56d34d..dabb86a12 100644
--- a/gtk/generated/CellView.cs
+++ b/gtk/generated/CellView.cs
@@ -228,17 +228,16 @@ namespace Gtk {
public void SetCellDataFunc(Gtk.CellRenderer cell, Gtk.CellLayoutDataFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.CellLayoutDataFuncWrapper func_wrapper = new GtkSharp.CellLayoutDataFuncWrapper (func);
IntPtr func_data;
GLib.DestroyNotify destroy;
if (func == null) {
func_data = IntPtr.Zero;
destroy = null;
} else {
- func_data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ func_data = (IntPtr) GCHandle.Alloc (func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_cell_layout_set_cell_data_func(Handle, cell == null ? IntPtr.Zero : cell.Handle, func_wrapper.NativeDelegate, func_data, destroy);
+ gtk_cell_layout_set_cell_data_func(Handle, cell == null ? IntPtr.Zero : cell.Handle, GtkSharp.CellLayoutDataFuncWrapper.NativeDelegate, func_data, destroy);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/Clipboard.cs b/gtk/generated/Clipboard.cs
index 35230af37..b5adda7ac 100644
--- a/gtk/generated/Clipboard.cs
+++ b/gtk/generated/Clipboard.cs
@@ -116,9 +116,8 @@ namespace Gtk {
public void RequestTargets(Gtk.ClipboardTargetsReceivedFunc cb) {
Gtk.Application.AssertMainThread();
- GtkSharp.ClipboardTargetsReceivedFuncWrapper cb_wrapper = new GtkSharp.ClipboardTargetsReceivedFuncWrapper (cb);
- cb_wrapper.PersistUntilCalled ();
- gtk_clipboard_request_targets(Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (cb);
+ gtk_clipboard_request_targets(Handle, GtkSharp.ClipboardTargetsReceivedFuncWrapper.NativeDelegate, (IntPtr)gch);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -135,9 +134,8 @@ namespace Gtk {
public void RequestContents(Gdk.Atom target, Gtk.ClipboardReceivedFunc cb) {
Gtk.Application.AssertMainThread();
- GtkSharp.ClipboardReceivedFuncWrapper cb_wrapper = new GtkSharp.ClipboardReceivedFuncWrapper (cb);
- cb_wrapper.PersistUntilCalled ();
- gtk_clipboard_request_contents(Handle, target == null ? IntPtr.Zero : target.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (cb);
+ gtk_clipboard_request_contents(Handle, target == null ? IntPtr.Zero : target.Handle, GtkSharp.ClipboardReceivedFuncWrapper.NativeDelegate, (IntPtr)gch);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -154,9 +152,8 @@ namespace Gtk {
public void RequestImage(Gtk.ClipboardImageReceivedFunc cb) {
Gtk.Application.AssertMainThread();
- GtkSharp.ClipboardImageReceivedFuncWrapper cb_wrapper = new GtkSharp.ClipboardImageReceivedFuncWrapper (cb);
- cb_wrapper.PersistUntilCalled ();
- gtk_clipboard_request_image(Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (cb);
+ gtk_clipboard_request_image(Handle, GtkSharp.ClipboardImageReceivedFuncWrapper.NativeDelegate, (IntPtr)gch);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -277,9 +274,8 @@ namespace Gtk {
public void RequestText(Gtk.ClipboardTextReceivedFunc cb) {
Gtk.Application.AssertMainThread();
- GtkSharp.ClipboardTextReceivedFuncWrapper cb_wrapper = new GtkSharp.ClipboardTextReceivedFuncWrapper (cb);
- cb_wrapper.PersistUntilCalled ();
- gtk_clipboard_request_text(Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (cb);
+ gtk_clipboard_request_text(Handle, GtkSharp.ClipboardTextReceivedFuncWrapper.NativeDelegate, (IntPtr)gch);
}
#endregion
@@ -312,13 +308,13 @@ namespace Gtk {
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
static extern bool gtk_clipboard_set_with_owner(IntPtr raw, TargetEntry[] targets, int n_targets, GtkSharp.ClipboardGetFuncNative get_func, GtkSharp.ClipboardClearFuncNative clear_func, IntPtr owner);
- void ClearProxy (Clipboard clipboard)
+ static void ClearProxy (Clipboard clipboard)
{
- if (PersistentData ["clear_func"] != null) {
- ClipboardClearFunc clear = PersistentData ["clear_func"] as ClipboardClearFunc;
+ if (clipboard.PersistentData ["clear_func"] != null) {
+ ClipboardClearFunc clear = clipboard.PersistentData ["clear_func"] as ClipboardClearFunc;
clear (clipboard);
}
- SetPersistentData (null, null, null);
+ clipboard.SetPersistentData (null, null, null);
}
void SetPersistentData (object get_func_wrapper, object clear_func, object clear_proxy_wrapper)
@@ -328,9 +324,9 @@ namespace Gtk {
PersistentData ["clear_proxy_wrapper"] = clear_proxy_wrapper;
}
+ static readonly ClipboardClearFunc clear_proxy = ClearProxy;
public bool SetWithData (TargetEntry[] targets, ClipboardGetFunc get_func, ClipboardClearFunc clear_func)
{
- ClipboardClearFunc clear_proxy = new ClipboardClearFunc (ClearProxy);
GtkSharp.ClipboardGetFuncWrapper get_func_wrapper = new GtkSharp.ClipboardGetFuncWrapper (get_func);
GtkSharp.ClipboardClearFuncWrapper clear_proxy_wrapper = new GtkSharp.ClipboardClearFuncWrapper (clear_proxy);
bool ret = gtk_clipboard_set_with_data (Handle, targets, targets.Length, get_func_wrapper.NativeDelegate, clear_proxy_wrapper.NativeDelegate, IntPtr.Zero);
@@ -340,7 +336,6 @@ namespace Gtk {
public bool SetWithOwner (TargetEntry[] targets, ClipboardGetFunc get_func, ClipboardClearFunc clear_func, GLib.Object owner)
{
- ClipboardClearFunc clear_proxy = new ClipboardClearFunc (ClearProxy);
GtkSharp.ClipboardGetFuncWrapper get_func_wrapper = new GtkSharp.ClipboardGetFuncWrapper (get_func);
GtkSharp.ClipboardClearFuncWrapper clear_proxy_wrapper = new GtkSharp.ClipboardClearFuncWrapper (clear_proxy);
bool ret = gtk_clipboard_set_with_owner (Handle, targets, targets.Length, get_func_wrapper.NativeDelegate, clear_proxy_wrapper.NativeDelegate, owner == null ? IntPtr.Zero : owner.Handle);
@@ -374,13 +369,12 @@ namespace Gtk {
public delegate void RichTextReceivedFunc (Gtk.Clipboard clipboard, Gdk.Atom format, byte[] text);
- static RichTextReceivedFuncNative rt_rcvd_marshaler;
+ static readonly RichTextReceivedFuncNative rt_rcvd_marshaler = new RichTextReceivedFuncNative (RichTextReceivedCallback);
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void RichTextReceivedFuncNative (IntPtr clipboard, IntPtr format, IntPtr text, UIntPtr length, IntPtr data);
-
- void RichTextReceivedCallback (IntPtr clipboard_ptr, IntPtr format_ptr, IntPtr text_ptr, UIntPtr length, IntPtr data)
+ static void RichTextReceivedCallback (IntPtr clipboard_ptr, IntPtr format_ptr, IntPtr text_ptr, UIntPtr length, IntPtr data)
{
try {
Gtk.Clipboard clipboard = GLib.Object.GetObject(clipboard_ptr) as Gtk.Clipboard;
@@ -402,8 +396,6 @@ namespace Gtk {
public void RequestRichText (Gtk.TextBuffer buffer, RichTextReceivedFunc cb)
{
- if (rt_rcvd_marshaler == null)
- rt_rcvd_marshaler = new RichTextReceivedFuncNative (RichTextReceivedCallback);
gtk_clipboard_request_rich_text (Handle, buffer == null ? IntPtr.Zero : buffer.Handle, rt_rcvd_marshaler, (IntPtr) GCHandle.Alloc (cb));
}
diff --git a/gtk/generated/ComboBox.cs b/gtk/generated/ComboBox.cs
index c1b4e1565..a0394f465 100644
--- a/gtk/generated/ComboBox.cs
+++ b/gtk/generated/ComboBox.cs
@@ -478,22 +478,21 @@ namespace Gtk {
public Gtk.TreeViewRowSeparatorFunc RowSeparatorFunc {
get {
GtkSharp.TreeViewRowSeparatorFuncNative raw_ret = gtk_combo_box_get_row_separator_func(Handle);
- Gtk.TreeViewRowSeparatorFunc ret = GtkSharp.TreeViewRowSeparatorFuncWrapper.GetManagedDelegate (raw_ret);
+ Gtk.TreeViewRowSeparatorFunc ret = new GtkSharp.TreeViewRowSeparatorFuncInvoker (raw_ret).Handler;
return ret;
}
set {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeViewRowSeparatorFuncWrapper value_wrapper = new GtkSharp.TreeViewRowSeparatorFuncWrapper (value);
IntPtr data;
GLib.DestroyNotify destroy;
if (value == null) {
data = IntPtr.Zero;
destroy = null;
} else {
- data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ data = (IntPtr) GCHandle.Alloc (value);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_combo_box_set_row_separator_func(Handle, value_wrapper.NativeDelegate, data, destroy);
+ gtk_combo_box_set_row_separator_func(Handle, GtkSharp.TreeViewRowSeparatorFuncWrapper.NativeDelegate, data, destroy);
}
}
@@ -621,17 +620,16 @@ namespace Gtk {
public void SetCellDataFunc(Gtk.CellRenderer cell, Gtk.CellLayoutDataFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.CellLayoutDataFuncWrapper func_wrapper = new GtkSharp.CellLayoutDataFuncWrapper (func);
IntPtr func_data;
GLib.DestroyNotify destroy;
if (func == null) {
func_data = IntPtr.Zero;
destroy = null;
} else {
- func_data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ func_data = (IntPtr) GCHandle.Alloc (func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_cell_layout_set_cell_data_func(Handle, cell == null ? IntPtr.Zero : cell.Handle, func_wrapper.NativeDelegate, func_data, destroy);
+ gtk_cell_layout_set_cell_data_func(Handle, cell == null ? IntPtr.Zero : cell.Handle, GtkSharp.CellLayoutDataFuncWrapper.NativeDelegate, func_data, destroy);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/Container.cs b/gtk/generated/Container.cs
index b2b0d4469..036e9faee 100644
--- a/gtk/generated/Container.cs
+++ b/gtk/generated/Container.cs
@@ -290,8 +290,9 @@ namespace Gtk {
public void Foreach(Gtk.Callback cb) {
Gtk.Application.AssertMainThread();
- GtkSharp.CallbackWrapper cb_wrapper = new GtkSharp.CallbackWrapper (cb);
- gtk_container_foreach(Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (cb);
+ gtk_container_foreach(Handle, GtkSharp.CallbackWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -314,8 +315,9 @@ namespace Gtk {
public void Forall(Gtk.Callback cb) {
Gtk.Application.AssertMainThread();
- GtkSharp.CallbackWrapper cb_wrapper = new GtkSharp.CallbackWrapper (cb);
- gtk_container_forall(Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (cb);
+ gtk_container_forall(Handle, GtkSharp.CallbackWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/EntryCompletion.cs b/gtk/generated/EntryCompletion.cs
index fa031271e..37e0b5033 100644
--- a/gtk/generated/EntryCompletion.cs
+++ b/gtk/generated/EntryCompletion.cs
@@ -421,17 +421,16 @@ namespace Gtk {
public Gtk.EntryCompletionMatchFunc MatchFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.EntryCompletionMatchFuncWrapper value_wrapper = new GtkSharp.EntryCompletionMatchFuncWrapper (value);
IntPtr func_data;
GLib.DestroyNotify func_notify;
if (value == null) {
func_data = IntPtr.Zero;
func_notify = null;
} else {
- func_data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ func_data = (IntPtr) GCHandle.Alloc (value);
func_notify = GLib.DestroyHelper.NotifyHandler;
}
- gtk_entry_completion_set_match_func(Handle, value_wrapper.NativeDelegate, func_data, func_notify);
+ gtk_entry_completion_set_match_func(Handle, GtkSharp.EntryCompletionMatchFuncWrapper.NativeDelegate, func_data, func_notify);
}
}
@@ -531,17 +530,16 @@ namespace Gtk {
public void SetCellDataFunc(Gtk.CellRenderer cell, Gtk.CellLayoutDataFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.CellLayoutDataFuncWrapper func_wrapper = new GtkSharp.CellLayoutDataFuncWrapper (func);
IntPtr func_data;
GLib.DestroyNotify destroy;
if (func == null) {
func_data = IntPtr.Zero;
destroy = null;
} else {
- func_data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ func_data = (IntPtr) GCHandle.Alloc (func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_cell_layout_set_cell_data_func(Handle, cell == null ? IntPtr.Zero : cell.Handle, func_wrapper.NativeDelegate, func_data, destroy);
+ gtk_cell_layout_set_cell_data_func(Handle, cell == null ? IntPtr.Zero : cell.Handle, GtkSharp.CellLayoutDataFuncWrapper.NativeDelegate, func_data, destroy);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/FileFilter.cs b/gtk/generated/FileFilter.cs
index 90c6d7579..81f0839d9 100644
--- a/gtk/generated/FileFilter.cs
+++ b/gtk/generated/FileFilter.cs
@@ -112,17 +112,16 @@ namespace Gtk {
public void AddCustom(Gtk.FileFilterFlags needed, Gtk.FileFilterFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.FileFilterFuncWrapper func_wrapper = new GtkSharp.FileFilterFuncWrapper (func);
IntPtr data;
GLib.DestroyNotify notify;
if (func == null) {
data = IntPtr.Zero;
notify = null;
} else {
- data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ data = (IntPtr) GCHandle.Alloc (func);
notify = GLib.DestroyHelper.NotifyHandler;
}
- gtk_file_filter_add_custom(Handle, (int) needed, func_wrapper.NativeDelegate, data, notify);
+ gtk_file_filter_add_custom(Handle, (int) needed, GtkSharp.FileFilterFuncWrapper.NativeDelegate, data, notify);
}
#endregion
diff --git a/gtk/generated/GtkSharp.AboutDialogActivateLinkFuncNative.cs b/gtk/generated/GtkSharp.AboutDialogActivateLinkFuncNative.cs
index f846132f1..351123926 100644
--- a/gtk/generated/GtkSharp.AboutDialogActivateLinkFuncNative.cs
+++ b/gtk/generated/GtkSharp.AboutDialogActivateLinkFuncNative.cs
@@ -49,47 +49,21 @@ namespace GtkSharp {
}
}
- internal class AboutDialogActivateLinkFuncWrapper {
+ internal static class AboutDialogActivateLinkFuncWrapper {
- public void NativeCallback (IntPtr about, IntPtr link_, IntPtr data)
+ public static void NativeCallback (IntPtr about, IntPtr link_, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.AboutDialogActivateLinkFunc)gch.Target;
managed (GLib.Object.GetObject(about) as Gtk.AboutDialog, GLib.Marshaller.Utf8PtrToString (link_));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal AboutDialogActivateLinkFuncNative NativeDelegate;
- Gtk.AboutDialogActivateLinkFunc managed;
-
- public AboutDialogActivateLinkFuncWrapper (Gtk.AboutDialogActivateLinkFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new AboutDialogActivateLinkFuncNative (NativeCallback);
- }
-
- public static Gtk.AboutDialogActivateLinkFunc GetManagedDelegate (AboutDialogActivateLinkFuncNative native)
- {
- if (native == null)
- return null;
- AboutDialogActivateLinkFuncWrapper wrapper = (AboutDialogActivateLinkFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly AboutDialogActivateLinkFuncNative NativeDelegate = new AboutDialogActivateLinkFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.AccelGroupActivateNative.cs b/gtk/generated/GtkSharp.AccelGroupActivateNative.cs
index 19fb1fdbe..b626dc374 100644
--- a/gtk/generated/GtkSharp.AccelGroupActivateNative.cs
+++ b/gtk/generated/GtkSharp.AccelGroupActivateNative.cs
@@ -10,52 +10,12 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool AccelGroupActivateNative(IntPtr accel_group, IntPtr acceleratable, uint keyval, int modifier);
- internal class AccelGroupActivateInvoker {
-
- AccelGroupActivateNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~AccelGroupActivateInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal AccelGroupActivateInvoker (AccelGroupActivateNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal AccelGroupActivateInvoker (AccelGroupActivateNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal AccelGroupActivateInvoker (AccelGroupActivateNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.AccelGroupActivate Handler {
- get {
- return new Gtk.AccelGroupActivate(InvokeNative);
- }
- }
-
- bool InvokeNative (Gtk.AccelGroup accel_group, GLib.Object acceleratable, uint keyval, Gdk.ModifierType modifier)
- {
- Gtk.Application.AssertMainThread();
- bool result = native_cb (accel_group == null ? IntPtr.Zero : accel_group.Handle, acceleratable == null ? IntPtr.Zero : acceleratable.Handle, keyval, (int) modifier);
- return result;
- }
- }
-
internal class AccelGroupActivateWrapper {
public bool NativeCallback (IntPtr accel_group, IntPtr acceleratable, uint keyval, int modifier)
{
try {
bool __ret = managed (GLib.Object.GetObject(accel_group) as Gtk.AccelGroup, GLib.Object.GetObject (acceleratable), keyval, (Gdk.ModifierType) modifier);
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -63,16 +23,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal AccelGroupActivateNative NativeDelegate;
+ internal readonly AccelGroupActivateNative NativeDelegate;
Gtk.AccelGroupActivate managed;
public AccelGroupActivateWrapper (Gtk.AccelGroupActivate managed)
@@ -82,15 +34,6 @@ namespace GtkSharp {
NativeDelegate = new AccelGroupActivateNative (NativeCallback);
}
- public static Gtk.AccelGroupActivate GetManagedDelegate (AccelGroupActivateNative native)
- {
- if (native == null)
- return null;
- AccelGroupActivateWrapper wrapper = (AccelGroupActivateWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.AccelGroupFindFuncNative.cs b/gtk/generated/GtkSharp.AccelGroupFindFuncNative.cs
index f592e37a6..177b0b3bc 100644
--- a/gtk/generated/GtkSharp.AccelGroupFindFuncNative.cs
+++ b/gtk/generated/GtkSharp.AccelGroupFindFuncNative.cs
@@ -10,54 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool AccelGroupFindFuncNative(IntPtr key, IntPtr closure, IntPtr data);
- internal class AccelGroupFindFuncInvoker {
+ internal static class AccelGroupFindFuncWrapper {
- AccelGroupFindFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~AccelGroupFindFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal AccelGroupFindFuncInvoker (AccelGroupFindFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal AccelGroupFindFuncInvoker (AccelGroupFindFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal AccelGroupFindFuncInvoker (AccelGroupFindFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.AccelGroupFindFunc Handler {
- get {
- return new Gtk.AccelGroupFindFunc(InvokeNative);
- }
- }
-
- bool InvokeNative (Gtk.AccelKey key, IntPtr closure)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_key = GLib.Marshaller.StructureToPtrAlloc<Gtk.AccelKey> (key);
- bool result = native_cb (native_key, closure, __data);
- Marshal.FreeHGlobal (native_key);
- return result;
- }
- }
-
- internal class AccelGroupFindFuncWrapper {
-
- public bool NativeCallback (IntPtr key, IntPtr closure, IntPtr data)
+ public static bool NativeCallback (IntPtr key, IntPtr closure, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.AccelGroupFindFunc)gch.Target;
bool __ret = managed (Gtk.AccelKey.New (key), closure);
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -65,34 +25,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal AccelGroupFindFuncNative NativeDelegate;
- Gtk.AccelGroupFindFunc managed;
-
- public AccelGroupFindFuncWrapper (Gtk.AccelGroupFindFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new AccelGroupFindFuncNative (NativeCallback);
- }
-
- public static Gtk.AccelGroupFindFunc GetManagedDelegate (AccelGroupFindFuncNative native)
- {
- if (native == null)
- return null;
- AccelGroupFindFuncWrapper wrapper = (AccelGroupFindFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly AccelGroupFindFuncNative NativeDelegate = new AccelGroupFindFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.AccelMapForeachNative.cs b/gtk/generated/GtkSharp.AccelMapForeachNative.cs
index d7f070702..cb73c425d 100644
--- a/gtk/generated/GtkSharp.AccelMapForeachNative.cs
+++ b/gtk/generated/GtkSharp.AccelMapForeachNative.cs
@@ -10,68 +10,19 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void AccelMapForeachNative(IntPtr data, IntPtr accel_path, uint accel_key, int accel_mods, bool changed);
- internal class AccelMapForeachInvoker {
-
- AccelMapForeachNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~AccelMapForeachInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal AccelMapForeachInvoker (AccelMapForeachNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal AccelMapForeachInvoker (AccelMapForeachNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal AccelMapForeachInvoker (AccelMapForeachNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.AccelMapForeach Handler {
- get {
- return new Gtk.AccelMapForeach(InvokeNative);
- }
- }
-
- void InvokeNative (IntPtr data, string accel_path, uint accel_key, Gdk.ModifierType accel_mods, bool changed)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_accel_path = GLib.Marshaller.StringToPtrGStrdup (accel_path);
- native_cb (__data, native_accel_path, accel_key, (int) accel_mods, changed);
- GLib.Marshaller.Free (native_accel_path);
- }
- }
-
internal class AccelMapForeachWrapper {
public void NativeCallback (IntPtr data, IntPtr accel_path, uint accel_key, int accel_mods, bool changed)
{
try {
managed (data, GLib.Marshaller.Utf8PtrToString (accel_path), accel_key, (Gdk.ModifierType) accel_mods, changed);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal AccelMapForeachNative NativeDelegate;
+ internal readonly AccelMapForeachNative NativeDelegate;
Gtk.AccelMapForeach managed;
public AccelMapForeachWrapper (Gtk.AccelMapForeach managed)
@@ -81,15 +32,6 @@ namespace GtkSharp {
NativeDelegate = new AccelMapForeachNative (NativeCallback);
}
- public static Gtk.AccelMapForeach GetManagedDelegate (AccelMapForeachNative native)
- {
- if (native == null)
- return null;
- AccelMapForeachWrapper wrapper = (AccelMapForeachWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.AssistantPageFuncNative.cs b/gtk/generated/GtkSharp.AssistantPageFuncNative.cs
index 90852e179..19ff487df 100644
--- a/gtk/generated/GtkSharp.AssistantPageFuncNative.cs
+++ b/gtk/generated/GtkSharp.AssistantPageFuncNative.cs
@@ -10,52 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate int AssistantPageFuncNative(int current_page, IntPtr data);
- internal class AssistantPageFuncInvoker {
+ internal static class AssistantPageFuncWrapper {
- AssistantPageFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~AssistantPageFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal AssistantPageFuncInvoker (AssistantPageFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal AssistantPageFuncInvoker (AssistantPageFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal AssistantPageFuncInvoker (AssistantPageFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.AssistantPageFunc Handler {
- get {
- return new Gtk.AssistantPageFunc(InvokeNative);
- }
- }
-
- int InvokeNative (int current_page)
- {
- Gtk.Application.AssertMainThread();
- int result = native_cb (current_page, __data);
- return result;
- }
- }
-
- internal class AssistantPageFuncWrapper {
-
- public int NativeCallback (int current_page, IntPtr data)
+ public static int NativeCallback (int current_page, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.AssistantPageFunc)gch.Target;
int __ret = managed (current_page);
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
@@ -64,34 +26,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal AssistantPageFuncNative NativeDelegate;
- Gtk.AssistantPageFunc managed;
-
- public AssistantPageFuncWrapper (Gtk.AssistantPageFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new AssistantPageFuncNative (NativeCallback);
- }
-
- public static Gtk.AssistantPageFunc GetManagedDelegate (AssistantPageFuncNative native)
- {
- if (native == null)
- return null;
- AssistantPageFuncWrapper wrapper = (AssistantPageFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly AssistantPageFuncNative NativeDelegate = new AssistantPageFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.BuilderConnectFuncNative.cs b/gtk/generated/GtkSharp.BuilderConnectFuncNative.cs
index 242c48b5b..f0c792805 100644
--- a/gtk/generated/GtkSharp.BuilderConnectFuncNative.cs
+++ b/gtk/generated/GtkSharp.BuilderConnectFuncNative.cs
@@ -10,88 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void BuilderConnectFuncNative(IntPtr builder, IntPtr objekt, IntPtr signal_name, IntPtr handler_name, IntPtr connect_object, int flags, IntPtr user_data);
- internal class BuilderConnectFuncInvoker {
+ internal static class BuilderConnectFuncWrapper {
- BuilderConnectFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~BuilderConnectFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal BuilderConnectFuncInvoker (BuilderConnectFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal BuilderConnectFuncInvoker (BuilderConnectFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal BuilderConnectFuncInvoker (BuilderConnectFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.BuilderConnectFunc Handler {
- get {
- return new Gtk.BuilderConnectFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.Builder builder, GLib.Object objekt, string signal_name, string handler_name, GLib.Object connect_object, GLib.ConnectFlags flags)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_signal_name = GLib.Marshaller.StringToPtrGStrdup (signal_name);
- IntPtr native_handler_name = GLib.Marshaller.StringToPtrGStrdup (handler_name);
- native_cb (builder == null ? IntPtr.Zero : builder.Handle, objekt == null ? IntPtr.Zero : objekt.Handle, native_signal_name, native_handler_name, connect_object == null ? IntPtr.Zero : connect_object.Handle, (int) flags, __data);
- GLib.Marshaller.Free (native_signal_name);
- GLib.Marshaller.Free (native_handler_name);
- }
- }
-
- internal class BuilderConnectFuncWrapper {
-
- public void NativeCallback (IntPtr builder, IntPtr objekt, IntPtr signal_name, IntPtr handler_name, IntPtr connect_object, int flags, IntPtr user_data)
+ public static void NativeCallback (IntPtr builder, IntPtr objekt, IntPtr signal_name, IntPtr handler_name, IntPtr connect_object, int flags, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.BuilderConnectFunc)gch.Target;
managed (GLib.Object.GetObject(builder) as Gtk.Builder, GLib.Object.GetObject (objekt), GLib.Marshaller.Utf8PtrToString (signal_name), GLib.Marshaller.Utf8PtrToString (handler_name), GLib.Object.GetObject (connect_object), (GLib.ConnectFlags) flags);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal BuilderConnectFuncNative NativeDelegate;
- Gtk.BuilderConnectFunc managed;
-
- public BuilderConnectFuncWrapper (Gtk.BuilderConnectFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new BuilderConnectFuncNative (NativeCallback);
- }
-
- public static Gtk.BuilderConnectFunc GetManagedDelegate (BuilderConnectFuncNative native)
- {
- if (native == null)
- return null;
- BuilderConnectFuncWrapper wrapper = (BuilderConnectFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly BuilderConnectFuncNative NativeDelegate = new BuilderConnectFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.CallbackMarshalNative.cs b/gtk/generated/GtkSharp.CallbackMarshalNative.cs
index 4c6b63ed6..e278f95f1 100644
--- a/gtk/generated/GtkSharp.CallbackMarshalNative.cs
+++ b/gtk/generated/GtkSharp.CallbackMarshalNative.cs
@@ -10,86 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void CallbackMarshalNative(IntPtr objekt, IntPtr data, uint n_args, IntPtr args);
- internal class CallbackMarshalInvoker {
+ internal static class CallbackMarshalWrapper {
- CallbackMarshalNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~CallbackMarshalInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal CallbackMarshalInvoker (CallbackMarshalNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal CallbackMarshalInvoker (CallbackMarshalNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal CallbackMarshalInvoker (CallbackMarshalNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.CallbackMarshal Handler {
- get {
- return new Gtk.CallbackMarshal(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.Object objekt, IntPtr data, uint n_args, Gtk.Arg args)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_args = GLib.Marshaller.StructureToPtrAlloc<Gtk.Arg> (args);
- native_cb (objekt == null ? IntPtr.Zero : objekt.Handle, __data, n_args, native_args);
- Marshal.FreeHGlobal (native_args);
- }
- }
-
- internal class CallbackMarshalWrapper {
-
- public void NativeCallback (IntPtr objekt, IntPtr data, uint n_args, IntPtr args)
+ public static void NativeCallback (IntPtr objekt, IntPtr data, uint n_args, IntPtr args)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.CallbackMarshal)gch.Target;
managed (GLib.Object.GetObject(objekt) as Gtk.Object, data, n_args, Gtk.Arg.New (args));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal CallbackMarshalNative NativeDelegate;
- Gtk.CallbackMarshal managed;
-
- public CallbackMarshalWrapper (Gtk.CallbackMarshal managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new CallbackMarshalNative (NativeCallback);
- }
-
- public static Gtk.CallbackMarshal GetManagedDelegate (CallbackMarshalNative native)
- {
- if (native == null)
- return null;
- CallbackMarshalWrapper wrapper = (CallbackMarshalWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly CallbackMarshalNative NativeDelegate = new CallbackMarshalNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.CallbackNative.cs b/gtk/generated/GtkSharp.CallbackNative.cs
index e4772526c..ebcad0a99 100644
--- a/gtk/generated/GtkSharp.CallbackNative.cs
+++ b/gtk/generated/GtkSharp.CallbackNative.cs
@@ -10,84 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void CallbackNative(IntPtr widget, IntPtr data);
- internal class CallbackInvoker {
+ internal static class CallbackWrapper {
- CallbackNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~CallbackInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal CallbackInvoker (CallbackNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal CallbackInvoker (CallbackNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal CallbackInvoker (CallbackNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.Callback Handler {
- get {
- return new Gtk.Callback(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.Widget widget)
- {
- Gtk.Application.AssertMainThread();
- native_cb (widget == null ? IntPtr.Zero : widget.Handle, __data);
- }
- }
-
- internal class CallbackWrapper {
-
- public void NativeCallback (IntPtr widget, IntPtr data)
+ public static void NativeCallback (IntPtr widget, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.Callback)gch.Target;
managed (GLib.Object.GetObject(widget) as Gtk.Widget);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal CallbackNative NativeDelegate;
- Gtk.Callback managed;
-
- public CallbackWrapper (Gtk.Callback managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new CallbackNative (NativeCallback);
- }
-
- public static Gtk.Callback GetManagedDelegate (CallbackNative native)
- {
- if (native == null)
- return null;
- CallbackWrapper wrapper = (CallbackWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly CallbackNative NativeDelegate = new CallbackNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.CellLayoutDataFuncNative.cs b/gtk/generated/GtkSharp.CellLayoutDataFuncNative.cs
index 1ee16f29c..022459e3d 100644
--- a/gtk/generated/GtkSharp.CellLayoutDataFuncNative.cs
+++ b/gtk/generated/GtkSharp.CellLayoutDataFuncNative.cs
@@ -49,47 +49,21 @@ namespace GtkSharp {
}
}
- internal class CellLayoutDataFuncWrapper {
+ internal static class CellLayoutDataFuncWrapper {
- public void NativeCallback (IntPtr cell_layout, IntPtr cell, IntPtr tree_model, IntPtr iter, IntPtr data)
+ public static void NativeCallback (IntPtr cell_layout, IntPtr cell, IntPtr tree_model, IntPtr iter, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.CellLayoutDataFunc)gch.Target;
managed (Gtk.CellLayoutAdapter.GetObject (cell_layout, false), GLib.Object.GetObject(cell) as Gtk.CellRenderer, Gtk.TreeModelAdapter.GetObject (tree_model, false), Gtk.TreeIter.New (iter));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal CellLayoutDataFuncNative NativeDelegate;
- Gtk.CellLayoutDataFunc managed;
-
- public CellLayoutDataFuncWrapper (Gtk.CellLayoutDataFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new CellLayoutDataFuncNative (NativeCallback);
- }
-
- public static Gtk.CellLayoutDataFunc GetManagedDelegate (CellLayoutDataFuncNative native)
- {
- if (native == null)
- return null;
- CellLayoutDataFuncWrapper wrapper = (CellLayoutDataFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly CellLayoutDataFuncNative NativeDelegate = new CellLayoutDataFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.ClipboardClearFuncNative.cs b/gtk/generated/GtkSharp.ClipboardClearFuncNative.cs
index 613fc3927..e55e466d7 100644
--- a/gtk/generated/GtkSharp.ClipboardClearFuncNative.cs
+++ b/gtk/generated/GtkSharp.ClipboardClearFuncNative.cs
@@ -10,66 +10,19 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void ClipboardClearFuncNative(IntPtr clipboard, IntPtr user_data_or_owner);
- internal class ClipboardClearFuncInvoker {
-
- ClipboardClearFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~ClipboardClearFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal ClipboardClearFuncInvoker (ClipboardClearFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal ClipboardClearFuncInvoker (ClipboardClearFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal ClipboardClearFuncInvoker (ClipboardClearFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.ClipboardClearFunc Handler {
- get {
- return new Gtk.ClipboardClearFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.Clipboard clipboard)
- {
- Gtk.Application.AssertMainThread();
- native_cb (clipboard == null ? IntPtr.Zero : clipboard.Handle, __data);
- }
- }
-
internal class ClipboardClearFuncWrapper {
public void NativeCallback (IntPtr clipboard, IntPtr user_data_or_owner)
{
try {
managed (GLib.Object.GetObject(clipboard) as Gtk.Clipboard);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal ClipboardClearFuncNative NativeDelegate;
+ internal readonly ClipboardClearFuncNative NativeDelegate;
Gtk.ClipboardClearFunc managed;
public ClipboardClearFuncWrapper (Gtk.ClipboardClearFunc managed)
@@ -79,15 +32,6 @@ namespace GtkSharp {
NativeDelegate = new ClipboardClearFuncNative (NativeCallback);
}
- public static Gtk.ClipboardClearFunc GetManagedDelegate (ClipboardClearFuncNative native)
- {
- if (native == null)
- return null;
- ClipboardClearFuncWrapper wrapper = (ClipboardClearFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.ClipboardGetFuncNative.cs b/gtk/generated/GtkSharp.ClipboardGetFuncNative.cs
index 8efd30869..232d62a72 100644
--- a/gtk/generated/GtkSharp.ClipboardGetFuncNative.cs
+++ b/gtk/generated/GtkSharp.ClipboardGetFuncNative.cs
@@ -10,66 +10,19 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void ClipboardGetFuncNative(IntPtr clipboard, IntPtr selection_data, uint info, IntPtr user_data_or_owner);
- internal class ClipboardGetFuncInvoker {
-
- ClipboardGetFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~ClipboardGetFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal ClipboardGetFuncInvoker (ClipboardGetFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal ClipboardGetFuncInvoker (ClipboardGetFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal ClipboardGetFuncInvoker (ClipboardGetFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.ClipboardGetFunc Handler {
- get {
- return new Gtk.ClipboardGetFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.Clipboard clipboard, Gtk.SelectionData selection_data, uint info)
- {
- Gtk.Application.AssertMainThread();
- native_cb (clipboard == null ? IntPtr.Zero : clipboard.Handle, selection_data == null ? IntPtr.Zero : selection_data.Handle, info, __data);
- }
- }
-
internal class ClipboardGetFuncWrapper {
public void NativeCallback (IntPtr clipboard, IntPtr selection_data, uint info, IntPtr user_data_or_owner)
{
try {
managed (GLib.Object.GetObject(clipboard) as Gtk.Clipboard, selection_data == IntPtr.Zero ? null : (Gtk.SelectionData) GLib.Opaque.GetOpaque (selection_data, typeof (Gtk.SelectionData), false), info);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal ClipboardGetFuncNative NativeDelegate;
+ internal readonly ClipboardGetFuncNative NativeDelegate;
Gtk.ClipboardGetFunc managed;
public ClipboardGetFuncWrapper (Gtk.ClipboardGetFunc managed)
@@ -79,15 +32,6 @@ namespace GtkSharp {
NativeDelegate = new ClipboardGetFuncNative (NativeCallback);
}
- public static Gtk.ClipboardGetFunc GetManagedDelegate (ClipboardGetFuncNative native)
- {
- if (native == null)
- return null;
- ClipboardGetFuncWrapper wrapper = (ClipboardGetFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.ClipboardImageReceivedFuncNative.cs b/gtk/generated/GtkSharp.ClipboardImageReceivedFuncNative.cs
index e4ea4be7f..9cd899a86 100644
--- a/gtk/generated/GtkSharp.ClipboardImageReceivedFuncNative.cs
+++ b/gtk/generated/GtkSharp.ClipboardImageReceivedFuncNative.cs
@@ -10,84 +10,22 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void ClipboardImageReceivedFuncNative(IntPtr clipboard, IntPtr pixbuf, IntPtr data);
- internal class ClipboardImageReceivedFuncInvoker {
+ internal static class ClipboardImageReceivedFuncWrapper {
- ClipboardImageReceivedFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~ClipboardImageReceivedFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal ClipboardImageReceivedFuncInvoker (ClipboardImageReceivedFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal ClipboardImageReceivedFuncInvoker (ClipboardImageReceivedFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal ClipboardImageReceivedFuncInvoker (ClipboardImageReceivedFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.ClipboardImageReceivedFunc Handler {
- get {
- return new Gtk.ClipboardImageReceivedFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.Clipboard clipboard, Gdk.Pixbuf pixbuf)
- {
- Gtk.Application.AssertMainThread();
- native_cb (clipboard == null ? IntPtr.Zero : clipboard.Handle, pixbuf == null ? IntPtr.Zero : pixbuf.Handle, __data);
- }
- }
-
- internal class ClipboardImageReceivedFuncWrapper {
-
- public void NativeCallback (IntPtr clipboard, IntPtr pixbuf, IntPtr data)
+ public static void NativeCallback (IntPtr clipboard, IntPtr pixbuf, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.ClipboardImageReceivedFunc)gch.Target;
managed (GLib.Object.GetObject(clipboard) as Gtk.Clipboard, GLib.Object.GetObject(pixbuf) as Gdk.Pixbuf);
- if (release_on_call)
gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal ClipboardImageReceivedFuncNative NativeDelegate;
- Gtk.ClipboardImageReceivedFunc managed;
-
- public ClipboardImageReceivedFuncWrapper (Gtk.ClipboardImageReceivedFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new ClipboardImageReceivedFuncNative (NativeCallback);
- }
-
- public static Gtk.ClipboardImageReceivedFunc GetManagedDelegate (ClipboardImageReceivedFuncNative native)
- {
- if (native == null)
- return null;
- ClipboardImageReceivedFuncWrapper wrapper = (ClipboardImageReceivedFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly ClipboardImageReceivedFuncNative NativeDelegate = new ClipboardImageReceivedFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.ClipboardReceivedFuncNative.cs b/gtk/generated/GtkSharp.ClipboardReceivedFuncNative.cs
index 914d6120f..07607540a 100644
--- a/gtk/generated/GtkSharp.ClipboardReceivedFuncNative.cs
+++ b/gtk/generated/GtkSharp.ClipboardReceivedFuncNative.cs
@@ -10,84 +10,22 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void ClipboardReceivedFuncNative(IntPtr clipboard, IntPtr selection_data, IntPtr data);
- internal class ClipboardReceivedFuncInvoker {
+ internal static class ClipboardReceivedFuncWrapper {
- ClipboardReceivedFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~ClipboardReceivedFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal ClipboardReceivedFuncInvoker (ClipboardReceivedFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal ClipboardReceivedFuncInvoker (ClipboardReceivedFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal ClipboardReceivedFuncInvoker (ClipboardReceivedFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.ClipboardReceivedFunc Handler {
- get {
- return new Gtk.ClipboardReceivedFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.Clipboard clipboard, Gtk.SelectionData selection_data)
- {
- Gtk.Application.AssertMainThread();
- native_cb (clipboard == null ? IntPtr.Zero : clipboard.Handle, selection_data == null ? IntPtr.Zero : selection_data.Handle, __data);
- }
- }
-
- internal class ClipboardReceivedFuncWrapper {
-
- public void NativeCallback (IntPtr clipboard, IntPtr selection_data, IntPtr data)
+ public static void NativeCallback (IntPtr clipboard, IntPtr selection_data, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.ClipboardReceivedFunc)gch.Target;
managed (GLib.Object.GetObject(clipboard) as Gtk.Clipboard, selection_data == IntPtr.Zero ? null : (Gtk.SelectionData) GLib.Opaque.GetOpaque (selection_data, typeof (Gtk.SelectionData), false));
- if (release_on_call)
gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal ClipboardReceivedFuncNative NativeDelegate;
- Gtk.ClipboardReceivedFunc managed;
-
- public ClipboardReceivedFuncWrapper (Gtk.ClipboardReceivedFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new ClipboardReceivedFuncNative (NativeCallback);
- }
-
- public static Gtk.ClipboardReceivedFunc GetManagedDelegate (ClipboardReceivedFuncNative native)
- {
- if (native == null)
- return null;
- ClipboardReceivedFuncWrapper wrapper = (ClipboardReceivedFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly ClipboardReceivedFuncNative NativeDelegate = new ClipboardReceivedFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.ClipboardTargetsReceivedFuncNative.cs b/gtk/generated/GtkSharp.ClipboardTargetsReceivedFuncNative.cs
index bd5bdcf82..f09fea3a0 100644
--- a/gtk/generated/GtkSharp.ClipboardTargetsReceivedFuncNative.cs
+++ b/gtk/generated/GtkSharp.ClipboardTargetsReceivedFuncNative.cs
@@ -10,84 +10,22 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void ClipboardTargetsReceivedFuncNative(IntPtr clipboard, IntPtr atoms, int n_atoms, IntPtr data);
- internal class ClipboardTargetsReceivedFuncInvoker {
+ internal static class ClipboardTargetsReceivedFuncWrapper {
- ClipboardTargetsReceivedFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~ClipboardTargetsReceivedFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal ClipboardTargetsReceivedFuncInvoker (ClipboardTargetsReceivedFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal ClipboardTargetsReceivedFuncInvoker (ClipboardTargetsReceivedFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal ClipboardTargetsReceivedFuncInvoker (ClipboardTargetsReceivedFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.ClipboardTargetsReceivedFunc Handler {
- get {
- return new Gtk.ClipboardTargetsReceivedFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.Clipboard clipboard, Gdk.Atom atoms, int n_atoms)
- {
- Gtk.Application.AssertMainThread();
- native_cb (clipboard == null ? IntPtr.Zero : clipboard.Handle, atoms == null ? IntPtr.Zero : atoms.Handle, n_atoms, __data);
- }
- }
-
- internal class ClipboardTargetsReceivedFuncWrapper {
-
- public void NativeCallback (IntPtr clipboard, IntPtr atoms, int n_atoms, IntPtr data)
+ public static void NativeCallback (IntPtr clipboard, IntPtr atoms, int n_atoms, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.ClipboardTargetsReceivedFunc)gch.Target;
managed (GLib.Object.GetObject(clipboard) as Gtk.Clipboard, atoms == IntPtr.Zero ? null : (Gdk.Atom) GLib.Opaque.GetOpaque (atoms, typeof (Gdk.Atom), false), n_atoms);
- if (release_on_call)
gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal ClipboardTargetsReceivedFuncNative NativeDelegate;
- Gtk.ClipboardTargetsReceivedFunc managed;
-
- public ClipboardTargetsReceivedFuncWrapper (Gtk.ClipboardTargetsReceivedFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new ClipboardTargetsReceivedFuncNative (NativeCallback);
- }
-
- public static Gtk.ClipboardTargetsReceivedFunc GetManagedDelegate (ClipboardTargetsReceivedFuncNative native)
- {
- if (native == null)
- return null;
- ClipboardTargetsReceivedFuncWrapper wrapper = (ClipboardTargetsReceivedFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly ClipboardTargetsReceivedFuncNative NativeDelegate = new ClipboardTargetsReceivedFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.ClipboardTextReceivedFuncNative.cs b/gtk/generated/GtkSharp.ClipboardTextReceivedFuncNative.cs
index ba4ad5f54..bc9b39e0f 100644
--- a/gtk/generated/GtkSharp.ClipboardTextReceivedFuncNative.cs
+++ b/gtk/generated/GtkSharp.ClipboardTextReceivedFuncNative.cs
@@ -10,86 +10,22 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void ClipboardTextReceivedFuncNative(IntPtr clipboard, IntPtr text, IntPtr data);
- internal class ClipboardTextReceivedFuncInvoker {
+ internal static class ClipboardTextReceivedFuncWrapper {
- ClipboardTextReceivedFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~ClipboardTextReceivedFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal ClipboardTextReceivedFuncInvoker (ClipboardTextReceivedFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal ClipboardTextReceivedFuncInvoker (ClipboardTextReceivedFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal ClipboardTextReceivedFuncInvoker (ClipboardTextReceivedFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.ClipboardTextReceivedFunc Handler {
- get {
- return new Gtk.ClipboardTextReceivedFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.Clipboard clipboard, string text)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_text = GLib.Marshaller.StringToPtrGStrdup (text);
- native_cb (clipboard == null ? IntPtr.Zero : clipboard.Handle, native_text, __data);
- GLib.Marshaller.Free (native_text);
- }
- }
-
- internal class ClipboardTextReceivedFuncWrapper {
-
- public void NativeCallback (IntPtr clipboard, IntPtr text, IntPtr data)
+ public static void NativeCallback (IntPtr clipboard, IntPtr text, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.ClipboardTextReceivedFunc)gch.Target;
managed (GLib.Object.GetObject(clipboard) as Gtk.Clipboard, GLib.Marshaller.Utf8PtrToString (text));
- if (release_on_call)
gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal ClipboardTextReceivedFuncNative NativeDelegate;
- Gtk.ClipboardTextReceivedFunc managed;
-
- public ClipboardTextReceivedFuncWrapper (Gtk.ClipboardTextReceivedFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new ClipboardTextReceivedFuncNative (NativeCallback);
- }
-
- public static Gtk.ClipboardTextReceivedFunc GetManagedDelegate (ClipboardTextReceivedFuncNative native)
- {
- if (native == null)
- return null;
- ClipboardTextReceivedFuncWrapper wrapper = (ClipboardTextReceivedFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly ClipboardTextReceivedFuncNative NativeDelegate = new ClipboardTextReceivedFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.ColorSelectionChangePaletteFuncNative.cs b/gtk/generated/GtkSharp.ColorSelectionChangePaletteFuncNative.cs
index eefe4e21a..18fd875a0 100644
--- a/gtk/generated/GtkSharp.ColorSelectionChangePaletteFuncNative.cs
+++ b/gtk/generated/GtkSharp.ColorSelectionChangePaletteFuncNative.cs
@@ -10,68 +10,19 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void ColorSelectionChangePaletteFuncNative(IntPtr colors, int n_colors);
- internal class ColorSelectionChangePaletteFuncInvoker {
-
- ColorSelectionChangePaletteFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~ColorSelectionChangePaletteFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal ColorSelectionChangePaletteFuncInvoker (ColorSelectionChangePaletteFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal ColorSelectionChangePaletteFuncInvoker (ColorSelectionChangePaletteFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal ColorSelectionChangePaletteFuncInvoker (ColorSelectionChangePaletteFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.ColorSelectionChangePaletteFunc Handler {
- get {
- return new Gtk.ColorSelectionChangePaletteFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gdk.Color colors, int n_colors)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_colors = GLib.Marshaller.StructureToPtrAlloc<Gdk.Color> (colors);
- native_cb (native_colors, n_colors);
- Marshal.FreeHGlobal (native_colors);
- }
- }
-
internal class ColorSelectionChangePaletteFuncWrapper {
public void NativeCallback (IntPtr colors, int n_colors)
{
try {
managed (Gdk.Color.New (colors), n_colors);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal ColorSelectionChangePaletteFuncNative NativeDelegate;
+ internal readonly ColorSelectionChangePaletteFuncNative NativeDelegate;
Gtk.ColorSelectionChangePaletteFunc managed;
public ColorSelectionChangePaletteFuncWrapper (Gtk.ColorSelectionChangePaletteFunc managed)
@@ -81,15 +32,6 @@ namespace GtkSharp {
NativeDelegate = new ColorSelectionChangePaletteFuncNative (NativeCallback);
}
- public static Gtk.ColorSelectionChangePaletteFunc GetManagedDelegate (ColorSelectionChangePaletteFuncNative native)
- {
- if (native == null)
- return null;
- ColorSelectionChangePaletteFuncWrapper wrapper = (ColorSelectionChangePaletteFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.ColorSelectionChangePaletteWithScreenFuncNative.cs b/gtk/generated/GtkSharp.ColorSelectionChangePaletteWithScreenFuncNative.cs
index 32c5652ee..d4bbe00d5 100644
--- a/gtk/generated/GtkSharp.ColorSelectionChangePaletteWithScreenFuncNative.cs
+++ b/gtk/generated/GtkSharp.ColorSelectionChangePaletteWithScreenFuncNative.cs
@@ -10,68 +10,19 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void ColorSelectionChangePaletteWithScreenFuncNative(IntPtr screen, IntPtr colors, int n_colors);
- internal class ColorSelectionChangePaletteWithScreenFuncInvoker {
-
- ColorSelectionChangePaletteWithScreenFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~ColorSelectionChangePaletteWithScreenFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal ColorSelectionChangePaletteWithScreenFuncInvoker (ColorSelectionChangePaletteWithScreenFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal ColorSelectionChangePaletteWithScreenFuncInvoker (ColorSelectionChangePaletteWithScreenFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal ColorSelectionChangePaletteWithScreenFuncInvoker (ColorSelectionChangePaletteWithScreenFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.ColorSelectionChangePaletteWithScreenFunc Handler {
- get {
- return new Gtk.ColorSelectionChangePaletteWithScreenFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gdk.Screen screen, Gdk.Color colors, int n_colors)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_colors = GLib.Marshaller.StructureToPtrAlloc<Gdk.Color> (colors);
- native_cb (screen == null ? IntPtr.Zero : screen.Handle, native_colors, n_colors);
- Marshal.FreeHGlobal (native_colors);
- }
- }
-
internal class ColorSelectionChangePaletteWithScreenFuncWrapper {
public void NativeCallback (IntPtr screen, IntPtr colors, int n_colors)
{
try {
managed (GLib.Object.GetObject(screen) as Gdk.Screen, Gdk.Color.New (colors), n_colors);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal ColorSelectionChangePaletteWithScreenFuncNative NativeDelegate;
+ internal readonly ColorSelectionChangePaletteWithScreenFuncNative NativeDelegate;
Gtk.ColorSelectionChangePaletteWithScreenFunc managed;
public ColorSelectionChangePaletteWithScreenFuncWrapper (Gtk.ColorSelectionChangePaletteWithScreenFunc managed)
@@ -81,15 +32,6 @@ namespace GtkSharp {
NativeDelegate = new ColorSelectionChangePaletteWithScreenFuncNative (NativeCallback);
}
- public static Gtk.ColorSelectionChangePaletteWithScreenFunc GetManagedDelegate (ColorSelectionChangePaletteWithScreenFuncNative native)
- {
- if (native == null)
- return null;
- ColorSelectionChangePaletteWithScreenFuncWrapper wrapper = (ColorSelectionChangePaletteWithScreenFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.DestroyNotifyNative.cs b/gtk/generated/GtkSharp.DestroyNotifyNative.cs
index e8b611030..ebf27f9d4 100644
--- a/gtk/generated/GtkSharp.DestroyNotifyNative.cs
+++ b/gtk/generated/GtkSharp.DestroyNotifyNative.cs
@@ -10,84 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void DestroyNotifyNative(IntPtr data);
- internal class DestroyNotifyInvoker {
+ internal static class DestroyNotifyWrapper {
- DestroyNotifyNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~DestroyNotifyInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal DestroyNotifyInvoker (DestroyNotifyNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal DestroyNotifyInvoker (DestroyNotifyNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal DestroyNotifyInvoker (DestroyNotifyNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.DestroyNotify Handler {
- get {
- return new Gtk.DestroyNotify(InvokeNative);
- }
- }
-
- void InvokeNative ()
- {
- Gtk.Application.AssertMainThread();
- native_cb (__data);
- }
- }
-
- internal class DestroyNotifyWrapper {
-
- public void NativeCallback (IntPtr data)
+ public static void NativeCallback (IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.DestroyNotify)gch.Target;
managed ();
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal DestroyNotifyNative NativeDelegate;
- Gtk.DestroyNotify managed;
-
- public DestroyNotifyWrapper (Gtk.DestroyNotify managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new DestroyNotifyNative (NativeCallback);
- }
-
- public static Gtk.DestroyNotify GetManagedDelegate (DestroyNotifyNative native)
- {
- if (native == null)
- return null;
- DestroyNotifyWrapper wrapper = (DestroyNotifyWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly DestroyNotifyNative NativeDelegate = new DestroyNotifyNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.EntryCompletionMatchFuncNative.cs b/gtk/generated/GtkSharp.EntryCompletionMatchFuncNative.cs
index 56e6568df..e4d4f4c72 100644
--- a/gtk/generated/GtkSharp.EntryCompletionMatchFuncNative.cs
+++ b/gtk/generated/GtkSharp.EntryCompletionMatchFuncNative.cs
@@ -10,56 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool EntryCompletionMatchFuncNative(IntPtr completion, IntPtr key, IntPtr iter, IntPtr user_data);
- internal class EntryCompletionMatchFuncInvoker {
+ internal static class EntryCompletionMatchFuncWrapper {
- EntryCompletionMatchFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~EntryCompletionMatchFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal EntryCompletionMatchFuncInvoker (EntryCompletionMatchFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal EntryCompletionMatchFuncInvoker (EntryCompletionMatchFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal EntryCompletionMatchFuncInvoker (EntryCompletionMatchFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.EntryCompletionMatchFunc Handler {
- get {
- return new Gtk.EntryCompletionMatchFunc(InvokeNative);
- }
- }
-
- bool InvokeNative (Gtk.EntryCompletion completion, string key, Gtk.TreeIter iter)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
- IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc<Gtk.TreeIter> (iter);
- bool result = native_cb (completion == null ? IntPtr.Zero : completion.Handle, native_key, native_iter, __data);
- GLib.Marshaller.Free (native_key);
- Marshal.FreeHGlobal (native_iter);
- return result;
- }
- }
-
- internal class EntryCompletionMatchFuncWrapper {
-
- public bool NativeCallback (IntPtr completion, IntPtr key, IntPtr iter, IntPtr user_data)
+ public static bool NativeCallback (IntPtr completion, IntPtr key, IntPtr iter, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.EntryCompletionMatchFunc)gch.Target;
bool __ret = managed (GLib.Object.GetObject(completion) as Gtk.EntryCompletion, GLib.Marshaller.Utf8PtrToString (key), Gtk.TreeIter.New (iter));
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -67,34 +25,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal EntryCompletionMatchFuncNative NativeDelegate;
- Gtk.EntryCompletionMatchFunc managed;
-
- public EntryCompletionMatchFuncWrapper (Gtk.EntryCompletionMatchFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new EntryCompletionMatchFuncNative (NativeCallback);
- }
-
- public static Gtk.EntryCompletionMatchFunc GetManagedDelegate (EntryCompletionMatchFuncNative native)
- {
- if (native == null)
- return null;
- EntryCompletionMatchFuncWrapper wrapper = (EntryCompletionMatchFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly EntryCompletionMatchFuncNative NativeDelegate = new EntryCompletionMatchFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.FileFilterFuncNative.cs b/gtk/generated/GtkSharp.FileFilterFuncNative.cs
index 6166866f8..6c8d463e9 100644
--- a/gtk/generated/GtkSharp.FileFilterFuncNative.cs
+++ b/gtk/generated/GtkSharp.FileFilterFuncNative.cs
@@ -10,54 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool FileFilterFuncNative(IntPtr filter_info, IntPtr data);
- internal class FileFilterFuncInvoker {
+ internal static class FileFilterFuncWrapper {
- FileFilterFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~FileFilterFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal FileFilterFuncInvoker (FileFilterFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal FileFilterFuncInvoker (FileFilterFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal FileFilterFuncInvoker (FileFilterFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.FileFilterFunc Handler {
- get {
- return new Gtk.FileFilterFunc(InvokeNative);
- }
- }
-
- bool InvokeNative (Gtk.FileFilterInfo filter_info)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_filter_info = GLib.Marshaller.StructureToPtrAlloc<Gtk.FileFilterInfo> (filter_info);
- bool result = native_cb (native_filter_info, __data);
- Marshal.FreeHGlobal (native_filter_info);
- return result;
- }
- }
-
- internal class FileFilterFuncWrapper {
-
- public bool NativeCallback (IntPtr filter_info, IntPtr data)
+ public static bool NativeCallback (IntPtr filter_info, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.FileFilterFunc)gch.Target;
bool __ret = managed (Gtk.FileFilterInfo.New (filter_info));
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -65,34 +25,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal FileFilterFuncNative NativeDelegate;
- Gtk.FileFilterFunc managed;
-
- public FileFilterFuncWrapper (Gtk.FileFilterFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new FileFilterFuncNative (NativeCallback);
- }
-
- public static Gtk.FileFilterFunc GetManagedDelegate (FileFilterFuncNative native)
- {
- if (native == null)
- return null;
- FileFilterFuncWrapper wrapper = (FileFilterFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly FileFilterFuncNative NativeDelegate = new FileFilterFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.FunctionNative.cs b/gtk/generated/GtkSharp.FunctionNative.cs
index e07edbd66..aa04f2a9a 100644
--- a/gtk/generated/GtkSharp.FunctionNative.cs
+++ b/gtk/generated/GtkSharp.FunctionNative.cs
@@ -10,52 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool FunctionNative(IntPtr data);
- internal class FunctionInvoker {
+ internal static class FunctionWrapper {
- FunctionNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~FunctionInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal FunctionInvoker (FunctionNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal FunctionInvoker (FunctionNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal FunctionInvoker (FunctionNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.Function Handler {
- get {
- return new Gtk.Function(InvokeNative);
- }
- }
-
- bool InvokeNative ()
- {
- Gtk.Application.AssertMainThread();
- bool result = native_cb (__data);
- return result;
- }
- }
-
- internal class FunctionWrapper {
-
- public bool NativeCallback (IntPtr data)
+ public static bool NativeCallback (IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.Function)gch.Target;
bool __ret = managed ();
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -63,34 +25,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal FunctionNative NativeDelegate;
- Gtk.Function managed;
-
- public FunctionWrapper (Gtk.Function managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new FunctionNative (NativeCallback);
- }
-
- public static Gtk.Function GetManagedDelegate (FunctionNative native)
- {
- if (native == null)
- return null;
- FunctionWrapper wrapper = (FunctionWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly FunctionNative NativeDelegate = new FunctionNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.IconViewForeachFuncNative.cs b/gtk/generated/GtkSharp.IconViewForeachFuncNative.cs
index edf8c469e..e25f4e81b 100644
--- a/gtk/generated/GtkSharp.IconViewForeachFuncNative.cs
+++ b/gtk/generated/GtkSharp.IconViewForeachFuncNative.cs
@@ -10,84 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void IconViewForeachFuncNative(IntPtr icon_view, IntPtr path, IntPtr data);
- internal class IconViewForeachFuncInvoker {
+ internal static class IconViewForeachFuncWrapper {
- IconViewForeachFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~IconViewForeachFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal IconViewForeachFuncInvoker (IconViewForeachFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal IconViewForeachFuncInvoker (IconViewForeachFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal IconViewForeachFuncInvoker (IconViewForeachFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.IconViewForeachFunc Handler {
- get {
- return new Gtk.IconViewForeachFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.IconView icon_view, Gtk.TreePath path)
- {
- Gtk.Application.AssertMainThread();
- native_cb (icon_view == null ? IntPtr.Zero : icon_view.Handle, path == null ? IntPtr.Zero : path.Handle, __data);
- }
- }
-
- internal class IconViewForeachFuncWrapper {
-
- public void NativeCallback (IntPtr icon_view, IntPtr path, IntPtr data)
+ public static void NativeCallback (IntPtr icon_view, IntPtr path, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.IconViewForeachFunc)gch.Target;
managed (GLib.Object.GetObject(icon_view) as Gtk.IconView, path == IntPtr.Zero ? null : (Gtk.TreePath) GLib.Opaque.GetOpaque (path, typeof (Gtk.TreePath), false));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal IconViewForeachFuncNative NativeDelegate;
- Gtk.IconViewForeachFunc managed;
-
- public IconViewForeachFuncWrapper (Gtk.IconViewForeachFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new IconViewForeachFuncNative (NativeCallback);
- }
-
- public static Gtk.IconViewForeachFunc GetManagedDelegate (IconViewForeachFuncNative native)
- {
- if (native == null)
- return null;
- IconViewForeachFuncWrapper wrapper = (IconViewForeachFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly IconViewForeachFuncNative NativeDelegate = new IconViewForeachFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.ItemFactoryCallback1Native.cs b/gtk/generated/GtkSharp.ItemFactoryCallback1Native.cs
index 5b9de8246..bcca2ac43 100644
--- a/gtk/generated/GtkSharp.ItemFactoryCallback1Native.cs
+++ b/gtk/generated/GtkSharp.ItemFactoryCallback1Native.cs
@@ -10,84 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void ItemFactoryCallback1Native(IntPtr callback_data, uint callback_action, IntPtr widget);
- internal class ItemFactoryCallback1Invoker {
+ internal static class ItemFactoryCallback1Wrapper {
- ItemFactoryCallback1Native native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~ItemFactoryCallback1Invoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal ItemFactoryCallback1Invoker (ItemFactoryCallback1Native native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal ItemFactoryCallback1Invoker (ItemFactoryCallback1Native native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal ItemFactoryCallback1Invoker (ItemFactoryCallback1Native native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.ItemFactoryCallback1 Handler {
- get {
- return new Gtk.ItemFactoryCallback1(InvokeNative);
- }
- }
-
- void InvokeNative (IntPtr callback_data, uint callback_action, Gtk.Widget widget)
- {
- Gtk.Application.AssertMainThread();
- native_cb (__data, callback_action, widget == null ? IntPtr.Zero : widget.Handle);
- }
- }
-
- internal class ItemFactoryCallback1Wrapper {
-
- public void NativeCallback (IntPtr callback_data, uint callback_action, IntPtr widget)
+ public static void NativeCallback (IntPtr callback_data, uint callback_action, IntPtr widget)
{
try {
+ var gch = (GCHandle)callback_data;
+ var managed = (Gtk.ItemFactoryCallback1)gch.Target;
managed (callback_data, callback_action, GLib.Object.GetObject(widget) as Gtk.Widget);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal ItemFactoryCallback1Native NativeDelegate;
- Gtk.ItemFactoryCallback1 managed;
-
- public ItemFactoryCallback1Wrapper (Gtk.ItemFactoryCallback1 managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new ItemFactoryCallback1Native (NativeCallback);
- }
-
- public static Gtk.ItemFactoryCallback1 GetManagedDelegate (ItemFactoryCallback1Native native)
- {
- if (native == null)
- return null;
- ItemFactoryCallback1Wrapper wrapper = (ItemFactoryCallback1Wrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly ItemFactoryCallback1Native NativeDelegate = new ItemFactoryCallback1Native (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.ItemFactoryCallbackNative.cs b/gtk/generated/GtkSharp.ItemFactoryCallbackNative.cs
index 8c199cef2..6af0329f2 100644
--- a/gtk/generated/GtkSharp.ItemFactoryCallbackNative.cs
+++ b/gtk/generated/GtkSharp.ItemFactoryCallbackNative.cs
@@ -52,23 +52,13 @@ namespace GtkSharp {
{
try {
managed ();
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal ItemFactoryCallbackNative NativeDelegate;
+ internal readonly ItemFactoryCallbackNative NativeDelegate;
Gtk.ItemFactoryCallback managed;
public ItemFactoryCallbackWrapper (Gtk.ItemFactoryCallback managed)
@@ -78,15 +68,6 @@ namespace GtkSharp {
NativeDelegate = new ItemFactoryCallbackNative (NativeCallback);
}
- public static Gtk.ItemFactoryCallback GetManagedDelegate (ItemFactoryCallbackNative native)
- {
- if (native == null)
- return null;
- ItemFactoryCallbackWrapper wrapper = (ItemFactoryCallbackWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.KeySnoopFuncNative.cs b/gtk/generated/GtkSharp.KeySnoopFuncNative.cs
index 79eba2253..831ec8aee 100644
--- a/gtk/generated/GtkSharp.KeySnoopFuncNative.cs
+++ b/gtk/generated/GtkSharp.KeySnoopFuncNative.cs
@@ -10,52 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate int KeySnoopFuncNative(IntPtr grab_widget, IntPtr evnt, IntPtr func_data);
- internal class KeySnoopFuncInvoker {
+ internal static class KeySnoopFuncWrapper {
- KeySnoopFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~KeySnoopFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal KeySnoopFuncInvoker (KeySnoopFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal KeySnoopFuncInvoker (KeySnoopFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal KeySnoopFuncInvoker (KeySnoopFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.KeySnoopFunc Handler {
- get {
- return new Gtk.KeySnoopFunc(InvokeNative);
- }
- }
-
- int InvokeNative (Gtk.Widget grab_widget, Gdk.EventKey evnt)
- {
- Gtk.Application.AssertMainThread();
- int result = native_cb (grab_widget == null ? IntPtr.Zero : grab_widget.Handle, evnt == null ? IntPtr.Zero : evnt.Handle, __data);
- return result;
- }
- }
-
- internal class KeySnoopFuncWrapper {
-
- public int NativeCallback (IntPtr grab_widget, IntPtr evnt, IntPtr func_data)
+ public static int NativeCallback (IntPtr grab_widget, IntPtr evnt, IntPtr func_data)
{
try {
+ var gch = (GCHandle)func_data;
+ var managed = (Gtk.KeySnoopFunc)gch.Target;
int __ret = managed (GLib.Object.GetObject(grab_widget) as Gtk.Widget, new Gdk.EventKey(evnt));
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
@@ -64,34 +26,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal KeySnoopFuncNative NativeDelegate;
- Gtk.KeySnoopFunc managed;
-
- public KeySnoopFuncWrapper (Gtk.KeySnoopFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new KeySnoopFuncNative (NativeCallback);
- }
-
- public static Gtk.KeySnoopFunc GetManagedDelegate (KeySnoopFuncNative native)
- {
- if (native == null)
- return null;
- KeySnoopFuncWrapper wrapper = (KeySnoopFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly KeySnoopFuncNative NativeDelegate = new KeySnoopFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.LinkButtonUriFuncNative.cs b/gtk/generated/GtkSharp.LinkButtonUriFuncNative.cs
index 351a77939..02a1102bf 100644
--- a/gtk/generated/GtkSharp.LinkButtonUriFuncNative.cs
+++ b/gtk/generated/GtkSharp.LinkButtonUriFuncNative.cs
@@ -49,47 +49,21 @@ namespace GtkSharp {
}
}
- internal class LinkButtonUriFuncWrapper {
+ internal static class LinkButtonUriFuncWrapper {
- public void NativeCallback (IntPtr button, IntPtr link_, IntPtr user_data)
+ public static void NativeCallback (IntPtr button, IntPtr link_, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.LinkButtonUriFunc)gch.Target;
managed (GLib.Object.GetObject(button) as Gtk.LinkButton, GLib.Marshaller.Utf8PtrToString (link_));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal LinkButtonUriFuncNative NativeDelegate;
- Gtk.LinkButtonUriFunc managed;
-
- public LinkButtonUriFuncWrapper (Gtk.LinkButtonUriFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new LinkButtonUriFuncNative (NativeCallback);
- }
-
- public static Gtk.LinkButtonUriFunc GetManagedDelegate (LinkButtonUriFuncNative native)
- {
- if (native == null)
- return null;
- LinkButtonUriFuncWrapper wrapper = (LinkButtonUriFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly LinkButtonUriFuncNative NativeDelegate = new LinkButtonUriFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.MenuCallbackNative.cs b/gtk/generated/GtkSharp.MenuCallbackNative.cs
index ef0354c9b..ec33473bf 100644
--- a/gtk/generated/GtkSharp.MenuCallbackNative.cs
+++ b/gtk/generated/GtkSharp.MenuCallbackNative.cs
@@ -47,47 +47,21 @@ namespace GtkSharp {
}
}
- internal class MenuCallbackWrapper {
+ internal static class MenuCallbackWrapper {
- public void NativeCallback (IntPtr widget, IntPtr user_data)
+ public static void NativeCallback (IntPtr widget, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.MenuCallback)gch.Target;
managed (GLib.Object.GetObject(widget) as Gtk.Widget);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal MenuCallbackNative NativeDelegate;
- Gtk.MenuCallback managed;
-
- public MenuCallbackWrapper (Gtk.MenuCallback managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new MenuCallbackNative (NativeCallback);
- }
-
- public static Gtk.MenuCallback GetManagedDelegate (MenuCallbackNative native)
- {
- if (native == null)
- return null;
- MenuCallbackWrapper wrapper = (MenuCallbackWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly MenuCallbackNative NativeDelegate = new MenuCallbackNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.MenuDetachFuncNative.cs b/gtk/generated/GtkSharp.MenuDetachFuncNative.cs
index ad48e3b65..50605d616 100644
--- a/gtk/generated/GtkSharp.MenuDetachFuncNative.cs
+++ b/gtk/generated/GtkSharp.MenuDetachFuncNative.cs
@@ -10,50 +10,12 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void MenuDetachFuncNative(IntPtr attach_widget, IntPtr menu);
- internal class MenuDetachFuncInvoker {
-
- MenuDetachFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~MenuDetachFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal MenuDetachFuncInvoker (MenuDetachFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal MenuDetachFuncInvoker (MenuDetachFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal MenuDetachFuncInvoker (MenuDetachFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.MenuDetachFunc Handler {
- get {
- return new Gtk.MenuDetachFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.Widget attach_widget, Gtk.Menu menu)
- {
- Gtk.Application.AssertMainThread();
- native_cb (attach_widget == null ? IntPtr.Zero : attach_widget.Handle, menu == null ? IntPtr.Zero : menu.Handle);
- }
- }
-
internal class MenuDetachFuncWrapper {
public void NativeCallback (IntPtr attach_widget, IntPtr menu)
{
try {
managed (GLib.Object.GetObject(attach_widget) as Gtk.Widget, GLib.Object.GetObject(menu) as Gtk.Menu);
- if (release_on_call)
gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -69,7 +31,7 @@ namespace GtkSharp {
gch = GCHandle.Alloc (this);
}
- internal MenuDetachFuncNative NativeDelegate;
+ internal readonly MenuDetachFuncNative NativeDelegate;
Gtk.MenuDetachFunc managed;
public MenuDetachFuncWrapper (Gtk.MenuDetachFunc managed)
@@ -79,15 +41,6 @@ namespace GtkSharp {
NativeDelegate = new MenuDetachFuncNative (NativeCallback);
}
- public static Gtk.MenuDetachFunc GetManagedDelegate (MenuDetachFuncNative native)
- {
- if (native == null)
- return null;
- MenuDetachFuncWrapper wrapper = (MenuDetachFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.MenuPositionFuncNative.cs b/gtk/generated/GtkSharp.MenuPositionFuncNative.cs
index d8754dac4..92bcc0979 100644
--- a/gtk/generated/GtkSharp.MenuPositionFuncNative.cs
+++ b/gtk/generated/GtkSharp.MenuPositionFuncNative.cs
@@ -10,50 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void MenuPositionFuncNative(IntPtr menu, out int x, out int y, out bool push_in, IntPtr user_data);
- internal class MenuPositionFuncInvoker {
+ internal static class MenuPositionFuncWrapper {
- MenuPositionFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~MenuPositionFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal MenuPositionFuncInvoker (MenuPositionFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal MenuPositionFuncInvoker (MenuPositionFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal MenuPositionFuncInvoker (MenuPositionFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.MenuPositionFunc Handler {
- get {
- return new Gtk.MenuPositionFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.Menu menu, out int x, out int y, out bool push_in)
- {
- Gtk.Application.AssertMainThread();
- native_cb (menu == null ? IntPtr.Zero : menu.Handle, out x, out y, out push_in, __data);
- }
- }
-
- internal class MenuPositionFuncWrapper {
-
- public void NativeCallback (IntPtr menu, out int x, out int y, out bool push_in, IntPtr user_data)
+ public static void NativeCallback (IntPtr menu, out int x, out int y, out bool push_in, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.MenuPositionFunc)gch.Target;
managed (GLib.Object.GetObject(menu) as Gtk.Menu, out x, out y, out push_in);
- if (release_on_call)
gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
@@ -62,34 +26,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal MenuPositionFuncNative NativeDelegate;
- Gtk.MenuPositionFunc managed;
-
- public MenuPositionFuncWrapper (Gtk.MenuPositionFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new MenuPositionFuncNative (NativeCallback);
- }
-
- public static Gtk.MenuPositionFunc GetManagedDelegate (MenuPositionFuncNative native)
- {
- if (native == null)
- return null;
- MenuPositionFuncWrapper wrapper = (MenuPositionFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly MenuPositionFuncNative NativeDelegate = new MenuPositionFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.MnemonicHashForeachNative.cs b/gtk/generated/GtkSharp.MnemonicHashForeachNative.cs
index ad9bcc170..e9691b28b 100644
--- a/gtk/generated/GtkSharp.MnemonicHashForeachNative.cs
+++ b/gtk/generated/GtkSharp.MnemonicHashForeachNative.cs
@@ -10,84 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void MnemonicHashForeachNative(uint keyval, IntPtr targets, IntPtr data);
- internal class MnemonicHashForeachInvoker {
+ internal static class MnemonicHashForeachWrapper {
- MnemonicHashForeachNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~MnemonicHashForeachInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal MnemonicHashForeachInvoker (MnemonicHashForeachNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal MnemonicHashForeachInvoker (MnemonicHashForeachNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal MnemonicHashForeachInvoker (MnemonicHashForeachNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.MnemonicHashForeach Handler {
- get {
- return new Gtk.MnemonicHashForeach(InvokeNative);
- }
- }
-
- void InvokeNative (uint keyval, GLib.SList targets)
- {
- Gtk.Application.AssertMainThread();
- native_cb (keyval, targets == null ? IntPtr.Zero : targets.Handle, __data);
- }
- }
-
- internal class MnemonicHashForeachWrapper {
-
- public void NativeCallback (uint keyval, IntPtr targets, IntPtr data)
+ public static void NativeCallback (uint keyval, IntPtr targets, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.MnemonicHashForeach)gch.Target;
managed (keyval, new GLib.SList(targets));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal MnemonicHashForeachNative NativeDelegate;
- Gtk.MnemonicHashForeach managed;
-
- public MnemonicHashForeachWrapper (Gtk.MnemonicHashForeach managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new MnemonicHashForeachNative (NativeCallback);
- }
-
- public static Gtk.MnemonicHashForeach GetManagedDelegate (MnemonicHashForeachNative native)
- {
- if (native == null)
- return null;
- MnemonicHashForeachWrapper wrapper = (MnemonicHashForeachWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly MnemonicHashForeachNative NativeDelegate = new MnemonicHashForeachNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.NotebookWindowCreationFuncNative.cs b/gtk/generated/GtkSharp.NotebookWindowCreationFuncNative.cs
index f5f3951c0..564550aee 100644
--- a/gtk/generated/GtkSharp.NotebookWindowCreationFuncNative.cs
+++ b/gtk/generated/GtkSharp.NotebookWindowCreationFuncNative.cs
@@ -10,52 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate IntPtr NotebookWindowCreationFuncNative(IntPtr source, IntPtr page, int x, int y, IntPtr data);
- internal class NotebookWindowCreationFuncInvoker {
+ internal static class NotebookWindowCreationFuncWrapper {
- NotebookWindowCreationFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~NotebookWindowCreationFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal NotebookWindowCreationFuncInvoker (NotebookWindowCreationFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal NotebookWindowCreationFuncInvoker (NotebookWindowCreationFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal NotebookWindowCreationFuncInvoker (NotebookWindowCreationFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.NotebookWindowCreationFunc Handler {
- get {
- return new Gtk.NotebookWindowCreationFunc(InvokeNative);
- }
- }
-
- Gtk.Notebook InvokeNative (Gtk.Notebook source, Gtk.Widget page, int x, int y)
- {
- Gtk.Application.AssertMainThread();
- Gtk.Notebook result = GLib.Object.GetObject(native_cb (source == null ? IntPtr.Zero : source.Handle, page == null ? IntPtr.Zero : page.Handle, x, y, __data)) as Gtk.Notebook;
- return result;
- }
- }
-
- internal class NotebookWindowCreationFuncWrapper {
-
- public IntPtr NativeCallback (IntPtr source, IntPtr page, int x, int y, IntPtr data)
+ public static IntPtr NativeCallback (IntPtr source, IntPtr page, int x, int y, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.NotebookWindowCreationFunc)gch.Target;
Gtk.Notebook __ret = managed (GLib.Object.GetObject(source) as Gtk.Notebook, GLib.Object.GetObject(page) as Gtk.Widget, x, y);
- if (release_on_call)
- gch.Free ();
return __ret == null ? IntPtr.Zero : __ret.Handle;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
@@ -64,34 +26,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal NotebookWindowCreationFuncNative NativeDelegate;
- Gtk.NotebookWindowCreationFunc managed;
-
- public NotebookWindowCreationFuncWrapper (Gtk.NotebookWindowCreationFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new NotebookWindowCreationFuncNative (NativeCallback);
- }
-
- public static Gtk.NotebookWindowCreationFunc GetManagedDelegate (NotebookWindowCreationFuncNative native)
- {
- if (native == null)
- return null;
- NotebookWindowCreationFuncWrapper wrapper = (NotebookWindowCreationFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly NotebookWindowCreationFuncNative NativeDelegate = new NotebookWindowCreationFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.PageSetupDoneFuncNative.cs b/gtk/generated/GtkSharp.PageSetupDoneFuncNative.cs
index cfa600504..596d5342a 100644
--- a/gtk/generated/GtkSharp.PageSetupDoneFuncNative.cs
+++ b/gtk/generated/GtkSharp.PageSetupDoneFuncNative.cs
@@ -10,84 +10,22 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void PageSetupDoneFuncNative(IntPtr page_setup, IntPtr data);
- internal class PageSetupDoneFuncInvoker {
+ internal static class PageSetupDoneFuncWrapper {
- PageSetupDoneFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~PageSetupDoneFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal PageSetupDoneFuncInvoker (PageSetupDoneFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal PageSetupDoneFuncInvoker (PageSetupDoneFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal PageSetupDoneFuncInvoker (PageSetupDoneFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.PageSetupDoneFunc Handler {
- get {
- return new Gtk.PageSetupDoneFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.PageSetup page_setup)
- {
- Gtk.Application.AssertMainThread();
- native_cb (page_setup == null ? IntPtr.Zero : page_setup.Handle, __data);
- }
- }
-
- internal class PageSetupDoneFuncWrapper {
-
- public void NativeCallback (IntPtr page_setup, IntPtr data)
+ public static void NativeCallback (IntPtr page_setup, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.PageSetupDoneFunc)gch.Target;
managed (GLib.Object.GetObject(page_setup) as Gtk.PageSetup);
- if (release_on_call)
gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal PageSetupDoneFuncNative NativeDelegate;
- Gtk.PageSetupDoneFunc managed;
-
- public PageSetupDoneFuncWrapper (Gtk.PageSetupDoneFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new PageSetupDoneFuncNative (NativeCallback);
- }
-
- public static Gtk.PageSetupDoneFunc GetManagedDelegate (PageSetupDoneFuncNative native)
- {
- if (native == null)
- return null;
- PageSetupDoneFuncWrapper wrapper = (PageSetupDoneFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly PageSetupDoneFuncNative NativeDelegate = new PageSetupDoneFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.PrintFuncNative.cs b/gtk/generated/GtkSharp.PrintFuncNative.cs
index 220deaf4f..40d17d1d1 100644
--- a/gtk/generated/GtkSharp.PrintFuncNative.cs
+++ b/gtk/generated/GtkSharp.PrintFuncNative.cs
@@ -10,86 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void PrintFuncNative(IntPtr func_data, IntPtr str);
- internal class PrintFuncInvoker {
+ internal static class PrintFuncWrapper {
- PrintFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~PrintFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal PrintFuncInvoker (PrintFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal PrintFuncInvoker (PrintFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal PrintFuncInvoker (PrintFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.PrintFunc Handler {
- get {
- return new Gtk.PrintFunc(InvokeNative);
- }
- }
-
- void InvokeNative (IntPtr func_data, string str)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_str = GLib.Marshaller.StringToPtrGStrdup (str);
- native_cb (__data, native_str);
- GLib.Marshaller.Free (native_str);
- }
- }
-
- internal class PrintFuncWrapper {
-
- public void NativeCallback (IntPtr func_data, IntPtr str)
+ public static void NativeCallback (IntPtr func_data, IntPtr str)
{
try {
+ var gch = (GCHandle)func_data;
+ var managed = (Gtk.PrintFunc)gch.Target;
managed (func_data, GLib.Marshaller.Utf8PtrToString (str));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal PrintFuncNative NativeDelegate;
- Gtk.PrintFunc managed;
-
- public PrintFuncWrapper (Gtk.PrintFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new PrintFuncNative (NativeCallback);
- }
-
- public static Gtk.PrintFunc GetManagedDelegate (PrintFuncNative native)
- {
- if (native == null)
- return null;
- PrintFuncWrapper wrapper = (PrintFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly PrintFuncNative NativeDelegate = new PrintFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.PrintJobCompleteFuncNative.cs b/gtk/generated/GtkSharp.PrintJobCompleteFuncNative.cs
index 87e1f8c09..c26689548 100644
--- a/gtk/generated/GtkSharp.PrintJobCompleteFuncNative.cs
+++ b/gtk/generated/GtkSharp.PrintJobCompleteFuncNative.cs
@@ -10,84 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void PrintJobCompleteFuncNative(IntPtr print_job, IntPtr user_data, IntPtr error);
- internal class PrintJobCompleteFuncInvoker {
+ internal static class PrintJobCompleteFuncWrapper {
- PrintJobCompleteFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~PrintJobCompleteFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal PrintJobCompleteFuncInvoker (PrintJobCompleteFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal PrintJobCompleteFuncInvoker (PrintJobCompleteFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal PrintJobCompleteFuncInvoker (PrintJobCompleteFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.PrintJobCompleteFunc Handler {
- get {
- return new Gtk.PrintJobCompleteFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.PrintJob print_job, IntPtr user_data, IntPtr error)
- {
- Gtk.Application.AssertMainThread();
- native_cb (print_job == null ? IntPtr.Zero : print_job.Handle, __data, error);
- }
- }
-
- internal class PrintJobCompleteFuncWrapper {
-
- public void NativeCallback (IntPtr print_job, IntPtr user_data, IntPtr error)
+ public static void NativeCallback (IntPtr print_job, IntPtr user_data, IntPtr error)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.PrintJobCompleteFunc)gch.Target;
managed (GLib.Object.GetObject(print_job) as Gtk.PrintJob, user_data, error);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal PrintJobCompleteFuncNative NativeDelegate;
- Gtk.PrintJobCompleteFunc managed;
-
- public PrintJobCompleteFuncWrapper (Gtk.PrintJobCompleteFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new PrintJobCompleteFuncNative (NativeCallback);
- }
-
- public static Gtk.PrintJobCompleteFunc GetManagedDelegate (PrintJobCompleteFuncNative native)
- {
- if (native == null)
- return null;
- PrintJobCompleteFuncWrapper wrapper = (PrintJobCompleteFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly PrintJobCompleteFuncNative NativeDelegate = new PrintJobCompleteFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.PrintSettingsFuncNative.cs b/gtk/generated/GtkSharp.PrintSettingsFuncNative.cs
index 73d87857e..0c44f1e46 100644
--- a/gtk/generated/GtkSharp.PrintSettingsFuncNative.cs
+++ b/gtk/generated/GtkSharp.PrintSettingsFuncNative.cs
@@ -10,88 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void PrintSettingsFuncNative(IntPtr key, IntPtr value, IntPtr user_data);
- internal class PrintSettingsFuncInvoker {
+ internal static class PrintSettingsFuncWrapper {
- PrintSettingsFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~PrintSettingsFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal PrintSettingsFuncInvoker (PrintSettingsFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal PrintSettingsFuncInvoker (PrintSettingsFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal PrintSettingsFuncInvoker (PrintSettingsFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.PrintSettingsFunc Handler {
- get {
- return new Gtk.PrintSettingsFunc(InvokeNative);
- }
- }
-
- void InvokeNative (string key, string value)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
- IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
- native_cb (native_key, native_value, __data);
- GLib.Marshaller.Free (native_key);
- GLib.Marshaller.Free (native_value);
- }
- }
-
- internal class PrintSettingsFuncWrapper {
-
- public void NativeCallback (IntPtr key, IntPtr value, IntPtr user_data)
+ public static void NativeCallback (IntPtr key, IntPtr value, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.PrintSettingsFunc)gch.Target;
managed (GLib.Marshaller.Utf8PtrToString (key), GLib.Marshaller.Utf8PtrToString (value));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal PrintSettingsFuncNative NativeDelegate;
- Gtk.PrintSettingsFunc managed;
-
- public PrintSettingsFuncWrapper (Gtk.PrintSettingsFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new PrintSettingsFuncNative (NativeCallback);
- }
-
- public static Gtk.PrintSettingsFunc GetManagedDelegate (PrintSettingsFuncNative native)
- {
- if (native == null)
- return null;
- PrintSettingsFuncWrapper wrapper = (PrintSettingsFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly PrintSettingsFuncNative NativeDelegate = new PrintSettingsFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.PrinterFuncNative.cs b/gtk/generated/GtkSharp.PrinterFuncNative.cs
index 3d73f48cf..9fcef5f98 100644
--- a/gtk/generated/GtkSharp.PrinterFuncNative.cs
+++ b/gtk/generated/GtkSharp.PrinterFuncNative.cs
@@ -10,52 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool PrinterFuncNative(IntPtr printer, IntPtr data);
- internal class PrinterFuncInvoker {
+ internal static class PrinterFuncWrapper {
- PrinterFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~PrinterFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal PrinterFuncInvoker (PrinterFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal PrinterFuncInvoker (PrinterFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal PrinterFuncInvoker (PrinterFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.PrinterFunc Handler {
- get {
- return new Gtk.PrinterFunc(InvokeNative);
- }
- }
-
- bool InvokeNative (Gtk.Printer printer)
- {
- Gtk.Application.AssertMainThread();
- bool result = native_cb (printer == null ? IntPtr.Zero : printer.Handle, __data);
- return result;
- }
- }
-
- internal class PrinterFuncWrapper {
-
- public bool NativeCallback (IntPtr printer, IntPtr data)
+ public static bool NativeCallback (IntPtr printer, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.PrinterFunc)gch.Target;
bool __ret = managed (GLib.Object.GetObject(printer) as Gtk.Printer);
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -63,34 +25,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal PrinterFuncNative NativeDelegate;
- Gtk.PrinterFunc managed;
-
- public PrinterFuncWrapper (Gtk.PrinterFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new PrinterFuncNative (NativeCallback);
- }
-
- public static Gtk.PrinterFunc GetManagedDelegate (PrinterFuncNative native)
- {
- if (native == null)
- return null;
- PrinterFuncWrapper wrapper = (PrinterFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly PrinterFuncNative NativeDelegate = new PrinterFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.RcPropertyParserNative.cs b/gtk/generated/GtkSharp.RcPropertyParserNative.cs
index e7b65d69b..2bb6df503 100644
--- a/gtk/generated/GtkSharp.RcPropertyParserNative.cs
+++ b/gtk/generated/GtkSharp.RcPropertyParserNative.cs
@@ -10,52 +10,12 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool RcPropertyParserNative(IntPtr pspec, IntPtr rc_string, ref GLib.Value property_value);
- internal class RcPropertyParserInvoker {
-
- RcPropertyParserNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~RcPropertyParserInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal RcPropertyParserInvoker (RcPropertyParserNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal RcPropertyParserInvoker (RcPropertyParserNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal RcPropertyParserInvoker (RcPropertyParserNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.RcPropertyParser Handler {
- get {
- return new Gtk.RcPropertyParser(InvokeNative);
- }
- }
-
- bool InvokeNative (IntPtr pspec, string rc_string, GLib.Value property_value)
- {
- Gtk.Application.AssertMainThread();
- bool result = native_cb (pspec, new GLib.GString (rc_string).Handle, ref property_value);
- return result;
- }
- }
-
internal class RcPropertyParserWrapper {
public bool NativeCallback (IntPtr pspec, IntPtr rc_string, ref GLib.Value property_value)
{
try {
bool __ret = managed (pspec, GLib.GString.PtrToString (rc_string), property_value);
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -63,16 +23,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal RcPropertyParserNative NativeDelegate;
+ internal readonly RcPropertyParserNative NativeDelegate;
Gtk.RcPropertyParser managed;
public RcPropertyParserWrapper (Gtk.RcPropertyParser managed)
@@ -82,15 +34,6 @@ namespace GtkSharp {
NativeDelegate = new RcPropertyParserNative (NativeCallback);
}
- public static Gtk.RcPropertyParser GetManagedDelegate (RcPropertyParserNative native)
- {
- if (native == null)
- return null;
- RcPropertyParserWrapper wrapper = (RcPropertyParserWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.RecentFilterFuncNative.cs b/gtk/generated/GtkSharp.RecentFilterFuncNative.cs
index 3e7b1d9d1..f5fef3219 100644
--- a/gtk/generated/GtkSharp.RecentFilterFuncNative.cs
+++ b/gtk/generated/GtkSharp.RecentFilterFuncNative.cs
@@ -10,54 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool RecentFilterFuncNative(IntPtr filter_info, IntPtr user_data);
- internal class RecentFilterFuncInvoker {
+ internal static class RecentFilterFuncWrapper {
- RecentFilterFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~RecentFilterFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal RecentFilterFuncInvoker (RecentFilterFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal RecentFilterFuncInvoker (RecentFilterFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal RecentFilterFuncInvoker (RecentFilterFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.RecentFilterFunc Handler {
- get {
- return new Gtk.RecentFilterFunc(InvokeNative);
- }
- }
-
- bool InvokeNative (Gtk.RecentFilterInfo filter_info)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_filter_info = GLib.Marshaller.StructureToPtrAlloc<Gtk.RecentFilterInfo> (filter_info);
- bool result = native_cb (native_filter_info, __data);
- Marshal.FreeHGlobal (native_filter_info);
- return result;
- }
- }
-
- internal class RecentFilterFuncWrapper {
-
- public bool NativeCallback (IntPtr filter_info, IntPtr user_data)
+ public static bool NativeCallback (IntPtr filter_info, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.RecentFilterFunc)gch.Target;
bool __ret = managed (Gtk.RecentFilterInfo.New (filter_info));
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -65,34 +25,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal RecentFilterFuncNative NativeDelegate;
- Gtk.RecentFilterFunc managed;
-
- public RecentFilterFuncWrapper (Gtk.RecentFilterFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new RecentFilterFuncNative (NativeCallback);
- }
-
- public static Gtk.RecentFilterFunc GetManagedDelegate (RecentFilterFuncNative native)
- {
- if (native == null)
- return null;
- RecentFilterFuncWrapper wrapper = (RecentFilterFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly RecentFilterFuncNative NativeDelegate = new RecentFilterFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.RecentSortFuncNative.cs b/gtk/generated/GtkSharp.RecentSortFuncNative.cs
index 5f6d0175c..3dfa87580 100644
--- a/gtk/generated/GtkSharp.RecentSortFuncNative.cs
+++ b/gtk/generated/GtkSharp.RecentSortFuncNative.cs
@@ -48,14 +48,14 @@ namespace GtkSharp {
}
}
- internal class RecentSortFuncWrapper {
+ internal static class RecentSortFuncWrapper {
- public int NativeCallback (IntPtr a, IntPtr b, IntPtr user_data)
+ public static int NativeCallback (IntPtr a, IntPtr b, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.RecentSortFunc)gch.Target;
int __ret = managed (a == IntPtr.Zero ? null : (Gtk.RecentInfo) GLib.Opaque.GetOpaque (a, typeof (Gtk.RecentInfo), false), b == IntPtr.Zero ? null : (Gtk.RecentInfo) GLib.Opaque.GetOpaque (b, typeof (Gtk.RecentInfo), false));
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
@@ -64,34 +64,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal RecentSortFuncNative NativeDelegate;
- Gtk.RecentSortFunc managed;
-
- public RecentSortFuncWrapper (Gtk.RecentSortFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new RecentSortFuncNative (NativeCallback);
- }
-
- public static Gtk.RecentSortFunc GetManagedDelegate (RecentSortFuncNative native)
- {
- if (native == null)
- return null;
- RecentSortFuncWrapper wrapper = (RecentSortFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly RecentSortFuncNative NativeDelegate = new RecentSortFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.SignalFuncNative.cs b/gtk/generated/GtkSharp.SignalFuncNative.cs
index a0ef818fc..d71693116 100644
--- a/gtk/generated/GtkSharp.SignalFuncNative.cs
+++ b/gtk/generated/GtkSharp.SignalFuncNative.cs
@@ -10,65 +10,19 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void SignalFuncNative();
- internal class SignalFuncInvoker {
-
- SignalFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~SignalFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal SignalFuncInvoker (SignalFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal SignalFuncInvoker (SignalFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal SignalFuncInvoker (SignalFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.SignalFunc Handler {
- get {
- return new Gtk.SignalFunc(InvokeNative);
- }
- }
-
- void InvokeNative ()
- {
- native_cb ();
- }
- }
-
internal class SignalFuncWrapper {
public void NativeCallback ()
{
try {
managed ();
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal SignalFuncNative NativeDelegate;
+ internal readonly SignalFuncNative NativeDelegate;
Gtk.SignalFunc managed;
public SignalFuncWrapper (Gtk.SignalFunc managed)
@@ -78,15 +32,6 @@ namespace GtkSharp {
NativeDelegate = new SignalFuncNative (NativeCallback);
}
- public static Gtk.SignalFunc GetManagedDelegate (SignalFuncNative native)
- {
- if (native == null)
- return null;
- SignalFuncWrapper wrapper = (SignalFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TextBufferDeserializeFuncNative.cs b/gtk/generated/GtkSharp.TextBufferDeserializeFuncNative.cs
index c1fcceeb2..bb71a2465 100644
--- a/gtk/generated/GtkSharp.TextBufferDeserializeFuncNative.cs
+++ b/gtk/generated/GtkSharp.TextBufferDeserializeFuncNative.cs
@@ -10,57 +10,16 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool TextBufferDeserializeFuncNative(IntPtr register_buffer, IntPtr content_buffer, IntPtr iter, byte[] data, UIntPtr length, bool create_tags, IntPtr user_data, out IntPtr error);
- internal class TextBufferDeserializeFuncInvoker {
+ internal static class TextBufferDeserializeFuncWrapper {
- TextBufferDeserializeFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~TextBufferDeserializeFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal TextBufferDeserializeFuncInvoker (TextBufferDeserializeFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal TextBufferDeserializeFuncInvoker (TextBufferDeserializeFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal TextBufferDeserializeFuncInvoker (TextBufferDeserializeFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.TextBufferDeserializeFunc Handler {
- get {
- return new Gtk.TextBufferDeserializeFunc(InvokeNative);
- }
- }
-
- bool InvokeNative (Gtk.TextBuffer register_buffer, Gtk.TextBuffer content_buffer, Gtk.TextIter iter, byte[] data, ulong length, bool create_tags)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc<Gtk.TextIter> (iter);
- IntPtr error = IntPtr.Zero;
- bool result = native_cb (register_buffer == null ? IntPtr.Zero : register_buffer.Handle, content_buffer == null ? IntPtr.Zero : content_buffer.Handle, native_iter, data, new UIntPtr (length), create_tags, __data, out error);
- Marshal.FreeHGlobal (native_iter);
- return result;
- }
- }
-
- internal class TextBufferDeserializeFuncWrapper {
-
- public bool NativeCallback (IntPtr register_buffer, IntPtr content_buffer, IntPtr iter, byte[] data, UIntPtr length, bool create_tags, IntPtr user_data, out IntPtr error)
+ public static bool NativeCallback (IntPtr register_buffer, IntPtr content_buffer, IntPtr iter, byte[] data, UIntPtr length, bool create_tags, IntPtr user_data, out IntPtr error)
{
error = IntPtr.Zero;
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.TextBufferDeserializeFunc)gch.Target;
bool __ret = managed (GLib.Object.GetObject(register_buffer) as Gtk.TextBuffer, GLib.Object.GetObject(content_buffer) as Gtk.TextBuffer, Gtk.TextIter.New (iter), data, (ulong) length, create_tags);
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -68,34 +27,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal TextBufferDeserializeFuncNative NativeDelegate;
- Gtk.TextBufferDeserializeFunc managed;
-
- public TextBufferDeserializeFuncWrapper (Gtk.TextBufferDeserializeFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TextBufferDeserializeFuncNative (NativeCallback);
- }
-
- public static Gtk.TextBufferDeserializeFunc GetManagedDelegate (TextBufferDeserializeFuncNative native)
- {
- if (native == null)
- return null;
- TextBufferDeserializeFuncWrapper wrapper = (TextBufferDeserializeFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TextBufferDeserializeFuncNative NativeDelegate = new TextBufferDeserializeFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TextCharPredicateNative.cs b/gtk/generated/GtkSharp.TextCharPredicateNative.cs
index db8803c9a..e9e46c0f0 100644
--- a/gtk/generated/GtkSharp.TextCharPredicateNative.cs
+++ b/gtk/generated/GtkSharp.TextCharPredicateNative.cs
@@ -10,52 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool TextCharPredicateNative(uint ch, IntPtr user_data);
- internal class TextCharPredicateInvoker {
+ internal static class TextCharPredicateWrapper {
- TextCharPredicateNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~TextCharPredicateInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal TextCharPredicateInvoker (TextCharPredicateNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal TextCharPredicateInvoker (TextCharPredicateNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal TextCharPredicateInvoker (TextCharPredicateNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.TextCharPredicate Handler {
- get {
- return new Gtk.TextCharPredicate(InvokeNative);
- }
- }
-
- bool InvokeNative (char ch)
- {
- Gtk.Application.AssertMainThread();
- bool result = native_cb (GLib.Marshaller.CharToGUnichar (ch), __data);
- return result;
- }
- }
-
- internal class TextCharPredicateWrapper {
-
- public bool NativeCallback (uint ch, IntPtr user_data)
+ public static bool NativeCallback (uint ch, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.TextCharPredicate)gch.Target;
bool __ret = managed (GLib.Marshaller.GUnicharToChar (ch));
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -63,34 +25,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal TextCharPredicateNative NativeDelegate;
- Gtk.TextCharPredicate managed;
-
- public TextCharPredicateWrapper (Gtk.TextCharPredicate managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TextCharPredicateNative (NativeCallback);
- }
-
- public static Gtk.TextCharPredicate GetManagedDelegate (TextCharPredicateNative native)
- {
- if (native == null)
- return null;
- TextCharPredicateWrapper wrapper = (TextCharPredicateWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TextCharPredicateNative NativeDelegate = new TextCharPredicateNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TextTagTableForeachNative.cs b/gtk/generated/GtkSharp.TextTagTableForeachNative.cs
index f3f1afbaf..25f530b17 100644
--- a/gtk/generated/GtkSharp.TextTagTableForeachNative.cs
+++ b/gtk/generated/GtkSharp.TextTagTableForeachNative.cs
@@ -10,84 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void TextTagTableForeachNative(IntPtr tag, IntPtr data);
- internal class TextTagTableForeachInvoker {
+ internal static class TextTagTableForeachWrapper {
- TextTagTableForeachNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~TextTagTableForeachInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal TextTagTableForeachInvoker (TextTagTableForeachNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal TextTagTableForeachInvoker (TextTagTableForeachNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal TextTagTableForeachInvoker (TextTagTableForeachNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.TextTagTableForeach Handler {
- get {
- return new Gtk.TextTagTableForeach(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.TextTag tag)
- {
- Gtk.Application.AssertMainThread();
- native_cb (tag == null ? IntPtr.Zero : tag.Handle, __data);
- }
- }
-
- internal class TextTagTableForeachWrapper {
-
- public void NativeCallback (IntPtr tag, IntPtr data)
+ public static void NativeCallback (IntPtr tag, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.TextTagTableForeach)gch.Target;
managed (GLib.Object.GetObject(tag) as Gtk.TextTag);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal TextTagTableForeachNative NativeDelegate;
- Gtk.TextTagTableForeach managed;
-
- public TextTagTableForeachWrapper (Gtk.TextTagTableForeach managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TextTagTableForeachNative (NativeCallback);
- }
-
- public static Gtk.TextTagTableForeach GetManagedDelegate (TextTagTableForeachNative native)
- {
- if (native == null)
- return null;
- TextTagTableForeachWrapper wrapper = (TextTagTableForeachWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TextTagTableForeachNative NativeDelegate = new TextTagTableForeachNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TranslateFuncNative.cs b/gtk/generated/GtkSharp.TranslateFuncNative.cs
index 5989daf45..e99e0f0af 100644
--- a/gtk/generated/GtkSharp.TranslateFuncNative.cs
+++ b/gtk/generated/GtkSharp.TranslateFuncNative.cs
@@ -10,54 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate IntPtr TranslateFuncNative(IntPtr path, IntPtr func_data);
- internal class TranslateFuncInvoker {
+ internal static class TranslateFuncWrapper {
- TranslateFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~TranslateFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal TranslateFuncInvoker (TranslateFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal TranslateFuncInvoker (TranslateFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal TranslateFuncInvoker (TranslateFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.TranslateFunc Handler {
- get {
- return new Gtk.TranslateFunc(InvokeNative);
- }
- }
-
- string InvokeNative (string path)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_path = GLib.Marshaller.StringToPtrGStrdup (path);
- string result = GLib.Marshaller.PtrToStringGFree(native_cb (native_path, __data));
- GLib.Marshaller.Free (native_path);
- return result;
- }
- }
-
- internal class TranslateFuncWrapper {
-
- public IntPtr NativeCallback (IntPtr path, IntPtr func_data)
+ public static IntPtr NativeCallback (IntPtr path, IntPtr func_data)
{
try {
+ var gch = (GCHandle)func_data;
+ var managed = (Gtk.TranslateFunc)gch.Target;
string __ret = managed (GLib.Marshaller.Utf8PtrToString (path));
- if (release_on_call)
- gch.Free ();
return GLib.Marshaller.StringToPtrGStrdup(__ret);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
@@ -66,34 +26,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal TranslateFuncNative NativeDelegate;
- Gtk.TranslateFunc managed;
-
- public TranslateFuncWrapper (Gtk.TranslateFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TranslateFuncNative (NativeCallback);
- }
-
- public static Gtk.TranslateFunc GetManagedDelegate (TranslateFuncNative native)
- {
- if (native == null)
- return null;
- TranslateFuncWrapper wrapper = (TranslateFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TranslateFuncNative NativeDelegate = new TranslateFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TreeCellDataFuncNative.cs b/gtk/generated/GtkSharp.TreeCellDataFuncNative.cs
index 4295c5177..90455c6d6 100644
--- a/gtk/generated/GtkSharp.TreeCellDataFuncNative.cs
+++ b/gtk/generated/GtkSharp.TreeCellDataFuncNative.cs
@@ -10,86 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void TreeCellDataFuncNative(IntPtr tree_column, IntPtr cell, IntPtr tree_model, IntPtr iter, IntPtr data);
- internal class TreeCellDataFuncInvoker {
+ internal static class TreeCellDataFuncWrapper {
- TreeCellDataFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~TreeCellDataFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal TreeCellDataFuncInvoker (TreeCellDataFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal TreeCellDataFuncInvoker (TreeCellDataFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal TreeCellDataFuncInvoker (TreeCellDataFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.TreeCellDataFunc Handler {
- get {
- return new Gtk.TreeCellDataFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc<Gtk.TreeIter> (iter);
- native_cb (tree_column == null ? IntPtr.Zero : tree_column.Handle, cell == null ? IntPtr.Zero : cell.Handle, tree_model == null ? IntPtr.Zero : tree_model.Handle, native_iter, __data);
- Marshal.FreeHGlobal (native_iter);
- }
- }
-
- internal class TreeCellDataFuncWrapper {
-
- public void NativeCallback (IntPtr tree_column, IntPtr cell, IntPtr tree_model, IntPtr iter, IntPtr data)
+ public static void NativeCallback (IntPtr tree_column, IntPtr cell, IntPtr tree_model, IntPtr iter, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.TreeCellDataFunc)gch.Target;
managed (GLib.Object.GetObject(tree_column) as Gtk.TreeViewColumn, GLib.Object.GetObject(cell) as Gtk.CellRenderer, Gtk.TreeModelAdapter.GetObject (tree_model, false), Gtk.TreeIter.New (iter));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal TreeCellDataFuncNative NativeDelegate;
- Gtk.TreeCellDataFunc managed;
-
- public TreeCellDataFuncWrapper (Gtk.TreeCellDataFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TreeCellDataFuncNative (NativeCallback);
- }
-
- public static Gtk.TreeCellDataFunc GetManagedDelegate (TreeCellDataFuncNative native)
- {
- if (native == null)
- return null;
- TreeCellDataFuncWrapper wrapper = (TreeCellDataFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TreeCellDataFuncNative NativeDelegate = new TreeCellDataFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TreeDestroyCountFuncNative.cs b/gtk/generated/GtkSharp.TreeDestroyCountFuncNative.cs
index bd90575e3..f273252f9 100644
--- a/gtk/generated/GtkSharp.TreeDestroyCountFuncNative.cs
+++ b/gtk/generated/GtkSharp.TreeDestroyCountFuncNative.cs
@@ -10,84 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void TreeDestroyCountFuncNative(IntPtr tree_view, IntPtr path, int children, IntPtr user_data);
- internal class TreeDestroyCountFuncInvoker {
+ internal static class TreeDestroyCountFuncWrapper {
- TreeDestroyCountFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~TreeDestroyCountFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal TreeDestroyCountFuncInvoker (TreeDestroyCountFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal TreeDestroyCountFuncInvoker (TreeDestroyCountFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal TreeDestroyCountFuncInvoker (TreeDestroyCountFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.TreeDestroyCountFunc Handler {
- get {
- return new Gtk.TreeDestroyCountFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.TreeView tree_view, Gtk.TreePath path, int children)
- {
- Gtk.Application.AssertMainThread();
- native_cb (tree_view == null ? IntPtr.Zero : tree_view.Handle, path == null ? IntPtr.Zero : path.Handle, children, __data);
- }
- }
-
- internal class TreeDestroyCountFuncWrapper {
-
- public void NativeCallback (IntPtr tree_view, IntPtr path, int children, IntPtr user_data)
+ public static void NativeCallback (IntPtr tree_view, IntPtr path, int children, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.TreeDestroyCountFunc)gch.Target;
managed (GLib.Object.GetObject(tree_view) as Gtk.TreeView, path == IntPtr.Zero ? null : (Gtk.TreePath) GLib.Opaque.GetOpaque (path, typeof (Gtk.TreePath), false), children);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal TreeDestroyCountFuncNative NativeDelegate;
- Gtk.TreeDestroyCountFunc managed;
-
- public TreeDestroyCountFuncWrapper (Gtk.TreeDestroyCountFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TreeDestroyCountFuncNative (NativeCallback);
- }
-
- public static Gtk.TreeDestroyCountFunc GetManagedDelegate (TreeDestroyCountFuncNative native)
- {
- if (native == null)
- return null;
- TreeDestroyCountFuncWrapper wrapper = (TreeDestroyCountFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TreeDestroyCountFuncNative NativeDelegate = new TreeDestroyCountFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TreeIterCompareFuncNative.cs b/gtk/generated/GtkSharp.TreeIterCompareFuncNative.cs
index 955df9050..78402ccc3 100644
--- a/gtk/generated/GtkSharp.TreeIterCompareFuncNative.cs
+++ b/gtk/generated/GtkSharp.TreeIterCompareFuncNative.cs
@@ -52,14 +52,14 @@ namespace GtkSharp {
}
}
- internal class TreeIterCompareFuncWrapper {
+ internal static class TreeIterCompareFuncWrapper {
- public int NativeCallback (IntPtr model, IntPtr a, IntPtr b, IntPtr user_data)
+ public static int NativeCallback (IntPtr model, IntPtr a, IntPtr b, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.TreeIterCompareFunc)gch.Target;
int __ret = managed (Gtk.TreeModelAdapter.GetObject (model, false), Gtk.TreeIter.New (a), Gtk.TreeIter.New (b));
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
@@ -68,34 +68,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal TreeIterCompareFuncNative NativeDelegate;
- Gtk.TreeIterCompareFunc managed;
-
- public TreeIterCompareFuncWrapper (Gtk.TreeIterCompareFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TreeIterCompareFuncNative (NativeCallback);
- }
-
- public static Gtk.TreeIterCompareFunc GetManagedDelegate (TreeIterCompareFuncNative native)
- {
- if (native == null)
- return null;
- TreeIterCompareFuncWrapper wrapper = (TreeIterCompareFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TreeIterCompareFuncNative NativeDelegate = new TreeIterCompareFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TreeModelFilterModifyFuncNative.cs b/gtk/generated/GtkSharp.TreeModelFilterModifyFuncNative.cs
index 87883f28f..165f2fea3 100644
--- a/gtk/generated/GtkSharp.TreeModelFilterModifyFuncNative.cs
+++ b/gtk/generated/GtkSharp.TreeModelFilterModifyFuncNative.cs
@@ -10,86 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void TreeModelFilterModifyFuncNative(IntPtr model, IntPtr iter, ref GLib.Value value, int column, IntPtr data);
- internal class TreeModelFilterModifyFuncInvoker {
+ internal static class TreeModelFilterModifyFuncWrapper {
- TreeModelFilterModifyFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~TreeModelFilterModifyFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal TreeModelFilterModifyFuncInvoker (TreeModelFilterModifyFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal TreeModelFilterModifyFuncInvoker (TreeModelFilterModifyFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal TreeModelFilterModifyFuncInvoker (TreeModelFilterModifyFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.TreeModelFilterModifyFunc Handler {
- get {
- return new Gtk.TreeModelFilterModifyFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.TreeModel model, Gtk.TreeIter iter, ref GLib.Value value, int column)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc<Gtk.TreeIter> (iter);
- native_cb (model == null ? IntPtr.Zero : model.Handle, native_iter, ref value, column, __data);
- Marshal.FreeHGlobal (native_iter);
- }
- }
-
- internal class TreeModelFilterModifyFuncWrapper {
-
- public void NativeCallback (IntPtr model, IntPtr iter, ref GLib.Value value, int column, IntPtr data)
+ public static void NativeCallback (IntPtr model, IntPtr iter, ref GLib.Value value, int column, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.TreeModelFilterModifyFunc)gch.Target;
managed (Gtk.TreeModelAdapter.GetObject (model, false), Gtk.TreeIter.New (iter), ref value, column);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal TreeModelFilterModifyFuncNative NativeDelegate;
- Gtk.TreeModelFilterModifyFunc managed;
-
- public TreeModelFilterModifyFuncWrapper (Gtk.TreeModelFilterModifyFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TreeModelFilterModifyFuncNative (NativeCallback);
- }
-
- public static Gtk.TreeModelFilterModifyFunc GetManagedDelegate (TreeModelFilterModifyFuncNative native)
- {
- if (native == null)
- return null;
- TreeModelFilterModifyFuncWrapper wrapper = (TreeModelFilterModifyFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TreeModelFilterModifyFuncNative NativeDelegate = new TreeModelFilterModifyFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TreeModelFilterVisibleFuncNative.cs b/gtk/generated/GtkSharp.TreeModelFilterVisibleFuncNative.cs
index 25be477f0..7cf24a3f2 100644
--- a/gtk/generated/GtkSharp.TreeModelFilterVisibleFuncNative.cs
+++ b/gtk/generated/GtkSharp.TreeModelFilterVisibleFuncNative.cs
@@ -10,54 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool TreeModelFilterVisibleFuncNative(IntPtr model, IntPtr iter, IntPtr data);
- internal class TreeModelFilterVisibleFuncInvoker {
+ internal static class TreeModelFilterVisibleFuncWrapper {
- TreeModelFilterVisibleFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~TreeModelFilterVisibleFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal TreeModelFilterVisibleFuncInvoker (TreeModelFilterVisibleFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal TreeModelFilterVisibleFuncInvoker (TreeModelFilterVisibleFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal TreeModelFilterVisibleFuncInvoker (TreeModelFilterVisibleFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.TreeModelFilterVisibleFunc Handler {
- get {
- return new Gtk.TreeModelFilterVisibleFunc(InvokeNative);
- }
- }
-
- bool InvokeNative (Gtk.TreeModel model, Gtk.TreeIter iter)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc<Gtk.TreeIter> (iter);
- bool result = native_cb (model == null ? IntPtr.Zero : model.Handle, native_iter, __data);
- Marshal.FreeHGlobal (native_iter);
- return result;
- }
- }
-
- internal class TreeModelFilterVisibleFuncWrapper {
-
- public bool NativeCallback (IntPtr model, IntPtr iter, IntPtr data)
+ public static bool NativeCallback (IntPtr model, IntPtr iter, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.TreeModelFilterVisibleFunc)gch.Target;
bool __ret = managed (Gtk.TreeModelAdapter.GetObject (model, false), Gtk.TreeIter.New (iter));
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -65,34 +25,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal TreeModelFilterVisibleFuncNative NativeDelegate;
- Gtk.TreeModelFilterVisibleFunc managed;
-
- public TreeModelFilterVisibleFuncWrapper (Gtk.TreeModelFilterVisibleFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TreeModelFilterVisibleFuncNative (NativeCallback);
- }
-
- public static Gtk.TreeModelFilterVisibleFunc GetManagedDelegate (TreeModelFilterVisibleFuncNative native)
- {
- if (native == null)
- return null;
- TreeModelFilterVisibleFuncWrapper wrapper = (TreeModelFilterVisibleFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TreeModelFilterVisibleFuncNative NativeDelegate = new TreeModelFilterVisibleFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TreeModelForeachFuncNative.cs b/gtk/generated/GtkSharp.TreeModelForeachFuncNative.cs
index 7eb79115c..706bfc774 100644
--- a/gtk/generated/GtkSharp.TreeModelForeachFuncNative.cs
+++ b/gtk/generated/GtkSharp.TreeModelForeachFuncNative.cs
@@ -10,54 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool TreeModelForeachFuncNative(IntPtr model, IntPtr path, IntPtr iter, IntPtr data);
- internal class TreeModelForeachFuncInvoker {
+ internal static class TreeModelForeachFuncWrapper {
- TreeModelForeachFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~TreeModelForeachFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal TreeModelForeachFuncInvoker (TreeModelForeachFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal TreeModelForeachFuncInvoker (TreeModelForeachFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal TreeModelForeachFuncInvoker (TreeModelForeachFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.TreeModelForeachFunc Handler {
- get {
- return new Gtk.TreeModelForeachFunc(InvokeNative);
- }
- }
-
- bool InvokeNative (Gtk.TreeModel model, Gtk.TreePath path, Gtk.TreeIter iter)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc<Gtk.TreeIter> (iter);
- bool result = native_cb (model == null ? IntPtr.Zero : model.Handle, path == null ? IntPtr.Zero : path.Handle, native_iter, __data);
- Marshal.FreeHGlobal (native_iter);
- return result;
- }
- }
-
- internal class TreeModelForeachFuncWrapper {
-
- public bool NativeCallback (IntPtr model, IntPtr path, IntPtr iter, IntPtr data)
+ public static bool NativeCallback (IntPtr model, IntPtr path, IntPtr iter, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.TreeModelForeachFunc)gch.Target;
bool __ret = managed (Gtk.TreeModelAdapter.GetObject (model, false), path == IntPtr.Zero ? null : (Gtk.TreePath) GLib.Opaque.GetOpaque (path, typeof (Gtk.TreePath), false), Gtk.TreeIter.New (iter));
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -65,34 +25,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal TreeModelForeachFuncNative NativeDelegate;
- Gtk.TreeModelForeachFunc managed;
-
- public TreeModelForeachFuncWrapper (Gtk.TreeModelForeachFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TreeModelForeachFuncNative (NativeCallback);
- }
-
- public static Gtk.TreeModelForeachFunc GetManagedDelegate (TreeModelForeachFuncNative native)
- {
- if (native == null)
- return null;
- TreeModelForeachFuncWrapper wrapper = (TreeModelForeachFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TreeModelForeachFuncNative NativeDelegate = new TreeModelForeachFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TreeSelectionForeachFuncNative.cs b/gtk/generated/GtkSharp.TreeSelectionForeachFuncNative.cs
index c4ec198f7..6eff3c79d 100644
--- a/gtk/generated/GtkSharp.TreeSelectionForeachFuncNative.cs
+++ b/gtk/generated/GtkSharp.TreeSelectionForeachFuncNative.cs
@@ -10,86 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void TreeSelectionForeachFuncNative(IntPtr model, IntPtr path, IntPtr iter, IntPtr data);
- internal class TreeSelectionForeachFuncInvoker {
+ internal static class TreeSelectionForeachFuncWrapper {
- TreeSelectionForeachFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~TreeSelectionForeachFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal TreeSelectionForeachFuncInvoker (TreeSelectionForeachFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal TreeSelectionForeachFuncInvoker (TreeSelectionForeachFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal TreeSelectionForeachFuncInvoker (TreeSelectionForeachFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.TreeSelectionForeachFunc Handler {
- get {
- return new Gtk.TreeSelectionForeachFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.TreeModel model, Gtk.TreePath path, Gtk.TreeIter iter)
- {
- Gtk.Application.AssertMainThread();
- IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc<Gtk.TreeIter> (iter);
- native_cb (model == null ? IntPtr.Zero : model.Handle, path == null ? IntPtr.Zero : path.Handle, native_iter, __data);
- Marshal.FreeHGlobal (native_iter);
- }
- }
-
- internal class TreeSelectionForeachFuncWrapper {
-
- public void NativeCallback (IntPtr model, IntPtr path, IntPtr iter, IntPtr data)
+ public static void NativeCallback (IntPtr model, IntPtr path, IntPtr iter, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.TreeSelectionForeachFunc)gch.Target;
managed (Gtk.TreeModelAdapter.GetObject (model, false), path == IntPtr.Zero ? null : (Gtk.TreePath) GLib.Opaque.GetOpaque (path, typeof (Gtk.TreePath), false), Gtk.TreeIter.New (iter));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal TreeSelectionForeachFuncNative NativeDelegate;
- Gtk.TreeSelectionForeachFunc managed;
-
- public TreeSelectionForeachFuncWrapper (Gtk.TreeSelectionForeachFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TreeSelectionForeachFuncNative (NativeCallback);
- }
-
- public static Gtk.TreeSelectionForeachFunc GetManagedDelegate (TreeSelectionForeachFuncNative native)
- {
- if (native == null)
- return null;
- TreeSelectionForeachFuncWrapper wrapper = (TreeSelectionForeachFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TreeSelectionForeachFuncNative NativeDelegate = new TreeSelectionForeachFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TreeSelectionFuncNative.cs b/gtk/generated/GtkSharp.TreeSelectionFuncNative.cs
index 483dde930..56ab4ad4b 100644
--- a/gtk/generated/GtkSharp.TreeSelectionFuncNative.cs
+++ b/gtk/generated/GtkSharp.TreeSelectionFuncNative.cs
@@ -10,52 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool TreeSelectionFuncNative(IntPtr selection, IntPtr model, IntPtr path, bool path_currently_selected, IntPtr data);
- internal class TreeSelectionFuncInvoker {
+ internal static class TreeSelectionFuncWrapper {
- TreeSelectionFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~TreeSelectionFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal TreeSelectionFuncInvoker (TreeSelectionFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal TreeSelectionFuncInvoker (TreeSelectionFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal TreeSelectionFuncInvoker (TreeSelectionFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.TreeSelectionFunc Handler {
- get {
- return new Gtk.TreeSelectionFunc(InvokeNative);
- }
- }
-
- bool InvokeNative (Gtk.TreeSelection selection, Gtk.TreeModel model, Gtk.TreePath path, bool path_currently_selected)
- {
- Gtk.Application.AssertMainThread();
- bool result = native_cb (selection == null ? IntPtr.Zero : selection.Handle, model == null ? IntPtr.Zero : model.Handle, path == null ? IntPtr.Zero : path.Handle, path_currently_selected, __data);
- return result;
- }
- }
-
- internal class TreeSelectionFuncWrapper {
-
- public bool NativeCallback (IntPtr selection, IntPtr model, IntPtr path, bool path_currently_selected, IntPtr data)
+ public static bool NativeCallback (IntPtr selection, IntPtr model, IntPtr path, bool path_currently_selected, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.TreeSelectionFunc)gch.Target;
bool __ret = managed (GLib.Object.GetObject(selection) as Gtk.TreeSelection, Gtk.TreeModelAdapter.GetObject (model, false), path == IntPtr.Zero ? null : (Gtk.TreePath) GLib.Opaque.GetOpaque (path, typeof (Gtk.TreePath), false), path_currently_selected);
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -63,34 +25,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal TreeSelectionFuncNative NativeDelegate;
- Gtk.TreeSelectionFunc managed;
-
- public TreeSelectionFuncWrapper (Gtk.TreeSelectionFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TreeSelectionFuncNative (NativeCallback);
- }
-
- public static Gtk.TreeSelectionFunc GetManagedDelegate (TreeSelectionFuncNative native)
- {
- if (native == null)
- return null;
- TreeSelectionFuncWrapper wrapper = (TreeSelectionFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TreeSelectionFuncNative NativeDelegate = new TreeSelectionFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TreeViewColumnDropFuncNative.cs b/gtk/generated/GtkSharp.TreeViewColumnDropFuncNative.cs
index 8bd60948f..893f2456a 100644
--- a/gtk/generated/GtkSharp.TreeViewColumnDropFuncNative.cs
+++ b/gtk/generated/GtkSharp.TreeViewColumnDropFuncNative.cs
@@ -10,52 +10,14 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool TreeViewColumnDropFuncNative(IntPtr tree_view, IntPtr column, IntPtr prev_column, IntPtr next_column, IntPtr data);
- internal class TreeViewColumnDropFuncInvoker {
+ internal static class TreeViewColumnDropFuncWrapper {
- TreeViewColumnDropFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~TreeViewColumnDropFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal TreeViewColumnDropFuncInvoker (TreeViewColumnDropFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal TreeViewColumnDropFuncInvoker (TreeViewColumnDropFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal TreeViewColumnDropFuncInvoker (TreeViewColumnDropFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.TreeViewColumnDropFunc Handler {
- get {
- return new Gtk.TreeViewColumnDropFunc(InvokeNative);
- }
- }
-
- bool InvokeNative (Gtk.TreeView tree_view, Gtk.TreeViewColumn column, Gtk.TreeViewColumn prev_column, Gtk.TreeViewColumn next_column)
- {
- Gtk.Application.AssertMainThread();
- bool result = native_cb (tree_view == null ? IntPtr.Zero : tree_view.Handle, column == null ? IntPtr.Zero : column.Handle, prev_column == null ? IntPtr.Zero : prev_column.Handle, next_column == null ? IntPtr.Zero : next_column.Handle, __data);
- return result;
- }
- }
-
- internal class TreeViewColumnDropFuncWrapper {
-
- public bool NativeCallback (IntPtr tree_view, IntPtr column, IntPtr prev_column, IntPtr next_column, IntPtr data)
+ public static bool NativeCallback (IntPtr tree_view, IntPtr column, IntPtr prev_column, IntPtr next_column, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.TreeViewColumnDropFunc)gch.Target;
bool __ret = managed (GLib.Object.GetObject(tree_view) as Gtk.TreeView, GLib.Object.GetObject(column) as Gtk.TreeViewColumn, GLib.Object.GetObject(prev_column) as Gtk.TreeViewColumn, GLib.Object.GetObject(next_column) as Gtk.TreeViewColumn);
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -63,34 +25,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal TreeViewColumnDropFuncNative NativeDelegate;
- Gtk.TreeViewColumnDropFunc managed;
-
- public TreeViewColumnDropFuncWrapper (Gtk.TreeViewColumnDropFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TreeViewColumnDropFuncNative (NativeCallback);
- }
-
- public static Gtk.TreeViewColumnDropFunc GetManagedDelegate (TreeViewColumnDropFuncNative native)
- {
- if (native == null)
- return null;
- TreeViewColumnDropFuncWrapper wrapper = (TreeViewColumnDropFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TreeViewColumnDropFuncNative NativeDelegate = new TreeViewColumnDropFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TreeViewMappingFuncNative.cs b/gtk/generated/GtkSharp.TreeViewMappingFuncNative.cs
index ee9b4e6e6..534b251d1 100644
--- a/gtk/generated/GtkSharp.TreeViewMappingFuncNative.cs
+++ b/gtk/generated/GtkSharp.TreeViewMappingFuncNative.cs
@@ -10,84 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void TreeViewMappingFuncNative(IntPtr tree_view, IntPtr path, IntPtr user_data);
- internal class TreeViewMappingFuncInvoker {
+ internal static class TreeViewMappingFuncWrapper {
- TreeViewMappingFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~TreeViewMappingFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal TreeViewMappingFuncInvoker (TreeViewMappingFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal TreeViewMappingFuncInvoker (TreeViewMappingFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal TreeViewMappingFuncInvoker (TreeViewMappingFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.TreeViewMappingFunc Handler {
- get {
- return new Gtk.TreeViewMappingFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.TreeView tree_view, Gtk.TreePath path)
- {
- Gtk.Application.AssertMainThread();
- native_cb (tree_view == null ? IntPtr.Zero : tree_view.Handle, path == null ? IntPtr.Zero : path.Handle, __data);
- }
- }
-
- internal class TreeViewMappingFuncWrapper {
-
- public void NativeCallback (IntPtr tree_view, IntPtr path, IntPtr user_data)
+ public static void NativeCallback (IntPtr tree_view, IntPtr path, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.TreeViewMappingFunc)gch.Target;
managed (GLib.Object.GetObject(tree_view) as Gtk.TreeView, path == IntPtr.Zero ? null : (Gtk.TreePath) GLib.Opaque.GetOpaque (path, typeof (Gtk.TreePath), false));
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal TreeViewMappingFuncNative NativeDelegate;
- Gtk.TreeViewMappingFunc managed;
-
- public TreeViewMappingFuncWrapper (Gtk.TreeViewMappingFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TreeViewMappingFuncNative (NativeCallback);
- }
-
- public static Gtk.TreeViewMappingFunc GetManagedDelegate (TreeViewMappingFuncNative native)
- {
- if (native == null)
- return null;
- TreeViewMappingFuncWrapper wrapper = (TreeViewMappingFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TreeViewMappingFuncNative NativeDelegate = new TreeViewMappingFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TreeViewRowSeparatorFuncNative.cs b/gtk/generated/GtkSharp.TreeViewRowSeparatorFuncNative.cs
index 251afd087..107bee846 100644
--- a/gtk/generated/GtkSharp.TreeViewRowSeparatorFuncNative.cs
+++ b/gtk/generated/GtkSharp.TreeViewRowSeparatorFuncNative.cs
@@ -50,14 +50,14 @@ namespace GtkSharp {
}
}
- internal class TreeViewRowSeparatorFuncWrapper {
+ internal static class TreeViewRowSeparatorFuncWrapper {
- public bool NativeCallback (IntPtr model, IntPtr iter, IntPtr data)
+ public static bool NativeCallback (IntPtr model, IntPtr iter, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.TreeViewRowSeparatorFunc)gch.Target;
bool __ret = managed (Gtk.TreeModelAdapter.GetObject (model, false), Gtk.TreeIter.New (iter));
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -65,34 +65,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal TreeViewRowSeparatorFuncNative NativeDelegate;
- Gtk.TreeViewRowSeparatorFunc managed;
-
- public TreeViewRowSeparatorFuncWrapper (Gtk.TreeViewRowSeparatorFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TreeViewRowSeparatorFuncNative (NativeCallback);
- }
-
- public static Gtk.TreeViewRowSeparatorFunc GetManagedDelegate (TreeViewRowSeparatorFuncNative native)
- {
- if (native == null)
- return null;
- TreeViewRowSeparatorFuncWrapper wrapper = (TreeViewRowSeparatorFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TreeViewRowSeparatorFuncNative NativeDelegate = new TreeViewRowSeparatorFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TreeViewSearchEqualFuncNative.cs b/gtk/generated/GtkSharp.TreeViewSearchEqualFuncNative.cs
index d8c9e7f1b..a48cb64ee 100644
--- a/gtk/generated/GtkSharp.TreeViewSearchEqualFuncNative.cs
+++ b/gtk/generated/GtkSharp.TreeViewSearchEqualFuncNative.cs
@@ -52,14 +52,14 @@ namespace GtkSharp {
}
}
- internal class TreeViewSearchEqualFuncWrapper {
+ internal static class TreeViewSearchEqualFuncWrapper {
- public bool NativeCallback (IntPtr model, int column, IntPtr key, IntPtr iter, IntPtr search_data)
+ public static bool NativeCallback (IntPtr model, int column, IntPtr key, IntPtr iter, IntPtr search_data)
{
try {
+ var gch = (GCHandle)search_data;
+ var managed = (Gtk.TreeViewSearchEqualFunc)gch.Target;
bool __ret = managed (Gtk.TreeModelAdapter.GetObject (model, false), column, GLib.Marshaller.Utf8PtrToString (key), Gtk.TreeIter.New (iter));
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -67,34 +67,8 @@ namespace GtkSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal TreeViewSearchEqualFuncNative NativeDelegate;
- Gtk.TreeViewSearchEqualFunc managed;
-
- public TreeViewSearchEqualFuncWrapper (Gtk.TreeViewSearchEqualFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TreeViewSearchEqualFuncNative (NativeCallback);
- }
-
- public static Gtk.TreeViewSearchEqualFunc GetManagedDelegate (TreeViewSearchEqualFuncNative native)
- {
- if (native == null)
- return null;
- TreeViewSearchEqualFuncWrapper wrapper = (TreeViewSearchEqualFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TreeViewSearchEqualFuncNative NativeDelegate = new TreeViewSearchEqualFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.TreeViewSearchPositionFuncNative.cs b/gtk/generated/GtkSharp.TreeViewSearchPositionFuncNative.cs
index 06f58d899..2a2c3c240 100644
--- a/gtk/generated/GtkSharp.TreeViewSearchPositionFuncNative.cs
+++ b/gtk/generated/GtkSharp.TreeViewSearchPositionFuncNative.cs
@@ -47,47 +47,21 @@ namespace GtkSharp {
}
}
- internal class TreeViewSearchPositionFuncWrapper {
+ internal static class TreeViewSearchPositionFuncWrapper {
- public void NativeCallback (IntPtr tree_view, IntPtr search_dialog, IntPtr user_data)
+ public static void NativeCallback (IntPtr tree_view, IntPtr search_dialog, IntPtr user_data)
{
try {
+ var gch = (GCHandle)user_data;
+ var managed = (Gtk.TreeViewSearchPositionFunc)gch.Target;
managed (GLib.Object.GetObject(tree_view) as Gtk.TreeView, GLib.Object.GetObject(search_dialog) as Gtk.Widget);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal TreeViewSearchPositionFuncNative NativeDelegate;
- Gtk.TreeViewSearchPositionFunc managed;
-
- public TreeViewSearchPositionFuncWrapper (Gtk.TreeViewSearchPositionFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new TreeViewSearchPositionFuncNative (NativeCallback);
- }
-
- public static Gtk.TreeViewSearchPositionFunc GetManagedDelegate (TreeViewSearchPositionFuncNative native)
- {
- if (native == null)
- return null;
- TreeViewSearchPositionFuncWrapper wrapper = (TreeViewSearchPositionFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly TreeViewSearchPositionFuncNative NativeDelegate = new TreeViewSearchPositionFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/GtkSharp.WindowKeysForeachFuncNative.cs b/gtk/generated/GtkSharp.WindowKeysForeachFuncNative.cs
index 574302921..087e7fb91 100644
--- a/gtk/generated/GtkSharp.WindowKeysForeachFuncNative.cs
+++ b/gtk/generated/GtkSharp.WindowKeysForeachFuncNative.cs
@@ -10,84 +10,21 @@ namespace GtkSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void WindowKeysForeachFuncNative(IntPtr window, uint keyval, int modifiers, bool is_mnemonic, IntPtr data);
- internal class WindowKeysForeachFuncInvoker {
+ internal static class WindowKeysForeachFuncWrapper {
- WindowKeysForeachFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~WindowKeysForeachFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal WindowKeysForeachFuncInvoker (WindowKeysForeachFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal WindowKeysForeachFuncInvoker (WindowKeysForeachFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal WindowKeysForeachFuncInvoker (WindowKeysForeachFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Gtk.WindowKeysForeachFunc Handler {
- get {
- return new Gtk.WindowKeysForeachFunc(InvokeNative);
- }
- }
-
- void InvokeNative (Gtk.Window window, uint keyval, Gdk.ModifierType modifiers, bool is_mnemonic)
- {
- Gtk.Application.AssertMainThread();
- native_cb (window == null ? IntPtr.Zero : window.Handle, keyval, (int) modifiers, is_mnemonic, __data);
- }
- }
-
- internal class WindowKeysForeachFuncWrapper {
-
- public void NativeCallback (IntPtr window, uint keyval, int modifiers, bool is_mnemonic, IntPtr data)
+ public static void NativeCallback (IntPtr window, uint keyval, int modifiers, bool is_mnemonic, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Gtk.WindowKeysForeachFunc)gch.Target;
managed (GLib.Object.GetObject(window) as Gtk.Window, keyval, (Gdk.ModifierType) modifiers, is_mnemonic);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal WindowKeysForeachFuncNative NativeDelegate;
- Gtk.WindowKeysForeachFunc managed;
-
- public WindowKeysForeachFuncWrapper (Gtk.WindowKeysForeachFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new WindowKeysForeachFuncNative (NativeCallback);
- }
-
- public static Gtk.WindowKeysForeachFunc GetManagedDelegate (WindowKeysForeachFuncNative native)
- {
- if (native == null)
- return null;
- WindowKeysForeachFuncWrapper wrapper = (WindowKeysForeachFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly WindowKeysForeachFuncNative NativeDelegate = new WindowKeysForeachFuncNative (NativeCallback);
}
#endregion
}
diff --git a/gtk/generated/IconView.cs b/gtk/generated/IconView.cs
index bca6a1c4b..55c496284 100644
--- a/gtk/generated/IconView.cs
+++ b/gtk/generated/IconView.cs
@@ -933,8 +933,9 @@ namespace Gtk {
public void SelectedForeach(Gtk.IconViewForeachFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.IconViewForeachFuncWrapper func_wrapper = new GtkSharp.IconViewForeachFuncWrapper (func);
- gtk_icon_view_selected_foreach(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (func);
+ gtk_icon_view_selected_foreach(Handle, GtkSharp.IconViewForeachFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -1009,17 +1010,16 @@ namespace Gtk {
public void SetCellDataFunc(Gtk.CellRenderer cell, Gtk.CellLayoutDataFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.CellLayoutDataFuncWrapper func_wrapper = new GtkSharp.CellLayoutDataFuncWrapper (func);
IntPtr func_data;
GLib.DestroyNotify destroy;
if (func == null) {
func_data = IntPtr.Zero;
destroy = null;
} else {
- func_data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ func_data = (IntPtr) GCHandle.Alloc (func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_cell_layout_set_cell_data_func(Handle, cell == null ? IntPtr.Zero : cell.Handle, func_wrapper.NativeDelegate, func_data, destroy);
+ gtk_cell_layout_set_cell_data_func(Handle, cell == null ? IntPtr.Zero : cell.Handle, GtkSharp.CellLayoutDataFuncWrapper.NativeDelegate, func_data, destroy);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/Init.cs b/gtk/generated/Init.cs
index ffa2b969f..b1ec4adbc 100644
--- a/gtk/generated/Init.cs
+++ b/gtk/generated/Init.cs
@@ -14,8 +14,9 @@ namespace Gtk {
public static void Add(Gtk.Function function) {
Gtk.Application.AssertMainThread();
- GtkSharp.FunctionWrapper function_wrapper = new GtkSharp.FunctionWrapper (function);
- gtk_init_add(function_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (function);
+ gtk_init_add(GtkSharp.FunctionWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
#endregion
diff --git a/gtk/generated/Input.cs b/gtk/generated/Input.cs
index 59bbe7902..893033f26 100644
--- a/gtk/generated/Input.cs
+++ b/gtk/generated/Input.cs
@@ -48,71 +48,66 @@ namespace Gtk {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void InputFunctionNative(IntPtr data, int source, int condition);
- class InputFunctionWrapper {
-
- public void NativeCallback (IntPtr data, int source, int condition)
- {
- try {
- IntPtr _arg0 = data;
- int _arg1 = source;
- Gdk.InputCondition _arg2 = (Gdk.InputCondition) condition;
- managed ( _arg0, _arg1, _arg2);
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException (e, false);
- }
- }
-
- internal InputFunctionNative NativeDelegate;
- Gdk.InputFunction managed;
-
- public InputFunctionWrapper (Gdk.InputFunction managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new InputFunctionNative (NativeCallback);
- }
- }
-
class InputProxy {
- InputFunctionWrapper function;
- GtkSharp.CallbackMarshalWrapper marshal;
+ Gdk.InputFunction function;
+ Gtk.CallbackMarshal marshal;
IntPtr data;
DestroyNotify destroy;
- GLib.DestroyNotify handler;
- public InputProxy (InputFunctionWrapper function, GtkSharp.CallbackMarshalWrapper marshal, IntPtr data, DestroyNotify destroy)
+ public InputProxy (Gdk.InputFunction function, Gtk.CallbackMarshal marshal, IntPtr data, DestroyNotify destroy)
{
this.marshal = marshal;
this.function = function;
this.destroy = destroy;
this.data = data;
- handler = new GLib.DestroyNotify (OnDestroy);
}
- void OnDestroy (IntPtr data)
+ static void OnDestroy (IntPtr data)
{
- if (destroy != null)
- destroy ();
+ var gch = (GCHandle)data;
+ var proxy = (InputProxy)gch.Target;
+
+ if (proxy.destroy != null)
+ proxy.destroy ();
- GCHandle gch = (GCHandle) data;
gch.Free ();
}
- public GLib.DestroyNotify Handler {
- get {
- return handler;
+ static void OnInputFunction (IntPtr data, int source, int condition)
+ {
+ var gch = (GCHandle)data;
+ var proxy = (InputProxy)gch.Target;
+
+ try {
+ proxy.function (data, source, (Gdk.InputCondition)condition);
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
+ }
+ }
+
+ static void OnCallbackMarshal (IntPtr objekt, IntPtr data, uint n_args, IntPtr args)
+ {
+ var gch = (GCHandle)data;
+ var proxy = (InputProxy)gch.Target;
+
+ try {
+ proxy.marshal (GLib.Object.GetObject (objekt) as Gtk.Object, proxy.data, n_args, Gtk.Arg.New (args));
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
+
+ public static GtkSharp.CallbackMarshalNative MarshalHandler = new GtkSharp.CallbackMarshalNative (OnCallbackMarshal);
+ public static InputFunctionNative FunctionHandler = new InputFunctionNative (OnInputFunction);
+ public static GLib.DestroyNotify DestroyHandler = new GLib.DestroyNotify (OnDestroy);
}
[Obsolete]
public static uint AddFull(int source, Gdk.InputCondition condition, Gdk.InputFunction function, Gtk.CallbackMarshal marshal, IntPtr data, Gtk.DestroyNotify destroy) {
- InputFunctionWrapper function_wrapper = new InputFunctionWrapper (function);
- GtkSharp.CallbackMarshalWrapper marshal_wrapper = new GtkSharp.CallbackMarshalWrapper (marshal);
- InputProxy proxy = new InputProxy (function_wrapper, marshal_wrapper, data, destroy);
+ InputProxy proxy = new InputProxy (function, marshal, data, destroy);
GCHandle gch = GCHandle.Alloc (proxy);
- return gtk_input_add_full (source, (int) condition, function_wrapper.NativeDelegate, marshal_wrapper.NativeDelegate, (IntPtr) gch, proxy.Handler);
+ return gtk_input_add_full (source, (int) condition, InputProxy.FunctionHandler, InputProxy.MarshalHandler, (IntPtr) gch, InputProxy.DestroyHandler);
}
#endregion
diff --git a/gtk/generated/ItemFactory.cs b/gtk/generated/ItemFactory.cs
index 9276cc77b..7a0f0c4ed 100644
--- a/gtk/generated/ItemFactory.cs
+++ b/gtk/generated/ItemFactory.cs
@@ -27,17 +27,16 @@ namespace Gtk {
public Gtk.TranslateFunc TranslateFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.TranslateFuncWrapper value_wrapper = new GtkSharp.TranslateFuncWrapper (value);
IntPtr data;
GLib.DestroyNotify notify;
if (value == null) {
data = IntPtr.Zero;
notify = null;
} else {
- data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ data = (IntPtr) GCHandle.Alloc (value);
notify = GLib.DestroyHelper.NotifyHandler;
}
- gtk_item_factory_set_translate_func(Handle, value_wrapper.NativeDelegate, data, notify);
+ gtk_item_factory_set_translate_func(Handle, GtkSharp.TranslateFuncWrapper.NativeDelegate, data, notify);
}
}
@@ -163,8 +162,9 @@ namespace Gtk {
public void PopupWithData(IntPtr popup_data, Gtk.DestroyNotify destroy, uint x, uint y, uint mouse_button, uint time_) {
Gtk.Application.AssertMainThread();
- GtkSharp.DestroyNotifyWrapper destroy_wrapper = new GtkSharp.DestroyNotifyWrapper (destroy);
- gtk_item_factory_popup_with_data(Handle, popup_data, destroy_wrapper.NativeDelegate, x, y, mouse_button, time_);
+ GCHandle gch = GCHandle.Alloc (destroy);
+ gtk_item_factory_popup_with_data(Handle, popup_data, GtkSharp.DestroyNotifyWrapper.NativeDelegate, x, y, mouse_button, time_);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/ItemFactoryEntry.cs b/gtk/generated/ItemFactoryEntry.cs
index f0dd1c568..b967bfefe 100644
--- a/gtk/generated/ItemFactoryEntry.cs
+++ b/gtk/generated/ItemFactoryEntry.cs
@@ -18,7 +18,7 @@ namespace Gtk {
private GtkSharp.ItemFactoryCallbackNative cb;
public Gtk.ItemFactoryCallback Callback {
get {
- return GtkSharp.ItemFactoryCallbackWrapper.GetManagedDelegate (cb);
+ return new GtkSharp.ItemFactoryCallbackInvoker (cb).Handler;
}
}
public uint CallbackAction;
diff --git a/gtk/generated/LinkButton.cs b/gtk/generated/LinkButton.cs
index 1625da122..02f3ecede 100644
--- a/gtk/generated/LinkButton.cs
+++ b/gtk/generated/LinkButton.cs
@@ -91,18 +91,17 @@ namespace Gtk {
public static Gtk.LinkButtonUriFunc SetUriHook(Gtk.LinkButtonUriFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.LinkButtonUriFuncWrapper func_wrapper = new GtkSharp.LinkButtonUriFuncWrapper (func);
IntPtr data;
GLib.DestroyNotify destroy;
if (func == null) {
data = IntPtr.Zero;
destroy = null;
} else {
- data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ data = (IntPtr) GCHandle.Alloc (func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- GtkSharp.LinkButtonUriFuncNative raw_ret = gtk_link_button_set_uri_hook(func_wrapper.NativeDelegate, data, destroy);
- Gtk.LinkButtonUriFunc ret = GtkSharp.LinkButtonUriFuncWrapper.GetManagedDelegate (raw_ret);
+ GtkSharp.LinkButtonUriFuncNative raw_ret = gtk_link_button_set_uri_hook(GtkSharp.LinkButtonUriFuncWrapper.NativeDelegate, data, destroy);
+ Gtk.LinkButtonUriFunc ret = new GtkSharp.LinkButtonUriFuncInvoker (raw_ret).Handler;
return ret;
}
diff --git a/gtk/generated/ListStore.cs b/gtk/generated/ListStore.cs
index f169b33c8..801b189ff 100644
--- a/gtk/generated/ListStore.cs
+++ b/gtk/generated/ListStore.cs
@@ -202,8 +202,9 @@ namespace Gtk {
public void Foreach(Gtk.TreeModelForeachFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeModelForeachFuncWrapper func_wrapper = new GtkSharp.TreeModelForeachFuncWrapper (func);
- gtk_tree_model_foreach(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (func);
+ gtk_tree_model_foreach(Handle, GtkSharp.TreeModelForeachFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -682,17 +683,16 @@ namespace Gtk {
public Gtk.TreeIterCompareFunc DefaultSortFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeIterCompareFuncWrapper value_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (value);
IntPtr user_data;
GLib.DestroyNotify destroy;
if (value == null) {
user_data = IntPtr.Zero;
destroy = null;
} else {
- user_data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ user_data = (IntPtr) GCHandle.Alloc (value);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_sortable_set_default_sort_func(Handle, value_wrapper.NativeDelegate, user_data, destroy);
+ gtk_tree_sortable_set_default_sort_func(Handle, GtkSharp.TreeIterCompareFuncWrapper.NativeDelegate, user_data, destroy);
}
}
@@ -716,17 +716,16 @@ namespace Gtk {
public void SetSortFunc(int sort_column_id, Gtk.TreeIterCompareFunc sort_func) {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func);
IntPtr user_data;
GLib.DestroyNotify destroy;
if (sort_func == null) {
user_data = IntPtr.Zero;
destroy = null;
} else {
- user_data = (IntPtr) GCHandle.Alloc (sort_func_wrapper);
+ user_data = (IntPtr) GCHandle.Alloc (sort_func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_sortable_set_sort_func(Handle, sort_column_id, sort_func_wrapper.NativeDelegate, user_data, destroy);
+ gtk_tree_sortable_set_sort_func(Handle, sort_column_id, GtkSharp.TreeIterCompareFuncWrapper.NativeDelegate, user_data, destroy);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/Menu.cs b/gtk/generated/Menu.cs
index 355a1f67a..cf10d2643 100644
--- a/gtk/generated/Menu.cs
+++ b/gtk/generated/Menu.cs
@@ -274,7 +274,7 @@ namespace Gtk {
public void AttachToWidget(Gtk.Widget attach_widget, Gtk.MenuDetachFunc detacher) {
Gtk.Application.AssertMainThread();
GtkSharp.MenuDetachFuncWrapper detacher_wrapper = new GtkSharp.MenuDetachFuncWrapper (detacher);
- detacher_wrapper.PersistUntilCalled ();
+detacher_wrapper.PersistUntilCalled ();
gtk_menu_attach_to_widget(Handle, attach_widget == null ? IntPtr.Zero : attach_widget.Handle, detacher_wrapper.NativeDelegate);
}
@@ -314,9 +314,8 @@ namespace Gtk {
public void Popup(Gtk.Widget parent_menu_shell, Gtk.Widget parent_menu_item, Gtk.MenuPositionFunc func, uint button, uint activate_time) {
Gtk.Application.AssertMainThread();
- GtkSharp.MenuPositionFuncWrapper func_wrapper = new GtkSharp.MenuPositionFuncWrapper (func);
- func_wrapper.PersistUntilCalled ();
- gtk_menu_popup(Handle, parent_menu_shell == null ? IntPtr.Zero : parent_menu_shell.Handle, parent_menu_item == null ? IntPtr.Zero : parent_menu_item.Handle, func_wrapper.NativeDelegate, IntPtr.Zero, button, activate_time);
+ GCHandle gch = GCHandle.Alloc (func);
+ gtk_menu_popup(Handle, parent_menu_shell == null ? IntPtr.Zero : parent_menu_shell.Handle, parent_menu_item == null ? IntPtr.Zero : parent_menu_item.Handle, GtkSharp.MenuPositionFuncWrapper.NativeDelegate, (IntPtr)gch, button, activate_time);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/MenuEntry.cs b/gtk/generated/MenuEntry.cs
index 13355dd94..ef467fc36 100644
--- a/gtk/generated/MenuEntry.cs
+++ b/gtk/generated/MenuEntry.cs
@@ -17,7 +17,7 @@ namespace Gtk {
private GtkSharp.MenuCallbackNative cb;
public Gtk.MenuCallback Callback {
get {
- return GtkSharp.MenuCallbackWrapper.GetManagedDelegate (cb);
+ return new GtkSharp.MenuCallbackInvoker (cb).Handler;
}
}
private IntPtr _callback_data;
diff --git a/gtk/generated/Notebook.cs b/gtk/generated/Notebook.cs
index bb5b82e59..9021f97ba 100644
--- a/gtk/generated/Notebook.cs
+++ b/gtk/generated/Notebook.cs
@@ -1100,17 +1100,16 @@ namespace Gtk {
public static Gtk.NotebookWindowCreationFunc WindowCreationHook {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.NotebookWindowCreationFuncWrapper value_wrapper = new GtkSharp.NotebookWindowCreationFuncWrapper (value);
IntPtr data;
GLib.DestroyNotify destroy;
if (value == null) {
data = IntPtr.Zero;
destroy = null;
} else {
- data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ data = (IntPtr) GCHandle.Alloc (value);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_notebook_set_window_creation_hook(value_wrapper.NativeDelegate, data, destroy);
+ gtk_notebook_set_window_creation_hook(GtkSharp.NotebookWindowCreationFuncWrapper.NativeDelegate, data, destroy);
}
}
diff --git a/gtk/generated/Object.cs b/gtk/generated/Object.cs
index 99cf5b00d..c3da7c3ad 100644
--- a/gtk/generated/Object.cs
+++ b/gtk/generated/Object.cs
@@ -119,8 +119,9 @@ namespace Gtk {
[Obsolete]
public void Weakunref(Gtk.DestroyNotify notify) {
Gtk.Application.AssertMainThread();
- GtkSharp.DestroyNotifyWrapper notify_wrapper = new GtkSharp.DestroyNotifyWrapper (notify);
- gtk_object_weakunref(Handle, notify_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (notify);
+ gtk_object_weakunref(Handle, GtkSharp.DestroyNotifyWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -149,8 +150,9 @@ namespace Gtk {
[Obsolete]
public void SetDataByIdFull(int data_id, IntPtr data, Gtk.DestroyNotify destroy) {
Gtk.Application.AssertMainThread();
- GtkSharp.DestroyNotifyWrapper destroy_wrapper = new GtkSharp.DestroyNotifyWrapper (destroy);
- gtk_object_set_data_by_id_full(Handle, data_id, data, destroy_wrapper.NativeDelegate);
+ GCHandle gch = GCHandle.Alloc (destroy);
+ gtk_object_set_data_by_id_full(Handle, data_id, data, GtkSharp.DestroyNotifyWrapper.NativeDelegate);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -168,8 +170,9 @@ namespace Gtk {
[Obsolete]
public void Weakref(Gtk.DestroyNotify notify) {
Gtk.Application.AssertMainThread();
- GtkSharp.DestroyNotifyWrapper notify_wrapper = new GtkSharp.DestroyNotifyWrapper (notify);
- gtk_object_weakref(Handle, notify_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (notify);
+ gtk_object_weakref(Handle, GtkSharp.DestroyNotifyWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -189,9 +192,10 @@ namespace Gtk {
public void SetDataFull(string key, IntPtr data, Gtk.DestroyNotify destroy) {
Gtk.Application.AssertMainThread();
IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
- GtkSharp.DestroyNotifyWrapper destroy_wrapper = new GtkSharp.DestroyNotifyWrapper (destroy);
- gtk_object_set_data_full(Handle, native_key, data, destroy_wrapper.NativeDelegate);
+ GCHandle gch = GCHandle.Alloc (destroy);
+ gtk_object_set_data_full(Handle, native_key, data, GtkSharp.DestroyNotifyWrapper.NativeDelegate);
GLib.Marshaller.Free (native_key);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/Print.cs b/gtk/generated/Print.cs
index d22dfab06..761ef1cbf 100644
--- a/gtk/generated/Print.cs
+++ b/gtk/generated/Print.cs
@@ -14,9 +14,8 @@ namespace Gtk {
public static void RunPageSetupDialogAsync(Gtk.Window parent, Gtk.PageSetup page_setup, Gtk.PrintSettings settings, Gtk.PageSetupDoneFunc done_cb) {
Gtk.Application.AssertMainThread();
- GtkSharp.PageSetupDoneFuncWrapper done_cb_wrapper = new GtkSharp.PageSetupDoneFuncWrapper (done_cb);
- done_cb_wrapper.PersistUntilCalled ();
- gtk_print_run_page_setup_dialog_async(parent == null ? IntPtr.Zero : parent.Handle, page_setup == null ? IntPtr.Zero : page_setup.Handle, settings == null ? IntPtr.Zero : settings.Handle, done_cb_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (done_cb);
+ gtk_print_run_page_setup_dialog_async(parent == null ? IntPtr.Zero : parent.Handle, page_setup == null ? IntPtr.Zero : page_setup.Handle, settings == null ? IntPtr.Zero : settings.Handle, GtkSharp.PageSetupDoneFuncWrapper.NativeDelegate, (IntPtr)gch);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/PrintJob.cs b/gtk/generated/PrintJob.cs
index 38464a1c4..f41ac39f6 100644
--- a/gtk/generated/PrintJob.cs
+++ b/gtk/generated/PrintJob.cs
@@ -188,17 +188,16 @@ namespace Gtk {
public void Send(Gtk.PrintJobCompleteFunc cb) {
Gtk.Application.AssertMainThread();
- GtkSharp.PrintJobCompleteFuncWrapper cb_wrapper = new GtkSharp.PrintJobCompleteFuncWrapper (cb);
IntPtr user_data;
GLib.DestroyNotify dnotify;
if (cb == null) {
user_data = IntPtr.Zero;
dnotify = null;
} else {
- user_data = (IntPtr) GCHandle.Alloc (cb_wrapper);
+ user_data = (IntPtr) GCHandle.Alloc (cb);
dnotify = GLib.DestroyHelper.NotifyHandler;
}
- gtk_print_job_send(Handle, cb_wrapper.NativeDelegate, user_data, dnotify);
+ gtk_print_job_send(Handle, GtkSharp.PrintJobCompleteFuncWrapper.NativeDelegate, user_data, dnotify);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/PrintSettings.cs b/gtk/generated/PrintSettings.cs
index f90d180d9..cadd43797 100644
--- a/gtk/generated/PrintSettings.cs
+++ b/gtk/generated/PrintSettings.cs
@@ -325,8 +325,9 @@ namespace Gtk {
public void Foreach(Gtk.PrintSettingsFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.PrintSettingsFuncWrapper func_wrapper = new GtkSharp.PrintSettingsFuncWrapper (func);
- gtk_print_settings_foreach(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (func);
+ gtk_print_settings_foreach(Handle, GtkSharp.PrintSettingsFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/Printer.cs b/gtk/generated/Printer.cs
index eb6b0c7a5..ab7249a8f 100644
--- a/gtk/generated/Printer.cs
+++ b/gtk/generated/Printer.cs
@@ -306,19 +306,16 @@ namespace Gtk {
public static void EnumeratePrinters (Gtk.PrinterFunc func, bool wait)
{
- GtkSharp.PrinterFuncWrapper func_wrapper;
IntPtr func_data;
GLib.DestroyNotify destroy;
if (func == null) {
- func_wrapper = null;
func_data = IntPtr.Zero;
destroy = null;
} else {
- func_wrapper = new GtkSharp.PrinterFuncWrapper (func);
- func_data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ func_data = (IntPtr) GCHandle.Alloc (func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_enumerate_printers (func_wrapper.NativeDelegate, func_data, destroy, wait);
+ gtk_enumerate_printers (GtkSharp.PrinterFuncWrapper.NativeDelegate, func_data, destroy, wait);
}
diff --git a/gtk/generated/Quit.cs b/gtk/generated/Quit.cs
index 3ffc1f622..35505f844 100644
--- a/gtk/generated/Quit.cs
+++ b/gtk/generated/Quit.cs
@@ -59,35 +59,54 @@ namespace Gtk {
class QuitProxy {
- GtkSharp.FunctionWrapper function;
- GtkSharp.CallbackMarshalWrapper marshal;
+ Function function;
+ CallbackMarshal marshal;
IntPtr data;
DestroyNotify destroy;
- GLib.DestroyNotify handler;
- public QuitProxy (GtkSharp.FunctionWrapper function, GtkSharp.CallbackMarshalWrapper marshal, IntPtr data, DestroyNotify destroy)
+ public QuitProxy (Function function, CallbackMarshal marshal, IntPtr data, DestroyNotify destroy)
{
this.marshal = marshal;
this.function = function;
this.destroy = destroy;
this.data = data;
- handler = new GLib.DestroyNotify (OnDestroy);
}
- void OnDestroy (IntPtr data)
+ static void OnDestroy (IntPtr data)
{
- if (destroy != null)
- destroy ();
+ var gch = (GCHandle)data;
+ var proxy = (QuitProxy)gch.Target;
+
+ if (proxy.destroy != null)
+ proxy.destroy ();
- GCHandle gch = (GCHandle) data;
gch.Free ();
}
- public GLib.DestroyNotify Handler {
- get {
- return handler;
+ static bool OnFunction (IntPtr data)
+ {
+ var gch = (GCHandle)data;
+ var proxy = (QuitProxy)gch.Target;
+
+ return proxy.function ();
+ }
+
+ static void OnCallbackMarshal (IntPtr objekt, IntPtr data, uint n_args, IntPtr args)
+ {
+ var gch = (GCHandle)data;
+ var proxy = (QuitProxy)gch.Target;
+
+ try {
+ if (proxy.marshal != null)
+ proxy.marshal (GLib.Object.GetObject (objekt) as Gtk.Object, proxy.data, n_args, Gtk.Arg.New (args));
+ } catch (Exception e) {
+ GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
+
+ public static GtkSharp.CallbackMarshalNative MarshalHandler = new GtkSharp.CallbackMarshalNative (OnCallbackMarshal);
+ public static GtkSharp.FunctionNative FunctionHandler = new GtkSharp.FunctionNative (OnFunction);
+ public static GLib.DestroyNotify DestroyHandler = new GLib.DestroyNotify (OnDestroy);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
@@ -96,21 +115,20 @@ namespace Gtk {
[Obsolete ("Replaced by Add method")]
public static uint AddFull (uint main_level, Function function, CallbackMarshal marshal, IntPtr data, DestroyNotify destroy)
{
- GtkSharp.FunctionWrapper function_wrapper = new GtkSharp.FunctionWrapper (function);
- GtkSharp.CallbackMarshalWrapper marshal_wrapper = new GtkSharp.CallbackMarshalWrapper (marshal);
- QuitProxy proxy = new QuitProxy (function_wrapper, marshal_wrapper, data, destroy);
+ QuitProxy proxy = new QuitProxy (function, marshal, data, destroy);
GCHandle gch = GCHandle.Alloc (proxy);
- return gtk_quit_add_full (main_level, function_wrapper.NativeDelegate, marshal_wrapper.NativeDelegate, (IntPtr) gch, proxy.Handler);
+ return gtk_quit_add_full (main_level, QuitProxy.FunctionHandler, QuitProxy.MarshalHandler, (IntPtr) gch, QuitProxy.DestroyHandler);
}
- public static uint Add (uint main_level, Function function)
+ public static uint Add (uint main_level, Function function)
{
- GtkSharp.FunctionWrapper function_wrapper = new GtkSharp.FunctionWrapper (function);
- GCHandle gch = GCHandle.Alloc (function_wrapper);
- return gtk_quit_add_full (main_level, function_wrapper.NativeDelegate, null, (IntPtr) gch, GLib.DestroyHelper.NotifyHandler);
+ QuitProxy proxy = new QuitProxy (function, null, IntPtr.Zero, null);
+ GCHandle gch = GCHandle.Alloc (proxy);
+ return gtk_quit_add_full (main_level, GtkSharp.FunctionWrapper.NativeDelegate, null, (IntPtr) gch, GLib.DestroyHelper.NotifyHandler);
}
+
#endregion
}
}
diff --git a/gtk/generated/RecentAction.cs b/gtk/generated/RecentAction.cs
index dd546beba..ac04bd70f 100644
--- a/gtk/generated/RecentAction.cs
+++ b/gtk/generated/RecentAction.cs
@@ -239,17 +239,16 @@ namespace Gtk {
public Gtk.RecentSortFunc SortFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.RecentSortFuncWrapper value_wrapper = new GtkSharp.RecentSortFuncWrapper (value);
IntPtr sort_data;
GLib.DestroyNotify data_destroy;
if (value == null) {
sort_data = IntPtr.Zero;
data_destroy = null;
} else {
- sort_data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ sort_data = (IntPtr) GCHandle.Alloc (value);
data_destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_recent_chooser_set_sort_func(Handle, value_wrapper.NativeDelegate, sort_data, data_destroy);
+ gtk_recent_chooser_set_sort_func(Handle, GtkSharp.RecentSortFuncWrapper.NativeDelegate, sort_data, data_destroy);
}
}
diff --git a/gtk/generated/RecentChooserAdapter.cs b/gtk/generated/RecentChooserAdapter.cs
index 8dee7d6da..f3ee223d9 100644
--- a/gtk/generated/RecentChooserAdapter.cs
+++ b/gtk/generated/RecentChooserAdapter.cs
@@ -637,17 +637,16 @@ namespace Gtk {
public Gtk.RecentSortFunc SortFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.RecentSortFuncWrapper value_wrapper = new GtkSharp.RecentSortFuncWrapper (value);
IntPtr sort_data;
GLib.DestroyNotify data_destroy;
if (value == null) {
sort_data = IntPtr.Zero;
data_destroy = null;
} else {
- sort_data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ sort_data = (IntPtr) GCHandle.Alloc (value);
data_destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_recent_chooser_set_sort_func(Handle, value_wrapper.NativeDelegate, sort_data, data_destroy);
+ gtk_recent_chooser_set_sort_func(Handle, GtkSharp.RecentSortFuncWrapper.NativeDelegate, sort_data, data_destroy);
}
}
diff --git a/gtk/generated/RecentChooserDefault.cs b/gtk/generated/RecentChooserDefault.cs
index 9531978c4..a5fb7c90c 100644
--- a/gtk/generated/RecentChooserDefault.cs
+++ b/gtk/generated/RecentChooserDefault.cs
@@ -160,17 +160,16 @@ namespace Gtk {
public Gtk.RecentSortFunc SortFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.RecentSortFuncWrapper value_wrapper = new GtkSharp.RecentSortFuncWrapper (value);
IntPtr sort_data;
GLib.DestroyNotify data_destroy;
if (value == null) {
sort_data = IntPtr.Zero;
data_destroy = null;
} else {
- sort_data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ sort_data = (IntPtr) GCHandle.Alloc (value);
data_destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_recent_chooser_set_sort_func(Handle, value_wrapper.NativeDelegate, sort_data, data_destroy);
+ gtk_recent_chooser_set_sort_func(Handle, GtkSharp.RecentSortFuncWrapper.NativeDelegate, sort_data, data_destroy);
}
}
diff --git a/gtk/generated/RecentChooserDialog.cs b/gtk/generated/RecentChooserDialog.cs
index f10653fcb..5cdef0ca0 100644
--- a/gtk/generated/RecentChooserDialog.cs
+++ b/gtk/generated/RecentChooserDialog.cs
@@ -170,17 +170,16 @@ namespace Gtk {
public Gtk.RecentSortFunc SortFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.RecentSortFuncWrapper value_wrapper = new GtkSharp.RecentSortFuncWrapper (value);
IntPtr sort_data;
GLib.DestroyNotify data_destroy;
if (value == null) {
sort_data = IntPtr.Zero;
data_destroy = null;
} else {
- sort_data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ sort_data = (IntPtr) GCHandle.Alloc (value);
data_destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_recent_chooser_set_sort_func(Handle, value_wrapper.NativeDelegate, sort_data, data_destroy);
+ gtk_recent_chooser_set_sort_func(Handle, GtkSharp.RecentSortFuncWrapper.NativeDelegate, sort_data, data_destroy);
}
}
diff --git a/gtk/generated/RecentChooserMenu.cs b/gtk/generated/RecentChooserMenu.cs
index 9fbee082e..c66c1bd72 100644
--- a/gtk/generated/RecentChooserMenu.cs
+++ b/gtk/generated/RecentChooserMenu.cs
@@ -193,17 +193,16 @@ namespace Gtk {
public Gtk.RecentSortFunc SortFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.RecentSortFuncWrapper value_wrapper = new GtkSharp.RecentSortFuncWrapper (value);
IntPtr sort_data;
GLib.DestroyNotify data_destroy;
if (value == null) {
sort_data = IntPtr.Zero;
data_destroy = null;
} else {
- sort_data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ sort_data = (IntPtr) GCHandle.Alloc (value);
data_destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_recent_chooser_set_sort_func(Handle, value_wrapper.NativeDelegate, sort_data, data_destroy);
+ gtk_recent_chooser_set_sort_func(Handle, GtkSharp.RecentSortFuncWrapper.NativeDelegate, sort_data, data_destroy);
}
}
diff --git a/gtk/generated/RecentChooserWidget.cs b/gtk/generated/RecentChooserWidget.cs
index 0067fd61d..73f9a9ad9 100644
--- a/gtk/generated/RecentChooserWidget.cs
+++ b/gtk/generated/RecentChooserWidget.cs
@@ -193,17 +193,16 @@ namespace Gtk {
public Gtk.RecentSortFunc SortFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.RecentSortFuncWrapper value_wrapper = new GtkSharp.RecentSortFuncWrapper (value);
IntPtr sort_data;
GLib.DestroyNotify data_destroy;
if (value == null) {
sort_data = IntPtr.Zero;
data_destroy = null;
} else {
- sort_data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ sort_data = (IntPtr) GCHandle.Alloc (value);
data_destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_recent_chooser_set_sort_func(Handle, value_wrapper.NativeDelegate, sort_data, data_destroy);
+ gtk_recent_chooser_set_sort_func(Handle, GtkSharp.RecentSortFuncWrapper.NativeDelegate, sort_data, data_destroy);
}
}
diff --git a/gtk/generated/RecentFilter.cs b/gtk/generated/RecentFilter.cs
index 8eeeb219b..352935b7f 100644
--- a/gtk/generated/RecentFilter.cs
+++ b/gtk/generated/RecentFilter.cs
@@ -130,17 +130,16 @@ namespace Gtk {
public void AddCustom(Gtk.RecentFilterFlags needed, Gtk.RecentFilterFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.RecentFilterFuncWrapper func_wrapper = new GtkSharp.RecentFilterFuncWrapper (func);
IntPtr data;
GLib.DestroyNotify data_destroy;
if (func == null) {
data = IntPtr.Zero;
data_destroy = null;
} else {
- data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ data = (IntPtr) GCHandle.Alloc (func);
data_destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_recent_filter_add_custom(Handle, (int) needed, func_wrapper.NativeDelegate, data, data_destroy);
+ gtk_recent_filter_add_custom(Handle, (int) needed, GtkSharp.RecentFilterFuncWrapper.NativeDelegate, data, data_destroy);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/TextBuffer.cs b/gtk/generated/TextBuffer.cs
index d4ae3d49c..0f07c4b47 100644
--- a/gtk/generated/TextBuffer.cs
+++ b/gtk/generated/TextBuffer.cs
@@ -922,17 +922,16 @@ namespace Gtk {
public Gdk.Atom RegisterDeserializeFormat(string mime_type, Gtk.TextBufferDeserializeFunc function) {
Gtk.Application.AssertMainThread();
IntPtr native_mime_type = GLib.Marshaller.StringToPtrGStrdup (mime_type);
- GtkSharp.TextBufferDeserializeFuncWrapper function_wrapper = new GtkSharp.TextBufferDeserializeFuncWrapper (function);
IntPtr user_data;
GLib.DestroyNotify user_data_destroy;
if (function == null) {
user_data = IntPtr.Zero;
user_data_destroy = null;
} else {
- user_data = (IntPtr) GCHandle.Alloc (function_wrapper);
+ user_data = (IntPtr) GCHandle.Alloc (function);
user_data_destroy = GLib.DestroyHelper.NotifyHandler;
}
- IntPtr raw_ret = gtk_text_buffer_register_deserialize_format(Handle, native_mime_type, function_wrapper.NativeDelegate, user_data, user_data_destroy);
+ IntPtr raw_ret = gtk_text_buffer_register_deserialize_format(Handle, native_mime_type, GtkSharp.TextBufferDeserializeFuncWrapper.NativeDelegate, user_data, user_data_destroy);
Gdk.Atom ret = raw_ret == IntPtr.Zero ? null : (Gdk.Atom) GLib.Opaque.GetOpaque (raw_ret, typeof (Gdk.Atom), false);
GLib.Marshaller.Free (native_mime_type);
return ret;
@@ -1454,17 +1453,16 @@ static extern IntPtr gtk_text_buffer_register_serialize_format(IntPtr raw, IntPt
public Gdk.Atom RegisterSerializeFormat(string mime_type, Gtk.TextBufferSerializeFunc function) {
IntPtr native_mime_type = GLib.Marshaller.StringToPtrGStrdup (mime_type);
- GtkSharp.TextBufferSerializeFuncWrapper function_wrapper = new GtkSharp.TextBufferSerializeFuncWrapper (function);
IntPtr user_data;
GLib.DestroyNotify user_data_destroy;
if (function == null) {
user_data = IntPtr.Zero;
user_data_destroy = null;
} else {
- user_data = (IntPtr) GCHandle.Alloc (function_wrapper);
+ user_data = (IntPtr) GCHandle.Alloc (function);
user_data_destroy = GLib.DestroyHelper.NotifyHandler;
}
- IntPtr raw_ret = gtk_text_buffer_register_serialize_format(Handle, native_mime_type, function_wrapper.NativeDelegate, user_data, user_data_destroy);
+ IntPtr raw_ret = gtk_text_buffer_register_serialize_format(Handle, native_mime_type, GtkSharp.TextBufferSerializeFuncWrapper.NativeDelegate, user_data, user_data_destroy);
Gdk.Atom ret = raw_ret == IntPtr.Zero ? null : (Gdk.Atom) GLib.Opaque.GetOpaque (raw_ret, typeof (Gdk.Atom), false);
GLib.Marshaller.Free (native_mime_type);
return ret;
diff --git a/gtk/generated/TextIter.cs b/gtk/generated/TextIter.cs
index 232ad3575..080f63621 100644
--- a/gtk/generated/TextIter.cs
+++ b/gtk/generated/TextIter.cs
@@ -364,9 +364,10 @@ namespace Gtk {
public bool ForwardFindChar(Gtk.TextCharPredicate pred, Gtk.TextIter limit) {
Gtk.Application.AssertMainThread();
- GtkSharp.TextCharPredicateWrapper pred_wrapper = new GtkSharp.TextCharPredicateWrapper (pred);
- bool raw_ret = gtk_text_iter_forward_find_char(ref this, pred_wrapper.NativeDelegate, IntPtr.Zero, ref limit);
+ GCHandle gch = GCHandle.Alloc (pred);
+ bool raw_ret = gtk_text_iter_forward_find_char(ref this, GtkSharp.TextCharPredicateWrapper.NativeDelegate, (IntPtr)gch, ref limit);
bool ret = raw_ret;
+ gch.Free();
return ret;
}
@@ -434,9 +435,10 @@ namespace Gtk {
public bool BackwardFindChar(Gtk.TextCharPredicate pred, Gtk.TextIter limit) {
Gtk.Application.AssertMainThread();
- GtkSharp.TextCharPredicateWrapper pred_wrapper = new GtkSharp.TextCharPredicateWrapper (pred);
- bool raw_ret = gtk_text_iter_backward_find_char(ref this, pred_wrapper.NativeDelegate, IntPtr.Zero, ref limit);
+ GCHandle gch = GCHandle.Alloc (pred);
+ bool raw_ret = gtk_text_iter_backward_find_char(ref this, GtkSharp.TextCharPredicateWrapper.NativeDelegate, (IntPtr)gch, ref limit);
bool ret = raw_ret;
+ gch.Free();
return ret;
}
diff --git a/gtk/generated/TextTagTable.cs b/gtk/generated/TextTagTable.cs
index 4f16ca03e..4facda4ac 100644
--- a/gtk/generated/TextTagTable.cs
+++ b/gtk/generated/TextTagTable.cs
@@ -216,8 +216,9 @@ namespace Gtk {
public void Foreach(Gtk.TextTagTableForeach func) {
Gtk.Application.AssertMainThread();
- GtkSharp.TextTagTableForeachWrapper func_wrapper = new GtkSharp.TextTagTableForeachWrapper (func);
- gtk_text_tag_table_foreach(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (func);
+ gtk_text_tag_table_foreach(Handle, GtkSharp.TextTagTableForeachWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/TreeModelAdapter.cs b/gtk/generated/TreeModelAdapter.cs
index d044c47a5..5567c4640 100644
--- a/gtk/generated/TreeModelAdapter.cs
+++ b/gtk/generated/TreeModelAdapter.cs
@@ -429,8 +429,9 @@ namespace Gtk {
public void Foreach(Gtk.TreeModelForeachFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeModelForeachFuncWrapper func_wrapper = new GtkSharp.TreeModelForeachFuncWrapper (func);
- gtk_tree_model_foreach(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (func);
+ gtk_tree_model_foreach(Handle, GtkSharp.TreeModelForeachFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/TreeModelFilter.cs b/gtk/generated/TreeModelFilter.cs
index eed71bed9..98817bd70 100644
--- a/gtk/generated/TreeModelFilter.cs
+++ b/gtk/generated/TreeModelFilter.cs
@@ -128,17 +128,16 @@ namespace Gtk {
public Gtk.TreeModelFilterVisibleFunc VisibleFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeModelFilterVisibleFuncWrapper value_wrapper = new GtkSharp.TreeModelFilterVisibleFuncWrapper (value);
IntPtr data;
GLib.DestroyNotify destroy;
if (value == null) {
data = IntPtr.Zero;
destroy = null;
} else {
- data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ data = (IntPtr) GCHandle.Alloc (value);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_model_filter_set_visible_func(Handle, value_wrapper.NativeDelegate, data, destroy);
+ gtk_tree_model_filter_set_visible_func(Handle, GtkSharp.TreeModelFilterVisibleFuncWrapper.NativeDelegate, data, destroy);
}
}
@@ -175,8 +174,9 @@ namespace Gtk {
public void Foreach(Gtk.TreeModelForeachFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeModelForeachFuncWrapper func_wrapper = new GtkSharp.TreeModelForeachFuncWrapper (func);
- gtk_tree_model_foreach(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (func);
+ gtk_tree_model_foreach(Handle, GtkSharp.TreeModelForeachFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -688,12 +688,11 @@ namespace Gtk {
public void SetModifyFunc (int n_columns, GLib.GType[] types, TreeModelFilterModifyFunc func)
{
- GtkSharp.TreeModelFilterModifyFuncWrapper func_wrapper = new GtkSharp.TreeModelFilterModifyFuncWrapper (func);
IntPtr[] native_types = new IntPtr [types.Length];
for (int i = 0; i < types.Length; i++)
native_types [i] = types [i].Val;
- GCHandle gch = GCHandle.Alloc (func_wrapper);
- gtk_tree_model_filter_set_modify_func (Handle, n_columns, native_types, func_wrapper.NativeDelegate, (IntPtr) gch, GLib.DestroyHelper.NotifyHandler);
+ GCHandle gch = GCHandle.Alloc (func);
+ gtk_tree_model_filter_set_modify_func (Handle, n_columns, native_types, GtkSharp.TreeModelFilterModifyFuncWrapper.NativeDelegate, (IntPtr) gch, GLib.DestroyHelper.NotifyHandler);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
diff --git a/gtk/generated/TreeModelSort.cs b/gtk/generated/TreeModelSort.cs
index 175c8be31..0d08ce699 100644
--- a/gtk/generated/TreeModelSort.cs
+++ b/gtk/generated/TreeModelSort.cs
@@ -143,8 +143,9 @@ namespace Gtk {
public void Foreach(Gtk.TreeModelForeachFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeModelForeachFuncWrapper func_wrapper = new GtkSharp.TreeModelForeachFuncWrapper (func);
- gtk_tree_model_foreach(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (func);
+ gtk_tree_model_foreach(Handle, GtkSharp.TreeModelForeachFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -573,17 +574,16 @@ namespace Gtk {
public Gtk.TreeIterCompareFunc DefaultSortFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeIterCompareFuncWrapper value_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (value);
IntPtr user_data;
GLib.DestroyNotify destroy;
if (value == null) {
user_data = IntPtr.Zero;
destroy = null;
} else {
- user_data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ user_data = (IntPtr) GCHandle.Alloc (value);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_sortable_set_default_sort_func(Handle, value_wrapper.NativeDelegate, user_data, destroy);
+ gtk_tree_sortable_set_default_sort_func(Handle, GtkSharp.TreeIterCompareFuncWrapper.NativeDelegate, user_data, destroy);
}
}
@@ -607,17 +607,16 @@ namespace Gtk {
public void SetSortFunc(int sort_column_id, Gtk.TreeIterCompareFunc sort_func) {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func);
IntPtr user_data;
GLib.DestroyNotify destroy;
if (sort_func == null) {
user_data = IntPtr.Zero;
destroy = null;
} else {
- user_data = (IntPtr) GCHandle.Alloc (sort_func_wrapper);
+ user_data = (IntPtr) GCHandle.Alloc (sort_func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_sortable_set_sort_func(Handle, sort_column_id, sort_func_wrapper.NativeDelegate, user_data, destroy);
+ gtk_tree_sortable_set_sort_func(Handle, sort_column_id, GtkSharp.TreeIterCompareFuncWrapper.NativeDelegate, user_data, destroy);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/TreeSelection.cs b/gtk/generated/TreeSelection.cs
index 03e37fe7a..482f574d8 100644
--- a/gtk/generated/TreeSelection.cs
+++ b/gtk/generated/TreeSelection.cs
@@ -110,8 +110,9 @@ namespace Gtk {
public void SelectedForeach(Gtk.TreeSelectionForeachFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeSelectionForeachFuncWrapper func_wrapper = new GtkSharp.TreeSelectionForeachFuncWrapper (func);
- gtk_tree_selection_selected_foreach(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (func);
+ gtk_tree_selection_selected_foreach(Handle, GtkSharp.TreeSelectionForeachFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -149,17 +150,16 @@ namespace Gtk {
public Gtk.TreeSelectionFunc SelectFunction {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeSelectionFuncWrapper value_wrapper = new GtkSharp.TreeSelectionFuncWrapper (value);
IntPtr data;
GLib.DestroyNotify destroy;
if (value == null) {
data = IntPtr.Zero;
destroy = null;
} else {
- data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ data = (IntPtr) GCHandle.Alloc (value);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_selection_set_select_function(Handle, value_wrapper.NativeDelegate, data, destroy);
+ gtk_tree_selection_set_select_function(Handle, GtkSharp.TreeSelectionFuncWrapper.NativeDelegate, data, destroy);
}
}
diff --git a/gtk/generated/TreeSortableAdapter.cs b/gtk/generated/TreeSortableAdapter.cs
index b7114894c..9bb400630 100644
--- a/gtk/generated/TreeSortableAdapter.cs
+++ b/gtk/generated/TreeSortableAdapter.cs
@@ -213,17 +213,16 @@ namespace Gtk {
public Gtk.TreeIterCompareFunc DefaultSortFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeIterCompareFuncWrapper value_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (value);
IntPtr user_data;
GLib.DestroyNotify destroy;
if (value == null) {
user_data = IntPtr.Zero;
destroy = null;
} else {
- user_data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ user_data = (IntPtr) GCHandle.Alloc (value);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_sortable_set_default_sort_func(Handle, value_wrapper.NativeDelegate, user_data, destroy);
+ gtk_tree_sortable_set_default_sort_func(Handle, GtkSharp.TreeIterCompareFuncWrapper.NativeDelegate, user_data, destroy);
}
}
@@ -247,17 +246,16 @@ namespace Gtk {
public void SetSortFunc(int sort_column_id, Gtk.TreeIterCompareFunc sort_func) {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func);
IntPtr user_data;
GLib.DestroyNotify destroy;
if (sort_func == null) {
user_data = IntPtr.Zero;
destroy = null;
} else {
- user_data = (IntPtr) GCHandle.Alloc (sort_func_wrapper);
+ user_data = (IntPtr) GCHandle.Alloc (sort_func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_sortable_set_sort_func(Handle, sort_column_id, sort_func_wrapper.NativeDelegate, user_data, destroy);
+ gtk_tree_sortable_set_sort_func(Handle, sort_column_id, GtkSharp.TreeIterCompareFuncWrapper.NativeDelegate, user_data, destroy);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/TreeStore.cs b/gtk/generated/TreeStore.cs
index 802f28de0..f2b440d26 100644
--- a/gtk/generated/TreeStore.cs
+++ b/gtk/generated/TreeStore.cs
@@ -158,8 +158,9 @@ namespace Gtk {
public void Foreach(Gtk.TreeModelForeachFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeModelForeachFuncWrapper func_wrapper = new GtkSharp.TreeModelForeachFuncWrapper (func);
- gtk_tree_model_foreach(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (func);
+ gtk_tree_model_foreach(Handle, GtkSharp.TreeModelForeachFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -638,17 +639,16 @@ namespace Gtk {
public Gtk.TreeIterCompareFunc DefaultSortFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeIterCompareFuncWrapper value_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (value);
IntPtr user_data;
GLib.DestroyNotify destroy;
if (value == null) {
user_data = IntPtr.Zero;
destroy = null;
} else {
- user_data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ user_data = (IntPtr) GCHandle.Alloc (value);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_sortable_set_default_sort_func(Handle, value_wrapper.NativeDelegate, user_data, destroy);
+ gtk_tree_sortable_set_default_sort_func(Handle, GtkSharp.TreeIterCompareFuncWrapper.NativeDelegate, user_data, destroy);
}
}
@@ -672,17 +672,16 @@ namespace Gtk {
public void SetSortFunc(int sort_column_id, Gtk.TreeIterCompareFunc sort_func) {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeIterCompareFuncWrapper sort_func_wrapper = new GtkSharp.TreeIterCompareFuncWrapper (sort_func);
IntPtr user_data;
GLib.DestroyNotify destroy;
if (sort_func == null) {
user_data = IntPtr.Zero;
destroy = null;
} else {
- user_data = (IntPtr) GCHandle.Alloc (sort_func_wrapper);
+ user_data = (IntPtr) GCHandle.Alloc (sort_func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_sortable_set_sort_func(Handle, sort_column_id, sort_func_wrapper.NativeDelegate, user_data, destroy);
+ gtk_tree_sortable_set_sort_func(Handle, sort_column_id, GtkSharp.TreeIterCompareFuncWrapper.NativeDelegate, user_data, destroy);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/TreeView.cs b/gtk/generated/TreeView.cs
index 95b4793db..c7d673b03 100644
--- a/gtk/generated/TreeView.cs
+++ b/gtk/generated/TreeView.cs
@@ -1181,22 +1181,21 @@ namespace Gtk {
public Gtk.TreeViewSearchEqualFunc SearchEqualFunc {
get {
GtkSharp.TreeViewSearchEqualFuncNative raw_ret = gtk_tree_view_get_search_equal_func(Handle);
- Gtk.TreeViewSearchEqualFunc ret = GtkSharp.TreeViewSearchEqualFuncWrapper.GetManagedDelegate (raw_ret);
+ Gtk.TreeViewSearchEqualFunc ret = new GtkSharp.TreeViewSearchEqualFuncInvoker (raw_ret).Handler;
return ret;
}
set {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeViewSearchEqualFuncWrapper value_wrapper = new GtkSharp.TreeViewSearchEqualFuncWrapper (value);
IntPtr search_user_data;
GLib.DestroyNotify search_destroy;
if (value == null) {
search_user_data = IntPtr.Zero;
search_destroy = null;
} else {
- search_user_data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ search_user_data = (IntPtr) GCHandle.Alloc (value);
search_destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_view_set_search_equal_func(Handle, value_wrapper.NativeDelegate, search_user_data, search_destroy);
+ gtk_tree_view_set_search_equal_func(Handle, GtkSharp.TreeViewSearchEqualFuncWrapper.NativeDelegate, search_user_data, search_destroy);
}
}
@@ -1274,17 +1273,16 @@ namespace Gtk {
public Gtk.TreeDestroyCountFunc DestroyCountFunc {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeDestroyCountFuncWrapper value_wrapper = new GtkSharp.TreeDestroyCountFuncWrapper (value);
IntPtr data;
GLib.DestroyNotify destroy;
if (value == null) {
data = IntPtr.Zero;
destroy = null;
} else {
- data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ data = (IntPtr) GCHandle.Alloc (value);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_view_set_destroy_count_func(Handle, value_wrapper.NativeDelegate, data, destroy);
+ gtk_tree_view_set_destroy_count_func(Handle, GtkSharp.TreeDestroyCountFuncWrapper.NativeDelegate, data, destroy);
}
}
@@ -1341,22 +1339,21 @@ namespace Gtk {
public Gtk.TreeViewSearchPositionFunc SearchPositionFunc {
get {
GtkSharp.TreeViewSearchPositionFuncNative raw_ret = gtk_tree_view_get_search_position_func(Handle);
- Gtk.TreeViewSearchPositionFunc ret = GtkSharp.TreeViewSearchPositionFuncWrapper.GetManagedDelegate (raw_ret);
+ Gtk.TreeViewSearchPositionFunc ret = new GtkSharp.TreeViewSearchPositionFuncInvoker (raw_ret).Handler;
return ret;
}
set {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeViewSearchPositionFuncWrapper value_wrapper = new GtkSharp.TreeViewSearchPositionFuncWrapper (value);
IntPtr data;
GLib.DestroyNotify destroy;
if (value == null) {
data = IntPtr.Zero;
destroy = null;
} else {
- data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ data = (IntPtr) GCHandle.Alloc (value);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_view_set_search_position_func(Handle, value_wrapper.NativeDelegate, data, destroy);
+ gtk_tree_view_set_search_position_func(Handle, GtkSharp.TreeViewSearchPositionFuncWrapper.NativeDelegate, data, destroy);
}
}
@@ -1450,17 +1447,16 @@ namespace Gtk {
public Gtk.TreeViewColumnDropFunc ColumnDragFunction {
set {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeViewColumnDropFuncWrapper value_wrapper = new GtkSharp.TreeViewColumnDropFuncWrapper (value);
IntPtr user_data;
GLib.DestroyNotify destroy;
if (value == null) {
user_data = IntPtr.Zero;
destroy = null;
} else {
- user_data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ user_data = (IntPtr) GCHandle.Alloc (value);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_view_set_column_drag_function(Handle, value_wrapper.NativeDelegate, user_data, destroy);
+ gtk_tree_view_set_column_drag_function(Handle, GtkSharp.TreeViewColumnDropFuncWrapper.NativeDelegate, user_data, destroy);
}
}
@@ -1528,22 +1524,21 @@ namespace Gtk {
public Gtk.TreeViewRowSeparatorFunc RowSeparatorFunc {
get {
GtkSharp.TreeViewRowSeparatorFuncNative raw_ret = gtk_tree_view_get_row_separator_func(Handle);
- Gtk.TreeViewRowSeparatorFunc ret = GtkSharp.TreeViewRowSeparatorFuncWrapper.GetManagedDelegate (raw_ret);
+ Gtk.TreeViewRowSeparatorFunc ret = new GtkSharp.TreeViewRowSeparatorFuncInvoker (raw_ret).Handler;
return ret;
}
set {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeViewRowSeparatorFuncWrapper value_wrapper = new GtkSharp.TreeViewRowSeparatorFuncWrapper (value);
IntPtr data;
GLib.DestroyNotify destroy;
if (value == null) {
data = IntPtr.Zero;
destroy = null;
} else {
- data = (IntPtr) GCHandle.Alloc (value_wrapper);
+ data = (IntPtr) GCHandle.Alloc (value);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_view_set_row_separator_func(Handle, value_wrapper.NativeDelegate, data, destroy);
+ gtk_tree_view_set_row_separator_func(Handle, GtkSharp.TreeViewRowSeparatorFuncWrapper.NativeDelegate, data, destroy);
}
}
@@ -1658,8 +1653,9 @@ namespace Gtk {
public void MapExpandedRows(Gtk.TreeViewMappingFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeViewMappingFuncWrapper func_wrapper = new GtkSharp.TreeViewMappingFuncWrapper (func);
- gtk_tree_view_map_expanded_rows(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (func);
+ gtk_tree_view_map_expanded_rows(Handle, GtkSharp.TreeViewMappingFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/gtk/generated/TreeViewColumn.cs b/gtk/generated/TreeViewColumn.cs
index 46d969056..8cd6acd77 100644
--- a/gtk/generated/TreeViewColumn.cs
+++ b/gtk/generated/TreeViewColumn.cs
@@ -476,17 +476,16 @@ namespace Gtk {
public void SetCellDataFunc(Gtk.CellRenderer cell_renderer, Gtk.TreeCellDataFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.TreeCellDataFuncWrapper func_wrapper = new GtkSharp.TreeCellDataFuncWrapper (func);
IntPtr func_data;
GLib.DestroyNotify destroy;
if (func == null) {
func_data = IntPtr.Zero;
destroy = null;
} else {
- func_data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ func_data = (IntPtr) GCHandle.Alloc (func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_tree_view_column_set_cell_data_func(Handle, cell_renderer == null ? IntPtr.Zero : cell_renderer.Handle, func_wrapper.NativeDelegate, func_data, destroy);
+ gtk_tree_view_column_set_cell_data_func(Handle, cell_renderer == null ? IntPtr.Zero : cell_renderer.Handle, GtkSharp.TreeCellDataFuncWrapper.NativeDelegate, func_data, destroy);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -546,17 +545,16 @@ namespace Gtk {
public void SetCellDataFunc(Gtk.CellRenderer cell, Gtk.CellLayoutDataFunc func) {
Gtk.Application.AssertMainThread();
- GtkSharp.CellLayoutDataFuncWrapper func_wrapper = new GtkSharp.CellLayoutDataFuncWrapper (func);
IntPtr func_data;
GLib.DestroyNotify destroy;
if (func == null) {
func_data = IntPtr.Zero;
destroy = null;
} else {
- func_data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ func_data = (IntPtr) GCHandle.Alloc (func);
destroy = GLib.DestroyHelper.NotifyHandler;
}
- gtk_cell_layout_set_cell_data_func(Handle, cell == null ? IntPtr.Zero : cell.Handle, func_wrapper.NativeDelegate, func_data, destroy);
+ gtk_cell_layout_set_cell_data_func(Handle, cell == null ? IntPtr.Zero : cell.Handle, GtkSharp.CellLayoutDataFuncWrapper.NativeDelegate, func_data, destroy);
}
[DllImport("libgtk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
diff --git a/pango/generated/AttrList.cs b/pango/generated/AttrList.cs
index adaf2bf25..62dd044cf 100644
--- a/pango/generated/AttrList.cs
+++ b/pango/generated/AttrList.cs
@@ -59,9 +59,10 @@ namespace Pango {
static extern IntPtr pango_attr_list_filter(IntPtr raw, PangoSharp.AttrFilterFuncNative func, IntPtr data);
public Pango.AttrList Filter(Pango.AttrFilterFunc func) {
- PangoSharp.AttrFilterFuncWrapper func_wrapper = new PangoSharp.AttrFilterFuncWrapper (func);
- IntPtr raw_ret = pango_attr_list_filter(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (func);
+ IntPtr raw_ret = pango_attr_list_filter(Handle, PangoSharp.AttrFilterFuncWrapper.NativeDelegate, (IntPtr)gch);
Pango.AttrList ret = raw_ret == IntPtr.Zero ? null : (Pango.AttrList) GLib.Opaque.GetOpaque (raw_ret, typeof (Pango.AttrList), false);
+ gch.Free();
return ret;
}
diff --git a/pango/generated/CairoHelper.cs b/pango/generated/CairoHelper.cs
index f08f96c63..084dfa2cb 100644
--- a/pango/generated/CairoHelper.cs
+++ b/pango/generated/CairoHelper.cs
@@ -48,17 +48,16 @@ namespace Pango {
static extern void pango_cairo_context_set_shape_renderer(IntPtr context, PangoSharp.CairoShapeRendererFuncNative func, IntPtr data, GLib.DestroyNotify dnotify);
public static void ContextSetShapeRenderer(Pango.Context context, Pango.CairoShapeRendererFunc func) {
- PangoSharp.CairoShapeRendererFuncWrapper func_wrapper = new PangoSharp.CairoShapeRendererFuncWrapper (func);
IntPtr data;
GLib.DestroyNotify dnotify;
if (func == null) {
data = IntPtr.Zero;
dnotify = null;
} else {
- data = (IntPtr) GCHandle.Alloc (func_wrapper);
+ data = (IntPtr) GCHandle.Alloc (func);
dnotify = GLib.DestroyHelper.NotifyHandler;
}
- pango_cairo_context_set_shape_renderer(context == null ? IntPtr.Zero : context.Handle, func_wrapper.NativeDelegate, data, dnotify);
+ pango_cairo_context_set_shape_renderer(context == null ? IntPtr.Zero : context.Handle, PangoSharp.CairoShapeRendererFuncWrapper.NativeDelegate, data, dnotify);
}
[DllImport("libpangocairo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@@ -96,7 +95,7 @@ namespace Pango {
public static Pango.CairoShapeRendererFunc ContextGetShapeRenderer(Pango.Context context, IntPtr data) {
PangoSharp.CairoShapeRendererFuncNative raw_ret = pango_cairo_context_get_shape_renderer(context == null ? IntPtr.Zero : context.Handle, data);
- Pango.CairoShapeRendererFunc ret = PangoSharp.CairoShapeRendererFuncWrapper.GetManagedDelegate (raw_ret);
+ Pango.CairoShapeRendererFunc ret = new PangoSharp.CairoShapeRendererFuncInvoker (raw_ret).Handler;
return ret;
}
diff --git a/pango/generated/Fontset.cs b/pango/generated/Fontset.cs
index 448770e0f..b521550f4 100644
--- a/pango/generated/Fontset.cs
+++ b/pango/generated/Fontset.cs
@@ -54,8 +54,9 @@ namespace Pango {
static extern void pango_fontset_foreach(IntPtr raw, PangoSharp.FontsetForeachFuncNative func, IntPtr data);
public void Foreach(Pango.FontsetForeachFunc func) {
- PangoSharp.FontsetForeachFuncWrapper func_wrapper = new PangoSharp.FontsetForeachFuncWrapper (func);
- pango_fontset_foreach(Handle, func_wrapper.NativeDelegate, IntPtr.Zero);
+ GCHandle gch = GCHandle.Alloc (func);
+ pango_fontset_foreach(Handle, PangoSharp.FontsetForeachFuncWrapper.NativeDelegate, (IntPtr)gch);
+ gch.Free();
}
#endregion
diff --git a/pango/generated/PangoSharp.AttrDataCopyFuncNative.cs b/pango/generated/PangoSharp.AttrDataCopyFuncNative.cs
index 7a9d2c312..43bb09941 100644
--- a/pango/generated/PangoSharp.AttrDataCopyFuncNative.cs
+++ b/pango/generated/PangoSharp.AttrDataCopyFuncNative.cs
@@ -10,51 +10,14 @@ namespace PangoSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate IntPtr AttrDataCopyFuncNative(IntPtr data);
- internal class AttrDataCopyFuncInvoker {
+ internal static class AttrDataCopyFuncWrapper {
- AttrDataCopyFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~AttrDataCopyFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal AttrDataCopyFuncInvoker (AttrDataCopyFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal AttrDataCopyFuncInvoker (AttrDataCopyFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal AttrDataCopyFuncInvoker (AttrDataCopyFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Pango.AttrDataCopyFunc Handler {
- get {
- return new Pango.AttrDataCopyFunc(InvokeNative);
- }
- }
-
- IntPtr InvokeNative ()
- {
- IntPtr result = native_cb (__data);
- return result;
- }
- }
-
- internal class AttrDataCopyFuncWrapper {
-
- public IntPtr NativeCallback (IntPtr data)
+ public static IntPtr NativeCallback (IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Pango.AttrDataCopyFunc)gch.Target;
IntPtr __ret = managed ();
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
@@ -63,34 +26,8 @@ namespace PangoSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal AttrDataCopyFuncNative NativeDelegate;
- Pango.AttrDataCopyFunc managed;
-
- public AttrDataCopyFuncWrapper (Pango.AttrDataCopyFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new AttrDataCopyFuncNative (NativeCallback);
- }
-
- public static Pango.AttrDataCopyFunc GetManagedDelegate (AttrDataCopyFuncNative native)
- {
- if (native == null)
- return null;
- AttrDataCopyFuncWrapper wrapper = (AttrDataCopyFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly AttrDataCopyFuncNative NativeDelegate = new AttrDataCopyFuncNative (NativeCallback);
}
#endregion
}
diff --git a/pango/generated/PangoSharp.AttrFilterFuncNative.cs b/pango/generated/PangoSharp.AttrFilterFuncNative.cs
index 1b5c4f4ef..1a55115fb 100644
--- a/pango/generated/PangoSharp.AttrFilterFuncNative.cs
+++ b/pango/generated/PangoSharp.AttrFilterFuncNative.cs
@@ -10,51 +10,14 @@ namespace PangoSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool AttrFilterFuncNative(IntPtr attribute, IntPtr data);
- internal class AttrFilterFuncInvoker {
+ internal static class AttrFilterFuncWrapper {
- AttrFilterFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~AttrFilterFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal AttrFilterFuncInvoker (AttrFilterFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal AttrFilterFuncInvoker (AttrFilterFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal AttrFilterFuncInvoker (AttrFilterFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Pango.AttrFilterFunc Handler {
- get {
- return new Pango.AttrFilterFunc(InvokeNative);
- }
- }
-
- bool InvokeNative (Pango.Attribute attribute)
- {
- bool result = native_cb (attribute.Handle, __data);
- return result;
- }
- }
-
- internal class AttrFilterFuncWrapper {
-
- public bool NativeCallback (IntPtr attribute, IntPtr data)
+ public static bool NativeCallback (IntPtr attribute, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Pango.AttrFilterFunc)gch.Target;
bool __ret = managed (Pango.Attribute.GetAttribute (attribute));
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -62,34 +25,8 @@ namespace PangoSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal AttrFilterFuncNative NativeDelegate;
- Pango.AttrFilterFunc managed;
-
- public AttrFilterFuncWrapper (Pango.AttrFilterFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new AttrFilterFuncNative (NativeCallback);
- }
-
- public static Pango.AttrFilterFunc GetManagedDelegate (AttrFilterFuncNative native)
- {
- if (native == null)
- return null;
- AttrFilterFuncWrapper wrapper = (AttrFilterFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly AttrFilterFuncNative NativeDelegate = new AttrFilterFuncNative (NativeCallback);
}
#endregion
}
diff --git a/pango/generated/PangoSharp.CairoShapeRendererFuncNative.cs b/pango/generated/PangoSharp.CairoShapeRendererFuncNative.cs
index 3272116d6..f1e4a3a21 100644
--- a/pango/generated/PangoSharp.CairoShapeRendererFuncNative.cs
+++ b/pango/generated/PangoSharp.CairoShapeRendererFuncNative.cs
@@ -46,47 +46,21 @@ namespace PangoSharp {
}
}
- internal class CairoShapeRendererFuncWrapper {
+ internal static class CairoShapeRendererFuncWrapper {
- public void NativeCallback (IntPtr cr, IntPtr attr, bool do_path, IntPtr data)
+ public static void NativeCallback (IntPtr cr, IntPtr attr, bool do_path, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Pango.CairoShapeRendererFunc)gch.Target;
managed (new Cairo.Context(cr), Pango.Attribute.GetAttribute (attr), do_path);
- if (release_on_call)
- gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
- bool release_on_call = false;
- GCHandle gch;
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
-
- internal CairoShapeRendererFuncNative NativeDelegate;
- Pango.CairoShapeRendererFunc managed;
-
- public CairoShapeRendererFuncWrapper (Pango.CairoShapeRendererFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new CairoShapeRendererFuncNative (NativeCallback);
- }
-
- public static Pango.CairoShapeRendererFunc GetManagedDelegate (CairoShapeRendererFuncNative native)
- {
- if (native == null)
- return null;
- CairoShapeRendererFuncWrapper wrapper = (CairoShapeRendererFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly CairoShapeRendererFuncNative NativeDelegate = new CairoShapeRendererFuncNative (NativeCallback);
}
#endregion
}
diff --git a/pango/generated/PangoSharp.FontsetForeachFuncNative.cs b/pango/generated/PangoSharp.FontsetForeachFuncNative.cs
index dbb94361e..5e75afc0c 100644
--- a/pango/generated/PangoSharp.FontsetForeachFuncNative.cs
+++ b/pango/generated/PangoSharp.FontsetForeachFuncNative.cs
@@ -10,51 +10,14 @@ namespace PangoSharp {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool FontsetForeachFuncNative(IntPtr fontset, IntPtr font, IntPtr data);
- internal class FontsetForeachFuncInvoker {
+ internal static class FontsetForeachFuncWrapper {
- FontsetForeachFuncNative native_cb;
- IntPtr __data;
- GLib.DestroyNotify __notify;
-
- ~FontsetForeachFuncInvoker ()
- {
- if (__notify == null)
- return;
- __notify (__data);
- }
-
- internal FontsetForeachFuncInvoker (FontsetForeachFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
-
- internal FontsetForeachFuncInvoker (FontsetForeachFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
-
- internal FontsetForeachFuncInvoker (FontsetForeachFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
- {
- this.native_cb = native_cb;
- __data = data;
- __notify = notify;
- }
-
- internal Pango.FontsetForeachFunc Handler {
- get {
- return new Pango.FontsetForeachFunc(InvokeNative);
- }
- }
-
- bool InvokeNative (Pango.Fontset fontset, Pango.Font font)
- {
- bool result = native_cb (fontset == null ? IntPtr.Zero : fontset.Handle, font == null ? IntPtr.Zero : font.Handle, __data);
- return result;
- }
- }
-
- internal class FontsetForeachFuncWrapper {
-
- public bool NativeCallback (IntPtr fontset, IntPtr font, IntPtr data)
+ public static bool NativeCallback (IntPtr fontset, IntPtr font, IntPtr data)
{
try {
+ var gch = (GCHandle)data;
+ var managed = (Pango.FontsetForeachFunc)gch.Target;
bool __ret = managed (GLib.Object.GetObject(fontset) as Pango.Fontset, GLib.Object.GetObject(font) as Pango.Font);
- if (release_on_call)
- gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
@@ -62,34 +25,8 @@ namespace PangoSharp {
}
}
- bool release_on_call = false;
- GCHandle gch;
-
- public void PersistUntilCalled ()
- {
- release_on_call = true;
- gch = GCHandle.Alloc (this);
- }
- internal FontsetForeachFuncNative NativeDelegate;
- Pango.FontsetForeachFunc managed;
-
- public FontsetForeachFuncWrapper (Pango.FontsetForeachFunc managed)
- {
- this.managed = managed;
- if (managed != null)
- NativeDelegate = new FontsetForeachFuncNative (NativeCallback);
- }
-
- public static Pango.FontsetForeachFunc GetManagedDelegate (FontsetForeachFuncNative native)
- {
- if (native == null)
- return null;
- FontsetForeachFuncWrapper wrapper = (FontsetForeachFuncWrapper) native.Target;
- if (wrapper == null)
- return null;
- return wrapper.managed;
- }
+ internal static readonly FontsetForeachFuncNative NativeDelegate = new FontsetForeachFuncNative (NativeCallback);
}
#endregion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment