Files
KioskApp/GtkSharp/Source/Libs/GioSharp/Generated/GLib/GLibSharp.SpawnChildSetupFuncNative.cs
2024-09-15 22:40:48 +02:00

92 lines
2.1 KiB
C#

// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace GLibSharp {
using System;
using System.Runtime.InteropServices;
#region Autogenerated code
internal delegate void SpawnChildSetupFuncNative(IntPtr data);
internal class SpawnChildSetupFuncInvoker {
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)
{
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 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;
}
}
#endregion
}