// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace GLib {

	using System;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public partial class DriveAdapter : GLib.GInterfaceAdapter, GLib.IDrive {

		GLib.Object implementor;

		public DriveAdapter (IntPtr handle)
		{
			if (!_gtype.IsInstance (handle))
				throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle");
			implementor = GLib.Object.GetObject (handle);
		}

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

		private static GLib.GType _gtype = new GLib.GType (g_drive_get_type ());

		public static GLib.GType GType {
			get {
				return _gtype;
			}
		}

		public override GLib.GType GInterfaceGType {
			get {
				return _gtype;
			}
		}

		public override IntPtr Handle {
			get {
				return implementor.Handle;
			}
		}

		public IntPtr OwnedHandle {
			get {
				return implementor.OwnedHandle;
			}
		}

		public static IDrive GetObject (IntPtr handle, bool owned)
		{
			GLib.Object obj = GLib.Object.GetObject (handle, owned);
			return GetObject (obj);
		}

		public static IDrive GetObject (GLib.Object obj)
		{
			if (obj == null)
				return null;
			else if (obj as IDrive == null)
				return new DriveAdapter (obj.Handle);
			else
				return obj as IDrive;
		}

		[GLib.Signal("eject-button")]
		public event System.EventHandler EjectButton {
			add {
				GLib.Object.GetObject (Handle).AddSignalHandler ("eject-button", value);
			}
			remove {
				GLib.Object.GetObject (Handle).RemoveSignalHandler ("eject-button", value);
			}
		}

		[GLib.Signal("changed")]
		public event System.EventHandler Changed {
			add {
				GLib.Object.GetObject (Handle).AddSignalHandler ("changed", value);
			}
			remove {
				GLib.Object.GetObject (Handle).RemoveSignalHandler ("changed", value);
			}
		}

		[GLib.Signal("stop-button")]
		public event System.EventHandler StopButton {
			add {
				GLib.Object.GetObject (Handle).AddSignalHandler ("stop-button", value);
			}
			remove {
				GLib.Object.GetObject (Handle).RemoveSignalHandler ("stop-button", value);
			}
		}

		[GLib.Signal("disconnected")]
		public event System.EventHandler Disconnected {
			add {
				GLib.Object.GetObject (Handle).AddSignalHandler ("disconnected", value);
			}
			remove {
				GLib.Object.GetObject (Handle).RemoveSignalHandler ("disconnected", value);
			}
		}

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

		public bool CanEject() {
			bool raw_ret = g_drive_can_eject(Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public bool CanPollForMedia() {
			bool raw_ret = g_drive_can_poll_for_media(Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public bool CanStart() {
			bool raw_ret = g_drive_can_start(Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public bool CanStartDegraded() {
			bool raw_ret = g_drive_can_start_degraded(Handle);
			bool ret = raw_ret;
			return ret;
		}

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

		public bool CanStop() {
			bool raw_ret = g_drive_can_stop(Handle);
			bool ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_drive_eject_with_operation(IntPtr raw, int flags, IntPtr mount_operation, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
		static d_g_drive_eject_with_operation g_drive_eject_with_operation = FuncLoader.LoadFunction<d_g_drive_eject_with_operation>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_drive_eject_with_operation"));

		public void EjectWithOperation(GLib.MountUnmountFlags flags, GLib.MountOperation mount_operation, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_drive_eject_with_operation(Handle, (int) flags, mount_operation == null ? IntPtr.Zero : mount_operation.Handle, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_drive_eject_with_operation_finish(IntPtr raw, IntPtr result, out IntPtr error);
		static d_g_drive_eject_with_operation_finish g_drive_eject_with_operation_finish = FuncLoader.LoadFunction<d_g_drive_eject_with_operation_finish>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_drive_eject_with_operation_finish"));

		public bool EjectWithOperationFinish(GLib.IAsyncResult result) {
			IntPtr error = IntPtr.Zero;
			bool raw_ret = g_drive_eject_with_operation_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;
		}

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

		public string EnumerateIdentifiers() {
			IntPtr raw_ret = g_drive_enumerate_identifiers(Handle);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			return ret;
		}

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

		public GLib.IIcon Icon { 
			get {
				IntPtr raw_ret = g_drive_get_icon(Handle);
				GLib.IIcon ret = GLib.IconAdapter.GetObject (raw_ret, false);
				return ret;
			}
		}

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

		public string GetIdentifier(string kind) {
			IntPtr native_kind = GLib.Marshaller.StringToPtrGStrdup (kind);
			IntPtr raw_ret = g_drive_get_identifier(Handle, native_kind);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			GLib.Marshaller.Free (native_kind);
			return ret;
		}

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

		public string Name { 
			get {
				IntPtr raw_ret = g_drive_get_name(Handle);
				string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
				return ret;
			}
		}

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

		public string SortKey { 
			get {
				IntPtr raw_ret = g_drive_get_sort_key(Handle);
				string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
				return ret;
			}
		}

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

		public GLib.DriveStartStopType StartStopType { 
			get {
				int raw_ret = g_drive_get_start_stop_type(Handle);
				GLib.DriveStartStopType ret = (GLib.DriveStartStopType) raw_ret;
				return ret;
			}
		}

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

		public GLib.IIcon SymbolicIcon { 
			get {
				IntPtr raw_ret = g_drive_get_symbolic_icon(Handle);
				GLib.IIcon ret = GLib.IconAdapter.GetObject (raw_ret, false);
				return ret;
			}
		}

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

		public GLib.IVolume[] Volumes { 
			get {
				IntPtr raw_ret = g_drive_get_volumes(Handle);
				GLib.IVolume[] ret = GLib.Marshaller.ListPtrToArray<GLib.IVolume, GLib.IVolume> (raw_ret, true, true);
				return ret;
			}
		}

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

		public bool HasMedia { 
			get {
				bool raw_ret = g_drive_has_media(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

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

		public bool HasVolumes { 
			get {
				bool raw_ret = g_drive_has_volumes(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

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

		public bool IsMediaCheckAutomatic { 
			get {
				bool raw_ret = g_drive_is_media_check_automatic(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

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

		public bool IsMediaRemovable { 
			get {
				bool raw_ret = g_drive_is_media_removable(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

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

		public bool IsRemovable { 
			get {
				bool raw_ret = g_drive_is_removable(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_drive_poll_for_media(IntPtr raw, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
		static d_g_drive_poll_for_media g_drive_poll_for_media = FuncLoader.LoadFunction<d_g_drive_poll_for_media>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_drive_poll_for_media"));

		public void PollForMedia(GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_drive_poll_for_media(Handle, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_drive_poll_for_media_finish(IntPtr raw, IntPtr result, out IntPtr error);
		static d_g_drive_poll_for_media_finish g_drive_poll_for_media_finish = FuncLoader.LoadFunction<d_g_drive_poll_for_media_finish>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_drive_poll_for_media_finish"));

		public bool PollForMediaFinish(GLib.IAsyncResult result) {
			IntPtr error = IntPtr.Zero;
			bool raw_ret = g_drive_poll_for_media_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;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_drive_start(IntPtr raw, int flags, IntPtr mount_operation, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
		static d_g_drive_start g_drive_start = FuncLoader.LoadFunction<d_g_drive_start>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_drive_start"));

		public void Start(GLib.DriveStartFlags flags, GLib.MountOperation mount_operation, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_drive_start(Handle, (int) flags, mount_operation == null ? IntPtr.Zero : mount_operation.Handle, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_drive_start_finish(IntPtr raw, IntPtr result, out IntPtr error);
		static d_g_drive_start_finish g_drive_start_finish = FuncLoader.LoadFunction<d_g_drive_start_finish>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_drive_start_finish"));

		public bool StartFinish(GLib.IAsyncResult result) {
			IntPtr error = IntPtr.Zero;
			bool raw_ret = g_drive_start_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;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_drive_stop(IntPtr raw, int flags, IntPtr mount_operation, IntPtr cancellable, GLibSharp.AsyncReadyCallbackNative cb, IntPtr user_data);
		static d_g_drive_stop g_drive_stop = FuncLoader.LoadFunction<d_g_drive_stop>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_drive_stop"));

		public void Stop(GLib.MountUnmountFlags flags, GLib.MountOperation mount_operation, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_drive_stop(Handle, (int) flags, mount_operation == null ? IntPtr.Zero : mount_operation.Handle, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_drive_stop_finish(IntPtr raw, IntPtr result, out IntPtr error);
		static d_g_drive_stop_finish g_drive_stop_finish = FuncLoader.LoadFunction<d_g_drive_stop_finish>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_drive_stop_finish"));

		public bool StopFinish(GLib.IAsyncResult result) {
			IntPtr error = IntPtr.Zero;
			bool raw_ret = g_drive_stop_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;
		}

#endregion
	}
}
