// 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 FileAttributeMatcher : GLib.Opaque {

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_file_attribute_matcher_enumerate_namespace(IntPtr raw, IntPtr ns);
		static d_g_file_attribute_matcher_enumerate_namespace g_file_attribute_matcher_enumerate_namespace = FuncLoader.LoadFunction<d_g_file_attribute_matcher_enumerate_namespace>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_file_attribute_matcher_enumerate_namespace"));

		public bool EnumerateNamespace(string ns) {
			IntPtr native_ns = GLib.Marshaller.StringToPtrGStrdup (ns);
			bool raw_ret = g_file_attribute_matcher_enumerate_namespace(Handle, native_ns);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_ns);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_file_attribute_matcher_enumerate_next(IntPtr raw);
		static d_g_file_attribute_matcher_enumerate_next g_file_attribute_matcher_enumerate_next = FuncLoader.LoadFunction<d_g_file_attribute_matcher_enumerate_next>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_file_attribute_matcher_enumerate_next"));

		public string EnumerateNext() {
			IntPtr raw_ret = g_file_attribute_matcher_enumerate_next(Handle);
			string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_file_attribute_matcher_get_type();
		static d_g_file_attribute_matcher_get_type g_file_attribute_matcher_get_type = FuncLoader.LoadFunction<d_g_file_attribute_matcher_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_file_attribute_matcher_get_type"));

		public static GLib.GType GType { 
			get {
				IntPtr raw_ret = g_file_attribute_matcher_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_file_attribute_matcher_matches(IntPtr raw, IntPtr attribute);
		static d_g_file_attribute_matcher_matches g_file_attribute_matcher_matches = FuncLoader.LoadFunction<d_g_file_attribute_matcher_matches>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_file_attribute_matcher_matches"));

		public bool Matches(string attribute) {
			IntPtr native_attribute = GLib.Marshaller.StringToPtrGStrdup (attribute);
			bool raw_ret = g_file_attribute_matcher_matches(Handle, native_attribute);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_attribute);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_file_attribute_matcher_matches_only(IntPtr raw, IntPtr attribute);
		static d_g_file_attribute_matcher_matches_only g_file_attribute_matcher_matches_only = FuncLoader.LoadFunction<d_g_file_attribute_matcher_matches_only>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_file_attribute_matcher_matches_only"));

		public bool MatchesOnly(string attribute) {
			IntPtr native_attribute = GLib.Marshaller.StringToPtrGStrdup (attribute);
			bool raw_ret = g_file_attribute_matcher_matches_only(Handle, native_attribute);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_attribute);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_file_attribute_matcher_subtract(IntPtr raw, IntPtr subtract);
		static d_g_file_attribute_matcher_subtract g_file_attribute_matcher_subtract = FuncLoader.LoadFunction<d_g_file_attribute_matcher_subtract>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_file_attribute_matcher_subtract"));

		public GLib.FileAttributeMatcher Subtract(GLib.FileAttributeMatcher subtract) {
			IntPtr raw_ret = g_file_attribute_matcher_subtract(Handle, subtract == null ? IntPtr.Zero : subtract.Handle);
			GLib.FileAttributeMatcher ret = raw_ret == IntPtr.Zero ? null : (GLib.FileAttributeMatcher) GLib.Opaque.GetOpaque (raw_ret, typeof (GLib.FileAttributeMatcher), false);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_file_attribute_matcher_to_string(IntPtr raw);
		static d_g_file_attribute_matcher_to_string g_file_attribute_matcher_to_string = FuncLoader.LoadFunction<d_g_file_attribute_matcher_to_string>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_file_attribute_matcher_to_string"));

		public override string ToString() {
			IntPtr raw_ret = g_file_attribute_matcher_to_string(Handle);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			return ret;
		}

		public FileAttributeMatcher(IntPtr raw) : base(raw) {}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_file_attribute_matcher_new(IntPtr attributes);
		static d_g_file_attribute_matcher_new g_file_attribute_matcher_new = FuncLoader.LoadFunction<d_g_file_attribute_matcher_new>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_file_attribute_matcher_new"));

		public FileAttributeMatcher (string attributes) 
		{
			IntPtr native_attributes = GLib.Marshaller.StringToPtrGStrdup (attributes);
			Raw = g_file_attribute_matcher_new(native_attributes);
			GLib.Marshaller.Free (native_attributes);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_file_attribute_matcher_ref(IntPtr raw);
		static d_g_file_attribute_matcher_ref g_file_attribute_matcher_ref = FuncLoader.LoadFunction<d_g_file_attribute_matcher_ref>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_file_attribute_matcher_ref"));

		protected override void Ref (IntPtr raw)
		{
			if (!Owned) {
				g_file_attribute_matcher_ref (raw);
				Owned = true;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_file_attribute_matcher_unref(IntPtr raw);
		static d_g_file_attribute_matcher_unref g_file_attribute_matcher_unref = FuncLoader.LoadFunction<d_g_file_attribute_matcher_unref>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_file_attribute_matcher_unref"));

		protected override void Unref (IntPtr raw)
		{
			if (Owned) {
				g_file_attribute_matcher_unref (raw);
				Owned = false;
			}
		}

		class FinalizerInfo {
			IntPtr handle;
			public uint timeoutHandlerId;

			public FinalizerInfo (IntPtr handle)
			{
				this.handle = handle;
			}

			public bool Handler ()
			{
				g_file_attribute_matcher_unref (handle);
				GLib.Timeout.Remove(timeoutHandlerId);
				return false;
			}
		}

		~FileAttributeMatcher ()
		{
			if (!Owned)
				return;
			FinalizerInfo info = new FinalizerInfo (Handle);
			info.timeoutHandlerId = GLib.Timeout.Add (50, new GLib.TimeoutHandler (info.Handler));
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public unsafe GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
