context: // This file was generated by the Gtk# code generator.
  // Any changes made will be lost if regenerated.
  
  namespace GLib {
  
  	using System;
  	using System.Collections;
  	using System.Collections.Generic;
  	using System.Runtime.InteropServices;
  
  #region Autogenerated code
  	public partial class FileEnumerator : GLib.Object {
  
  		public FileEnumerator (IntPtr raw) : base(raw) {}
  
  		protected FileEnumerator() : base(IntPtr.Zero)
  		{
  			CreateNativeObject (new string [0], new GLib.Value [0]);
  		}
  
  		static NextFileNativeDelegate NextFile_cb_delegate;
  		static NextFileNativeDelegate NextFileVMCallback {
  			get {
  				if (NextFile_cb_delegate == null)
  					NextFile_cb_delegate = new NextFileNativeDelegate (NextFile_cb);
  				return NextFile_cb_delegate;
  			}
  		}
  
  		static void OverrideNextFile (GLib.GType gtype)
  		{
  			OverrideNextFile (gtype, NextFileVMCallback);
  		}
  
  		static void OverrideNextFile (GLib.GType gtype, NextFileNativeDelegate callback)
  		{
  			GFileEnumeratorClass class_iface = GetClassStruct (gtype, false);
  			class_iface.NextFile = callback;
  			OverrideClassStruct (gtype, class_iface);
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate IntPtr NextFileNativeDelegate (IntPtr inst, IntPtr cancellable, out IntPtr error);
  
  		static IntPtr NextFile_cb (IntPtr inst, IntPtr cancellable, out IntPtr error)
  		{
  			error = IntPtr.Zero;
  
  			try {
  				FileEnumerator __obj = GLib.Object.GetObject (inst, false) as FileEnumerator;
  				GLib.FileInfo __result;
  				__result = __obj.OnNextFile (GLib.Object.GetObject(cancellable) as GLib.Cancellable);
  				return __result == null ? IntPtr.Zero : __result.Handle;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[GLib.DefaultSignalHandler(Type=typeof(GLib.FileEnumerator), ConnectionMethod="OverrideNextFile")]
  		protected virtual GLib.FileInfo OnNextFile (GLib.Cancellable cancellable)
  		{
  			return InternalNextFile (cancellable);
  		}
  
  		private GLib.FileInfo InternalNextFile (GLib.Cancellable cancellable)
  		{
  			NextFileNativeDelegate unmanaged = GetClassStruct (this.LookupGType ().GetThresholdType (), true).NextFile;
  			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");
  
  			IntPtr error = IntPtr.Zero;
  			IntPtr __result = unmanaged (this.Handle, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
  			return GLib.Object.GetObject(__result) as GLib.FileInfo;
  		}
  
  		static CloseFnNativeDelegate CloseFn_cb_delegate;
  		static CloseFnNativeDelegate CloseFnVMCallback {
  			get {
  				if (CloseFn_cb_delegate == null)
  					CloseFn_cb_delegate = new CloseFnNativeDelegate (CloseFn_cb);
  				return CloseFn_cb_delegate;
  			}
  		}
  
  		static void OverrideCloseFn (GLib.GType gtype)
  		{
  			OverrideCloseFn (gtype, CloseFnVMCallback);
  		}
  
  		static void OverrideCloseFn (GLib.GType gtype, CloseFnNativeDelegate callback)
  		{
  			GFileEnumeratorClass class_iface = GetClassStruct (gtype, false);
  			class_iface.CloseFn = callback;
  			OverrideClassStruct (gtype, class_iface);
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate bool CloseFnNativeDelegate (IntPtr inst, IntPtr cancellable, out IntPtr error);
  
  		static bool CloseFn_cb (IntPtr inst, IntPtr cancellable, out IntPtr error)
  		{
  			error = IntPtr.Zero;
  
  			try {
  				FileEnumerator __obj = GLib.Object.GetObject (inst, false) as FileEnumerator;
  				bool __result;
  				__result = __obj.OnCloseFn (GLib.Object.GetObject(cancellable) as GLib.Cancellable);
  				return __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[GLib.DefaultSignalHandler(Type=typeof(GLib.FileEnumerator), ConnectionMethod="OverrideCloseFn")]
  		protected virtual bool OnCloseFn (GLib.Cancellable cancellable)
  		{
  			return InternalCloseFn (cancellable);
  		}
  
  		private bool InternalCloseFn (GLib.Cancellable cancellable)
  		{
  			CloseFnNativeDelegate unmanaged = GetClassStruct (this.LookupGType ().GetThresholdType (), true).CloseFn;
  			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");
  
  			IntPtr error = IntPtr.Zero;
  			bool __result = unmanaged (this.Handle, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
  			return __result;
  		}
  
  		static NextFilesAsyncNativeDelegate NextFilesAsync_cb_delegate;
  		static NextFilesAsyncNativeDelegate NextFilesAsyncVMCallback {
  			get {
  				if (NextFilesAsync_cb_delegate == null)
  					NextFilesAsync_cb_delegate = new NextFilesAsyncNativeDelegate (NextFilesAsync_cb);
  				return NextFilesAsync_cb_delegate;
  			}
  		}
  
  		static void OverrideNextFilesAsync (GLib.GType gtype)
  		{
  			OverrideNextFilesAsync (gtype, NextFilesAsyncVMCallback);
  		}
  
  		static void OverrideNextFilesAsync (GLib.GType gtype, NextFilesAsyncNativeDelegate callback)
  		{
  			GFileEnumeratorClass class_iface = GetClassStruct (gtype, false);
  			class_iface.NextFilesAsync = callback;
  			OverrideClassStruct (gtype, class_iface);
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate void NextFilesAsyncNativeDelegate (IntPtr inst, int num_files, int io_priority, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
  
  		static void NextFilesAsync_cb (IntPtr inst, int num_files, int io_priority, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data)
  		{
  			try {
  				FileEnumerator __obj = GLib.Object.GetObject (inst, false) as FileEnumerator;
  				GLibSharp.AsyncReadyCallbackInvoker cb_invoker = new GLibSharp.AsyncReadyCallbackInvoker (cb, user_data);
  				__obj.OnNextFilesAsync (num_files, io_priority, GLib.Object.GetObject(cancellable) as GLib.Cancellable, cb_invoker.Handler);
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, false);
  			}
  		}
  
  		[GLib.DefaultSignalHandler(Type=typeof(GLib.FileEnumerator), ConnectionMethod="OverrideNextFilesAsync")]
  		protected virtual void OnNextFilesAsync (int num_files, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
  		{
  			InternalNextFilesAsync (num_files, io_priority, cancellable, cb);
  		}
  
  		private void InternalNextFilesAsync (int num_files, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
  		{
  			NextFilesAsyncNativeDelegate unmanaged = GetClassStruct (this.LookupGType ().GetThresholdType (), true).NextFilesAsync;
  			if (unmanaged == null) return;
  
  			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
  			cb_wrapper.PersistUntilCalled ();
  			unmanaged (this.Handle, num_files, io_priority, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
  		}
  
  		static NextFilesFinishNativeDelegate NextFilesFinish_cb_delegate;
  		static NextFilesFinishNativeDelegate NextFilesFinishVMCallback {
  			get {
  				if (NextFilesFinish_cb_delegate == null)
  					NextFilesFinish_cb_delegate = new NextFilesFinishNativeDelegate (NextFilesFinish_cb);
  				return NextFilesFinish_cb_delegate;
  			}
  		}
  
  		static void OverrideNextFilesFinish (GLib.GType gtype)
  		{
  			OverrideNextFilesFinish (gtype, NextFilesFinishVMCallback);
  		}
  
  		static void OverrideNextFilesFinish (GLib.GType gtype, NextFilesFinishNativeDelegate callback)
  		{
  			GFileEnumeratorClass class_iface = GetClassStruct (gtype, false);
  			class_iface.NextFilesFinish = callback;
  			OverrideClassStruct (gtype, class_iface);
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate IntPtr NextFilesFinishNativeDelegate (IntPtr inst, IntPtr result, out IntPtr error);
  
  		static IntPtr NextFilesFinish_cb (IntPtr inst, IntPtr result, out IntPtr error)
  		{
  			error = IntPtr.Zero;
  
  			try {
  				FileEnumerator __obj = GLib.Object.GetObject (inst, false) as FileEnumerator;
  				GLib.FileInfo[] __result;
  				__result = __obj.OnNextFilesFinish (GLib.AsyncResultAdapter.GetObject (result, false));
  				return new GLib.List(__result, typeof (GLib.FileInfo), true, true) == null ? IntPtr.Zero : new GLib.List(__result, typeof (GLib.FileInfo), true, true).Handle;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[GLib.DefaultSignalHandler(Type=typeof(GLib.FileEnumerator), ConnectionMethod="OverrideNextFilesFinish")]
  		protected virtual GLib.FileInfo[] OnNextFilesFinish (GLib.IAsyncResult result)
  		{
  			return InternalNextFilesFinish (result);
  		}
  
  		private GLib.FileInfo[] InternalNextFilesFinish (GLib.IAsyncResult result)
  		{
  			NextFilesFinishNativeDelegate unmanaged = GetClassStruct (this.LookupGType ().GetThresholdType (), true).NextFilesFinish;
  			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");
  
  			IntPtr error = IntPtr.Zero;
  			IntPtr __result = unmanaged (this.Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
  			return (GLib.FileInfo[]) GLib.Marshaller.ListPtrToArray (__result, typeof(GLib.List), true, true, typeof(GLib.FileInfo));
  		}
  
  		static CloseAsyncNativeDelegate CloseAsync_cb_delegate;
  		static CloseAsyncNativeDelegate CloseAsyncVMCallback {
  			get {
  				if (CloseAsync_cb_delegate == null)
  					CloseAsync_cb_delegate = new CloseAsyncNativeDelegate (CloseAsync_cb);
  				return CloseAsync_cb_delegate;
  			}
  		}
  
  		static void OverrideCloseAsync (GLib.GType gtype)
  		{
  			OverrideCloseAsync (gtype, CloseAsyncVMCallback);
  		}
  
  		static void OverrideCloseAsync (GLib.GType gtype, CloseAsyncNativeDelegate callback)
  		{
  			GFileEnumeratorClass class_iface = GetClassStruct (gtype, false);
  			class_iface.CloseAsync = callback;
  			OverrideClassStruct (gtype, class_iface);
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate void CloseAsyncNativeDelegate (IntPtr inst, int io_priority, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
  
  		static void CloseAsync_cb (IntPtr inst, int io_priority, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data)
  		{
  			try {
  				FileEnumerator __obj = GLib.Object.GetObject (inst, false) as FileEnumerator;
  				GLibSharp.AsyncReadyCallbackInvoker cb_invoker = new GLibSharp.AsyncReadyCallbackInvoker (cb, user_data);
  				__obj.OnCloseAsync (io_priority, GLib.Object.GetObject(cancellable) as GLib.Cancellable, cb_invoker.Handler);
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, false);
  			}
  		}
  
  		[GLib.DefaultSignalHandler(Type=typeof(GLib.FileEnumerator), ConnectionMethod="OverrideCloseAsync")]
  		protected virtual void OnCloseAsync (int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
  		{
  			InternalCloseAsync (io_priority, cancellable, cb);
  		}
  
  		private void InternalCloseAsync (int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb)
  		{
  			CloseAsyncNativeDelegate unmanaged = GetClassStruct (this.LookupGType ().GetThresholdType (), true).CloseAsync;
  			if (unmanaged == null) return;
  
  			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
  			cb_wrapper.PersistUntilCalled ();
  			unmanaged (this.Handle, io_priority, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
  		}
  
  		static CloseFinishNativeDelegate CloseFinish_cb_delegate;
  		static CloseFinishNativeDelegate CloseFinishVMCallback {
  			get {
  				if (CloseFinish_cb_delegate == null)
  					CloseFinish_cb_delegate = new CloseFinishNativeDelegate (CloseFinish_cb);
  				return CloseFinish_cb_delegate;
  			}
  		}
  
  		static void OverrideCloseFinish (GLib.GType gtype)
  		{
  			OverrideCloseFinish (gtype, CloseFinishVMCallback);
  		}
  
  		static void OverrideCloseFinish (GLib.GType gtype, CloseFinishNativeDelegate callback)
  		{
  			GFileEnumeratorClass class_iface = GetClassStruct (gtype, false);
  			class_iface.CloseFinish = callback;
  			OverrideClassStruct (gtype, class_iface);
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate bool CloseFinishNativeDelegate (IntPtr inst, IntPtr result, out IntPtr error);
  
  		static bool CloseFinish_cb (IntPtr inst, IntPtr result, out IntPtr error)
  		{
  			error = IntPtr.Zero;
  
  			try {
  				FileEnumerator __obj = GLib.Object.GetObject (inst, false) as FileEnumerator;
  				bool __result;
  				__result = __obj.OnCloseFinish (GLib.AsyncResultAdapter.GetObject (result, false));
  				return __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[GLib.DefaultSignalHandler(Type=typeof(GLib.FileEnumerator), ConnectionMethod="OverrideCloseFinish")]
  		protected virtual bool OnCloseFinish (GLib.IAsyncResult result)
  		{
  			return InternalCloseFinish (result);
  		}
  
  		private bool InternalCloseFinish (GLib.IAsyncResult result)
  		{
  			CloseFinishNativeDelegate unmanaged = GetClassStruct (this.LookupGType ().GetThresholdType (), true).CloseFinish;
  			if (unmanaged == null) throw new InvalidOperationException ("No base method to invoke");
  
  			IntPtr error = IntPtr.Zero;
  			bool __result = unmanaged (this.Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
  			return __result;
  		}
  
  		[StructLayout (LayoutKind.Sequential)]
  		struct GFileEnumeratorClass {
  			public NextFileNativeDelegate NextFile;
  			public CloseFnNativeDelegate CloseFn;
  			public NextFilesAsyncNativeDelegate NextFilesAsync;
  			public NextFilesFinishNativeDelegate NextFilesFinish;
  			public CloseAsyncNativeDelegate CloseAsync;
  			public CloseFinishNativeDelegate CloseFinish;
  			IntPtr GReserved1;
  			IntPtr GReserved2;
  			IntPtr GReserved3;
  			IntPtr GReserved4;
  			IntPtr GReserved5;
  			IntPtr GReserved6;
  			IntPtr GReserved7;
  		}
  
  		static uint class_offset = ((GLib.GType) typeof (GLib.Object)).GetClassSize ();
  		static Dictionary<GLib.GType, GFileEnumeratorClass> class_structs;
  
  		static GFileEnumeratorClass GetClassStruct (GLib.GType gtype, bool use_cache)
  		{
  			if (class_structs == null)
  				class_structs = new Dictionary<GLib.GType, GFileEnumeratorClass> ();
  
  			if (use_cache && class_structs.ContainsKey (gtype))
  				return class_structs [gtype];
  			else {
  				IntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 () + class_offset);
  				GFileEnumeratorClass class_struct = (GFileEnumeratorClass) Marshal.PtrToStructure (class_ptr, typeof (GFileEnumeratorClass));
  				if (use_cache)
  					class_structs.Add (gtype, class_struct);
  				return class_struct;
  			}
  		}
  
  		static void OverrideClassStruct (GLib.GType gtype, GFileEnumeratorClass class_struct)
  		{
  			IntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 () + class_offset);
  			Marshal.StructureToPtr (class_struct, class_ptr, false);
  		}
  
  		[DllImport("libgio-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern unsafe bool g_file_enumerator_close(IntPtr raw, IntPtr cancellable, out IntPtr error);
  
  		public unsafe bool Close(GLib.Cancellable cancellable) {
  			IntPtr error = IntPtr.Zero;
  			bool raw_ret = g_file_enumerator_close(Handle, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
  			bool ret = raw_ret;
  			if (error != IntPtr.Zero) throw new GLib.GException (error);
  			return ret;
  		}
  
  		[DllImport("libgio-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern void g_file_enumerator_close_async(IntPtr raw, int io_priority, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
  
  		public void CloseAsync(int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
  			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
  			cb_wrapper.PersistUntilCalled ();
  			g_file_enumerator_close_async(Handle, io_priority, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
  		}
  
  		[DllImport("libgio-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern unsafe bool g_file_enumerator_close_finish(IntPtr raw, IntPtr result, out IntPtr error);
  
  		public unsafe bool CloseFinish(GLib.IAsyncResult result) {
  			IntPtr error = IntPtr.Zero;
  			bool raw_ret = g_file_enumerator_close_finish(Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
  			bool ret = raw_ret;
  			if (error != IntPtr.Zero) throw new GLib.GException (error);
  			return ret;
  		}
  
  		[DllImport("libgio-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern IntPtr g_file_enumerator_get_type();
  
  		public static new GLib.GType GType { 
  			get {
  				IntPtr raw_ret = g_file_enumerator_get_type();
  				GLib.GType ret = new GLib.GType(raw_ret);
  				return ret;
  			}
  		}
  
  		[DllImport("libgio-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern bool g_file_enumerator_has_pending(IntPtr raw);
  
  		public bool HasPending { 
  			get {
  				bool raw_ret = g_file_enumerator_has_pending(Handle);
  				bool ret = raw_ret;
  				return ret;
  			}
  		}
  
  		[DllImport("libgio-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern bool g_file_enumerator_is_closed(IntPtr raw);
  
  		public bool IsClosed { 
  			get {
  
gt: 				bool raw_ret = g_file_enumerator_is_closed(Handle);