// 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 FileMeasureProgressCallbackNative(bool reporting, ulong current_size, ulong num_dirs, ulong num_files, IntPtr user_data); internal class FileMeasureProgressCallbackInvoker { FileMeasureProgressCallbackNative native_cb; IntPtr __data; GLib.DestroyNotify __notify; ~FileMeasureProgressCallbackInvoker () { if (__notify == null) return; __notify (__data); } internal FileMeasureProgressCallbackInvoker (FileMeasureProgressCallbackNative native_cb) : this (native_cb, IntPtr.Zero, null) {} internal FileMeasureProgressCallbackInvoker (FileMeasureProgressCallbackNative native_cb, IntPtr data) : this (native_cb, data, null) {} internal FileMeasureProgressCallbackInvoker (FileMeasureProgressCallbackNative native_cb, IntPtr data, GLib.DestroyNotify notify) { this.native_cb = native_cb; __data = data; __notify = notify; } internal GLib.FileMeasureProgressCallback Handler { get { return new GLib.FileMeasureProgressCallback(InvokeNative); } } void InvokeNative (bool reporting, ulong current_size, ulong num_dirs, ulong num_files) { native_cb (reporting, current_size, num_dirs, num_files, __data); } } internal class FileMeasureProgressCallbackWrapper { public void NativeCallback (bool reporting, ulong current_size, ulong num_dirs, ulong num_files, IntPtr user_data) { try { managed (reporting, current_size, num_dirs, num_files); 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 FileMeasureProgressCallbackNative NativeDelegate; GLib.FileMeasureProgressCallback managed; public FileMeasureProgressCallbackWrapper (GLib.FileMeasureProgressCallback managed) { this.managed = managed; if (managed != null) NativeDelegate = new FileMeasureProgressCallbackNative (NativeCallback); } public static GLib.FileMeasureProgressCallback GetManagedDelegate (FileMeasureProgressCallbackNative native) { if (native == null) return null; FileMeasureProgressCallbackWrapper wrapper = (FileMeasureProgressCallbackWrapper) native.Target; if (wrapper == null) return null; return wrapper.managed; } } #endregion }