{-# LINE 2 "./System/GIO/Volumes/Volume.chs" #-}
module System.GIO.Volumes.Volume (
Volume(..),
VolumeClass,
volumeGetName,
volumeGetUUID,
volumeGetIcon,
volumeGetDrive,
volumeGetMount,
volumeCanMount,
volumeShouldAutomount,
volumeGetActivationRoot,
volumeMount,
volumeMountFinish,
volumeCanEject,
volumeEjectWithOperation,
volumeEjectWithOperationFinish,
volumeEnumerateIdentifiers,
volumeGetIdentifier,
volumeChanged,
volumeRemoved,
) where
import Control.Monad
import Data.Maybe (fromMaybe)
import System.GIO.Enums
import System.Glib.Attributes
import System.Glib.FFI
import System.Glib.Flags
import System.Glib.GError
import System.Glib.GObject
import System.Glib.Properties
import System.Glib.Signals
import System.Glib.UTFString
import System.GIO.Async.AsyncResult
{-# LINE 104 "./System/GIO/Volumes/Volume.chs" #-}
import System.GIO.Signals
{-# LINE 105 "./System/GIO/Volumes/Volume.chs" #-}
import System.GIO.Types
{-# LINE 106 "./System/GIO/Volumes/Volume.chs" #-}
{-# LINE 108 "./System/GIO/Volumes/Volume.chs" #-}
volumeGetName :: (VolumeClass volume, GlibString string) => volume
-> IO string
volumeGetName :: forall volume string.
(VolumeClass volume, GlibString string) =>
volume -> IO string
volumeGetName volume
volume =
(\(Volume ForeignPtr Volume
arg1) -> ForeignPtr Volume
-> (Ptr Volume -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO (Ptr CChar)) -> IO (Ptr CChar))
-> (Ptr Volume -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->Ptr Volume -> IO (Ptr CChar)
g_volume_get_name Ptr Volume
argPtr1) (volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume)
IO (Ptr CChar) -> (Ptr CChar -> IO string) -> IO string
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr CChar -> IO string
forall s. GlibString s => Ptr CChar -> IO s
readUTFString
volumeGetUUID :: (VolumeClass volume, GlibString string) => volume
-> IO (Maybe string)
volumeGetUUID :: forall volume string.
(VolumeClass volume, GlibString string) =>
volume -> IO (Maybe string)
volumeGetUUID volume
volume =
(\(Volume ForeignPtr Volume
arg1) -> ForeignPtr Volume
-> (Ptr Volume -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO (Ptr CChar)) -> IO (Ptr CChar))
-> (Ptr Volume -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->Ptr Volume -> IO (Ptr CChar)
g_volume_get_uuid Ptr Volume
argPtr1) (volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume)
IO (Ptr CChar)
-> (Ptr CChar -> IO (Maybe string)) -> IO (Maybe string)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (Ptr CChar -> IO string) -> Ptr CChar -> IO (Maybe string)
forall a b. (Ptr a -> IO b) -> Ptr a -> IO (Maybe b)
maybePeek Ptr CChar -> IO string
forall s. GlibString s => Ptr CChar -> IO s
readUTFString
volumeGetIcon :: VolumeClass volume => volume
-> IO Icon
volumeGetIcon :: forall volume. VolumeClass volume => volume -> IO Icon
volumeGetIcon volume
volume =
(ForeignPtr Icon -> Icon, FinalizerPtr Icon)
-> IO (Ptr Icon) -> IO Icon
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr Icon -> Icon, FinalizerPtr Icon)
forall {a}. (ForeignPtr Icon -> Icon, FinalizerPtr a)
mkIcon (IO (Ptr Icon) -> IO Icon) -> IO (Ptr Icon) -> IO Icon
forall a b. (a -> b) -> a -> b
$
(\(Volume ForeignPtr Volume
arg1) -> ForeignPtr Volume -> (Ptr Volume -> IO (Ptr Icon)) -> IO (Ptr Icon)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO (Ptr Icon)) -> IO (Ptr Icon))
-> (Ptr Volume -> IO (Ptr Icon)) -> IO (Ptr Icon)
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->Ptr Volume -> IO (Ptr Icon)
g_volume_get_icon Ptr Volume
argPtr1) (volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume)
volumeGetDrive :: VolumeClass volume => volume
-> IO (Maybe Drive)
volumeGetDrive :: forall volume. VolumeClass volume => volume -> IO (Maybe Drive)
volumeGetDrive volume
volume =
(IO (Ptr Drive) -> IO Drive) -> IO (Ptr Drive) -> IO (Maybe Drive)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((ForeignPtr Drive -> Drive, FinalizerPtr Drive)
-> IO (Ptr Drive) -> IO Drive
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr Drive -> Drive, FinalizerPtr Drive)
forall {a}. (ForeignPtr Drive -> Drive, FinalizerPtr a)
mkDrive) (IO (Ptr Drive) -> IO (Maybe Drive))
-> IO (Ptr Drive) -> IO (Maybe Drive)
forall a b. (a -> b) -> a -> b
$
(\(Volume ForeignPtr Volume
arg1) -> ForeignPtr Volume
-> (Ptr Volume -> IO (Ptr Drive)) -> IO (Ptr Drive)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO (Ptr Drive)) -> IO (Ptr Drive))
-> (Ptr Volume -> IO (Ptr Drive)) -> IO (Ptr Drive)
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->Ptr Volume -> IO (Ptr Drive)
g_volume_get_drive Ptr Volume
argPtr1) (volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume)
volumeGetMount :: VolumeClass volume => volume
-> IO (Maybe Mount)
volumeGetMount :: forall volume. VolumeClass volume => volume -> IO (Maybe Mount)
volumeGetMount volume
volume =
(IO (Ptr Mount) -> IO Mount) -> IO (Ptr Mount) -> IO (Maybe Mount)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((ForeignPtr Mount -> Mount, FinalizerPtr Mount)
-> IO (Ptr Mount) -> IO Mount
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr Mount -> Mount, FinalizerPtr Mount)
forall {a}. (ForeignPtr Mount -> Mount, FinalizerPtr a)
mkMount) (IO (Ptr Mount) -> IO (Maybe Mount))
-> IO (Ptr Mount) -> IO (Maybe Mount)
forall a b. (a -> b) -> a -> b
$
(\(Volume ForeignPtr Volume
arg1) -> ForeignPtr Volume
-> (Ptr Volume -> IO (Ptr Mount)) -> IO (Ptr Mount)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO (Ptr Mount)) -> IO (Ptr Mount))
-> (Ptr Volume -> IO (Ptr Mount)) -> IO (Ptr Mount)
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->Ptr Volume -> IO (Ptr Mount)
g_volume_get_mount Ptr Volume
argPtr1) (volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume)
volumeCanMount :: VolumeClass volume => volume
-> IO Bool
volumeCanMount :: forall volume. VolumeClass volume => volume -> IO Bool
volumeCanMount volume
volume =
(CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
(\(Volume ForeignPtr Volume
arg1) -> ForeignPtr Volume -> (Ptr Volume -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO CInt) -> IO CInt)
-> (Ptr Volume -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->Ptr Volume -> IO CInt
g_volume_can_mount Ptr Volume
argPtr1) (volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume)
volumeShouldAutomount :: VolumeClass volume => volume
-> IO Bool
volumeShouldAutomount :: forall volume. VolumeClass volume => volume -> IO Bool
volumeShouldAutomount volume
volume =
(CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
(\(Volume ForeignPtr Volume
arg1) -> ForeignPtr Volume -> (Ptr Volume -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO CInt) -> IO CInt)
-> (Ptr Volume -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->Ptr Volume -> IO CInt
g_volume_should_automount Ptr Volume
argPtr1) (volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume)
volumeGetActivationRoot :: VolumeClass volume => volume
-> IO (Maybe File)
volumeGetActivationRoot :: forall volume. VolumeClass volume => volume -> IO (Maybe File)
volumeGetActivationRoot volume
volume =
(IO (Ptr File) -> IO File) -> IO (Ptr File) -> IO (Maybe File)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((ForeignPtr File -> File, FinalizerPtr File)
-> IO (Ptr File) -> IO File
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
wrapNewGObject (ForeignPtr File -> File, FinalizerPtr File)
forall {a}. (ForeignPtr File -> File, FinalizerPtr a)
mkFile) (IO (Ptr File) -> IO (Maybe File))
-> IO (Ptr File) -> IO (Maybe File)
forall a b. (a -> b) -> a -> b
$
(\(Volume ForeignPtr Volume
arg1) -> ForeignPtr Volume -> (Ptr Volume -> IO (Ptr File)) -> IO (Ptr File)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO (Ptr File)) -> IO (Ptr File))
-> (Ptr Volume -> IO (Ptr File)) -> IO (Ptr File)
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->Ptr Volume -> IO (Ptr File)
g_volume_get_activation_root Ptr Volume
argPtr1) (volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume)
volumeMount :: VolumeClass volume => volume
-> [MountMountFlags]
-> Maybe MountOperation
-> Maybe Cancellable
-> AsyncReadyCallback
-> IO ()
volumeMount :: forall volume.
VolumeClass volume =>
volume
-> [MountMountFlags]
-> Maybe MountOperation
-> Maybe Cancellable
-> AsyncReadyCallback
-> IO ()
volumeMount volume
volume [MountMountFlags]
flags Maybe MountOperation
mountOperation Maybe Cancellable
cancellable AsyncReadyCallback
callback = do
GAsyncReadyCallback
cCallback <- AsyncReadyCallback -> IO GAsyncReadyCallback
marshalAsyncReadyCallback AsyncReadyCallback
callback
(\(Volume ForeignPtr Volume
arg1) CInt
arg2 (MountOperation ForeignPtr MountOperation
arg3) (Cancellable ForeignPtr Cancellable
arg4) GAsyncReadyCallback
arg5 Ptr ()
arg6 -> ForeignPtr Volume -> (Ptr Volume -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO ()) -> IO ()) -> (Ptr Volume -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->ForeignPtr MountOperation -> (Ptr MountOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr MountOperation
arg3 ((Ptr MountOperation -> IO ()) -> IO ())
-> (Ptr MountOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr MountOperation
argPtr3 ->ForeignPtr Cancellable -> (Ptr Cancellable -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Cancellable
arg4 ((Ptr Cancellable -> IO ()) -> IO ())
-> (Ptr Cancellable -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Cancellable
argPtr4 ->Ptr Volume
-> CInt
-> Ptr MountOperation
-> Ptr Cancellable
-> GAsyncReadyCallback
-> Ptr ()
-> IO ()
g_volume_mount Ptr Volume
argPtr1 CInt
arg2 Ptr MountOperation
argPtr3 Ptr Cancellable
argPtr4 GAsyncReadyCallback
arg5 Ptr ()
arg6)
{-# LINE 185 "./System/GIO/Volumes/Volume.chs" #-}
(volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume)
((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> ([MountMountFlags] -> Int) -> [MountMountFlags] -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [MountMountFlags] -> Int
forall a. Flags a => [a] -> Int
fromFlags) [MountMountFlags]
flags)
(MountOperation -> Maybe MountOperation -> MountOperation
forall a. a -> Maybe a -> a
fromMaybe (ForeignPtr MountOperation -> MountOperation
MountOperation ForeignPtr MountOperation
forall a. ForeignPtr a
nullForeignPtr) Maybe MountOperation
mountOperation)
(Cancellable -> Maybe Cancellable -> Cancellable
forall a. a -> Maybe a -> a
fromMaybe (ForeignPtr Cancellable -> Cancellable
Cancellable ForeignPtr Cancellable
forall a. ForeignPtr a
nullForeignPtr) Maybe Cancellable
cancellable)
GAsyncReadyCallback
cCallback
(GAsyncReadyCallback -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr GAsyncReadyCallback
cCallback)
volumeMountFinish :: VolumeClass volume => volume
-> AsyncResult
-> IO ()
volumeMountFinish :: forall volume. VolumeClass volume => volume -> AsyncResult -> IO ()
volumeMountFinish volume
volume AsyncResult
result =
(Ptr (Ptr ()) -> IO ()) -> IO ()
forall a. (Ptr (Ptr ()) -> IO a) -> IO a
propagateGError (\Ptr (Ptr ())
gErrorPtr -> do
(\(Volume ForeignPtr Volume
arg1) (AsyncResult ForeignPtr AsyncResult
arg2) Ptr (Ptr ())
arg3 -> ForeignPtr Volume -> (Ptr Volume -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO CInt) -> IO CInt)
-> (Ptr Volume -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->ForeignPtr AsyncResult -> (Ptr AsyncResult -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr AsyncResult
arg2 ((Ptr AsyncResult -> IO CInt) -> IO CInt)
-> (Ptr AsyncResult -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr AsyncResult
argPtr2 ->Ptr Volume -> Ptr AsyncResult -> Ptr (Ptr ()) -> IO CInt
g_volume_mount_finish Ptr Volume
argPtr1 Ptr AsyncResult
argPtr2 Ptr (Ptr ())
arg3)
{-# LINE 206 "./System/GIO/Volumes/Volume.chs" #-}
(volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume)
AsyncResult
result
Ptr (Ptr ())
gErrorPtr
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ())
volumeCanEject :: VolumeClass volume => volume
-> IO Bool
volumeCanEject :: forall volume. VolumeClass volume => volume -> IO Bool
volumeCanEject volume
volume =
(CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
(\(Volume ForeignPtr Volume
arg1) -> ForeignPtr Volume -> (Ptr Volume -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO CInt) -> IO CInt)
-> (Ptr Volume -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->Ptr Volume -> IO CInt
g_volume_can_eject Ptr Volume
argPtr1) (volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume)
volumeEjectWithOperation :: VolumeClass volume => volume
-> [MountUnmountFlags]
-> Maybe MountOperation
-> Maybe Cancellable
-> AsyncReadyCallback
-> IO ()
volumeEjectWithOperation :: forall volume.
VolumeClass volume =>
volume
-> [MountUnmountFlags]
-> Maybe MountOperation
-> Maybe Cancellable
-> AsyncReadyCallback
-> IO ()
volumeEjectWithOperation volume
volume [MountUnmountFlags]
flags Maybe MountOperation
mountOperation Maybe Cancellable
cancellable AsyncReadyCallback
callback = do
GAsyncReadyCallback
cCallback <- AsyncReadyCallback -> IO GAsyncReadyCallback
marshalAsyncReadyCallback AsyncReadyCallback
callback
(\(Volume ForeignPtr Volume
arg1) CInt
arg2 (MountOperation ForeignPtr MountOperation
arg3) (Cancellable ForeignPtr Cancellable
arg4) GAsyncReadyCallback
arg5 Ptr ()
arg6 -> ForeignPtr Volume -> (Ptr Volume -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO ()) -> IO ()) -> (Ptr Volume -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->ForeignPtr MountOperation -> (Ptr MountOperation -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr MountOperation
arg3 ((Ptr MountOperation -> IO ()) -> IO ())
-> (Ptr MountOperation -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr MountOperation
argPtr3 ->ForeignPtr Cancellable -> (Ptr Cancellable -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Cancellable
arg4 ((Ptr Cancellable -> IO ()) -> IO ())
-> (Ptr Cancellable -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Cancellable
argPtr4 ->Ptr Volume
-> CInt
-> Ptr MountOperation
-> Ptr Cancellable
-> GAsyncReadyCallback
-> Ptr ()
-> IO ()
g_volume_eject_with_operation Ptr Volume
argPtr1 CInt
arg2 Ptr MountOperation
argPtr3 Ptr Cancellable
argPtr4 GAsyncReadyCallback
arg5 Ptr ()
arg6)
{-# LINE 231 "./System/GIO/Volumes/Volume.chs" #-}
(volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume)
((Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> ([MountUnmountFlags] -> Int) -> [MountUnmountFlags] -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [MountUnmountFlags] -> Int
forall a. Flags a => [a] -> Int
fromFlags) [MountUnmountFlags]
flags)
(MountOperation -> Maybe MountOperation -> MountOperation
forall a. a -> Maybe a -> a
fromMaybe (ForeignPtr MountOperation -> MountOperation
MountOperation ForeignPtr MountOperation
forall a. ForeignPtr a
nullForeignPtr) Maybe MountOperation
mountOperation)
(Cancellable -> Maybe Cancellable -> Cancellable
forall a. a -> Maybe a -> a
fromMaybe (ForeignPtr Cancellable -> Cancellable
Cancellable ForeignPtr Cancellable
forall a. ForeignPtr a
nullForeignPtr) Maybe Cancellable
cancellable)
GAsyncReadyCallback
cCallback
(GAsyncReadyCallback -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr GAsyncReadyCallback
cCallback)
volumeEjectWithOperationFinish :: VolumeClass volume => volume
-> AsyncResult
-> IO ()
volumeEjectWithOperationFinish :: forall volume. VolumeClass volume => volume -> AsyncResult -> IO ()
volumeEjectWithOperationFinish volume
volume AsyncResult
result =
(Ptr (Ptr ()) -> IO ()) -> IO ()
forall a. (Ptr (Ptr ()) -> IO a) -> IO a
propagateGError (\Ptr (Ptr ())
gErrorPtr -> do
(\(Volume ForeignPtr Volume
arg1) (AsyncResult ForeignPtr AsyncResult
arg2) Ptr (Ptr ())
arg3 -> ForeignPtr Volume -> (Ptr Volume -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO CInt) -> IO CInt)
-> (Ptr Volume -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->ForeignPtr AsyncResult -> (Ptr AsyncResult -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr AsyncResult
arg2 ((Ptr AsyncResult -> IO CInt) -> IO CInt)
-> (Ptr AsyncResult -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr AsyncResult
argPtr2 ->Ptr Volume -> Ptr AsyncResult -> Ptr (Ptr ()) -> IO CInt
g_volume_eject_with_operation_finish Ptr Volume
argPtr1 Ptr AsyncResult
argPtr2 Ptr (Ptr ())
arg3)
{-# LINE 248 "./System/GIO/Volumes/Volume.chs" #-}
(volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume)
AsyncResult
result
Ptr (Ptr ())
gErrorPtr
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ())
volumeEnumerateIdentifiers :: (VolumeClass volume, GlibString string) => volume
-> IO [string]
volumeEnumerateIdentifiers :: forall volume string.
(VolumeClass volume, GlibString string) =>
volume -> IO [string]
volumeEnumerateIdentifiers volume
volume =
(\(Volume ForeignPtr Volume
arg1) -> ForeignPtr Volume
-> (Ptr Volume -> IO (Ptr (Ptr CChar))) -> IO (Ptr (Ptr CChar))
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO (Ptr (Ptr CChar))) -> IO (Ptr (Ptr CChar)))
-> (Ptr Volume -> IO (Ptr (Ptr CChar))) -> IO (Ptr (Ptr CChar))
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->Ptr Volume -> IO (Ptr (Ptr CChar))
g_volume_enumerate_identifiers Ptr Volume
argPtr1) (volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume)
IO (Ptr (Ptr CChar))
-> (Ptr (Ptr CChar) -> IO [string]) -> IO [string]
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr (Ptr CChar) -> IO [string]
forall s. GlibString s => Ptr (Ptr CChar) -> IO [s]
readUTFStringArray0
volumeGetIdentifier :: (VolumeClass volume, GlibString string) => volume
-> string
-> IO string
volumeGetIdentifier :: forall volume string.
(VolumeClass volume, GlibString string) =>
volume -> string -> IO string
volumeGetIdentifier volume
volume string
kind =
string -> (Ptr CChar -> IO string) -> IO string
forall a. string -> (Ptr CChar -> IO a) -> IO a
forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
withUTFString string
kind ((Ptr CChar -> IO string) -> IO string)
-> (Ptr CChar -> IO string) -> IO string
forall a b. (a -> b) -> a -> b
$ \ Ptr CChar
kindPtr ->
(\(Volume ForeignPtr Volume
arg1) Ptr CChar
arg2 -> ForeignPtr Volume
-> (Ptr Volume -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Volume
arg1 ((Ptr Volume -> IO (Ptr CChar)) -> IO (Ptr CChar))
-> (Ptr Volume -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. (a -> b) -> a -> b
$ \Ptr Volume
argPtr1 ->Ptr Volume -> Ptr CChar -> IO (Ptr CChar)
g_volume_get_identifier Ptr Volume
argPtr1 Ptr CChar
arg2) (volume -> Volume
forall o. VolumeClass o => o -> Volume
toVolume volume
volume) Ptr CChar
kindPtr
IO (Ptr CChar) -> (Ptr CChar -> IO string) -> IO string
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr CChar -> IO string
forall s. GlibString s => Ptr CChar -> IO s
readUTFString
volumeChanged :: VolumeClass volume => Signal volume (IO ())
volumeChanged :: forall volume. VolumeClass volume => Signal volume (IO ())
volumeChanged = (Bool -> volume -> IO () -> IO (ConnectId volume))
-> Signal volume (IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName -> Bool -> volume -> IO () -> IO (ConnectId volume)
forall obj.
GObjectClass obj =>
SignalName -> Bool -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE SignalName
"changed")
volumeRemoved :: VolumeClass volume => Signal volume (IO ())
volumeRemoved :: forall volume. VolumeClass volume => Signal volume (IO ())
volumeRemoved = (Bool -> volume -> IO () -> IO (ConnectId volume))
-> Signal volume (IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName -> Bool -> volume -> IO () -> IO (ConnectId volume)
forall obj.
GObjectClass obj =>
SignalName -> Bool -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE SignalName
"removed")
foreign import ccall safe "g_volume_get_name"
g_volume_get_name :: ((Ptr Volume) -> (IO (Ptr CChar)))
foreign import ccall safe "g_volume_get_uuid"
g_volume_get_uuid :: ((Ptr Volume) -> (IO (Ptr CChar)))
foreign import ccall safe "g_volume_get_icon"
g_volume_get_icon :: ((Ptr Volume) -> (IO (Ptr Icon)))
foreign import ccall safe "g_volume_get_drive"
g_volume_get_drive :: ((Ptr Volume) -> (IO (Ptr Drive)))
foreign import ccall safe "g_volume_get_mount"
g_volume_get_mount :: ((Ptr Volume) -> (IO (Ptr Mount)))
foreign import ccall safe "g_volume_can_mount"
g_volume_can_mount :: ((Ptr Volume) -> (IO CInt))
foreign import ccall safe "g_volume_should_automount"
g_volume_should_automount :: ((Ptr Volume) -> (IO CInt))
foreign import ccall safe "g_volume_get_activation_root"
g_volume_get_activation_root :: ((Ptr Volume) -> (IO (Ptr File)))
foreign import ccall safe "g_volume_mount"
g_volume_mount :: ((Ptr Volume) -> (CInt -> ((Ptr MountOperation) -> ((Ptr Cancellable) -> ((FunPtr ((Ptr ()) -> ((Ptr AsyncResult) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> (IO ())))))))
foreign import ccall safe "g_volume_mount_finish"
g_volume_mount_finish :: ((Ptr Volume) -> ((Ptr AsyncResult) -> ((Ptr (Ptr ())) -> (IO CInt))))
foreign import ccall safe "g_volume_can_eject"
g_volume_can_eject :: ((Ptr Volume) -> (IO CInt))
foreign import ccall safe "g_volume_eject_with_operation"
g_volume_eject_with_operation :: ((Ptr Volume) -> (CInt -> ((Ptr MountOperation) -> ((Ptr Cancellable) -> ((FunPtr ((Ptr ()) -> ((Ptr AsyncResult) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> (IO ())))))))
foreign import ccall safe "g_volume_eject_with_operation_finish"
g_volume_eject_with_operation_finish :: ((Ptr Volume) -> ((Ptr AsyncResult) -> ((Ptr (Ptr ())) -> (IO CInt))))
foreign import ccall safe "g_volume_enumerate_identifiers"
g_volume_enumerate_identifiers :: ((Ptr Volume) -> (IO (Ptr (Ptr CChar))))
foreign import ccall safe "g_volume_get_identifier"
g_volume_get_identifier :: ((Ptr Volume) -> ((Ptr CChar) -> (IO (Ptr CChar))))