module System.GIO.Volumes.Mount (
Mount(..),
MountClass,
mountGetName,
mountGetUUID,
mountGetIcon,
mountGetDrive,
mountGetRoot,
mountGetVolume,
mountGetDefaultLocation,
mountCanUnmount,
mountUnmountWithOperation,
mountUnmountWithOperationFinish,
mountRemount,
mountRemountFinish,
mountCanEject,
mountEjectWithOperation,
mountEjectWithOperationFinish,
mountGuessContentType,
mountGuessContentTypeFinish,
mountGuessContentTypeSync,
mountIsShadowed,
mountShadow,
mountUnshadow,
mountChanged,
mountPreUnmount,
mountUnmounted,
) 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.GList
import System.Glib.GObject
import System.Glib.Properties
import System.Glib.Signals
import System.Glib.UTFString
import System.GIO.Async.AsyncResult
import System.GIO.Signals
import System.GIO.Types
mountGetName :: MountClass mount => mount
-> IO String
mountGetName mount =
(\(Mount arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_mount_get_name argPtr1) (toMount mount)
>>= readUTFString
mountGetUUID :: MountClass mount => mount
-> IO (Maybe String)
mountGetUUID mount = do
(\(Mount arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_mount_get_uuid argPtr1) (toMount mount)
>>= maybePeek readUTFString
mountGetIcon :: MountClass mount => mount
-> IO Icon
mountGetIcon mount =
wrapNewGObject mkIcon $
(\(Mount arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_mount_get_icon argPtr1) (toMount mount)
mountGetDrive :: MountClass mount => mount
-> IO (Maybe Drive)
mountGetDrive mount =
maybeNull (wrapNewGObject mkDrive) $
(\(Mount arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_mount_get_drive argPtr1) (toMount mount)
mountGetRoot :: MountClass mount => mount
-> IO File
mountGetRoot mount =
wrapNewGObject mkFile $
(\(Mount arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_mount_get_root argPtr1) (toMount mount)
mountGetVolume :: MountClass mount => mount
-> IO (Maybe Volume)
mountGetVolume mount =
maybeNull (wrapNewGObject mkVolume) $
(\(Mount arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_mount_get_volume argPtr1) (toMount mount)
mountGetDefaultLocation :: MountClass mount => mount
-> IO File
mountGetDefaultLocation mount =
wrapNewGObject mkFile $
(\(Mount arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_mount_get_default_location argPtr1) (toMount mount)
mountCanUnmount :: MountClass mount => mount
-> IO Bool
mountCanUnmount mount =
liftM toBool $
(\(Mount arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_mount_can_unmount argPtr1) (toMount mount)
mountUnmountWithOperation :: MountClass mount
=> mount
-> [MountUnmountFlags]
-> Maybe MountOperation
-> Maybe Cancellable
-> AsyncReadyCallback
-> IO ()
mountUnmountWithOperation mount flags mountOperation cancellable callback = do
cCallback <- marshalAsyncReadyCallback callback
(\(Mount arg1) arg2 (MountOperation arg3) (Cancellable arg4) arg5 arg6 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg3 $ \argPtr3 ->withForeignPtr arg4 $ \argPtr4 ->g_mount_unmount_with_operation argPtr1 arg2 argPtr3 argPtr4 arg5 arg6)
(toMount mount)
((fromIntegral . fromFlags) flags)
(fromMaybe (MountOperation nullForeignPtr) mountOperation)
(fromMaybe (Cancellable nullForeignPtr) cancellable)
cCallback
(castFunPtrToPtr cCallback)
mountUnmountWithOperationFinish :: MountClass mount
=> mount
-> AsyncResult
-> IO ()
mountUnmountWithOperationFinish mount result =
propagateGError (\gErrorPtr -> do
(\(Mount arg1) (AsyncResult arg2) arg3 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->g_mount_unmount_with_operation_finish argPtr1 argPtr2 arg3)
(toMount mount)
result
gErrorPtr
return ())
mountRemount :: MountClass mount
=> mount
-> [MountMountFlags]
-> Maybe MountOperation
-> Maybe Cancellable
-> AsyncReadyCallback
-> IO ()
mountRemount mount flags mountOperation cancellable callback = do
cCallback <- marshalAsyncReadyCallback callback
(\(Mount arg1) arg2 (MountOperation arg3) (Cancellable arg4) arg5 arg6 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg3 $ \argPtr3 ->withForeignPtr arg4 $ \argPtr4 ->g_mount_remount argPtr1 arg2 argPtr3 argPtr4 arg5 arg6)
(toMount mount)
((fromIntegral . fromFlags) flags)
(fromMaybe (MountOperation nullForeignPtr) mountOperation)
(fromMaybe (Cancellable nullForeignPtr) cancellable)
cCallback
(castFunPtrToPtr cCallback)
mountRemountFinish :: MountClass mount
=> mount
-> AsyncResult
-> IO ()
mountRemountFinish mount result =
propagateGError (\gErrorPtr -> do
(\(Mount arg1) (AsyncResult arg2) arg3 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->g_mount_remount_finish argPtr1 argPtr2 arg3)
(toMount mount)
result
gErrorPtr
return ())
mountCanEject :: MountClass mount => mount
-> IO Bool
mountCanEject mount =
liftM toBool $
(\(Mount arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_mount_can_eject argPtr1) (toMount mount)
mountEjectWithOperation :: MountClass mount
=> mount
-> [MountUnmountFlags]
-> Maybe MountOperation
-> Maybe Cancellable
-> AsyncReadyCallback
-> IO ()
mountEjectWithOperation mount flags mountOperation cancellable callback = do
cCallback <- marshalAsyncReadyCallback callback
(\(Mount arg1) arg2 (MountOperation arg3) (Cancellable arg4) arg5 arg6 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg3 $ \argPtr3 ->withForeignPtr arg4 $ \argPtr4 ->g_mount_eject_with_operation argPtr1 arg2 argPtr3 argPtr4 arg5 arg6)
(toMount mount)
((fromIntegral . fromFlags) flags)
(fromMaybe (MountOperation nullForeignPtr) mountOperation)
(fromMaybe (Cancellable nullForeignPtr) cancellable)
cCallback
(castFunPtrToPtr cCallback)
mountEjectWithOperationFinish :: MountClass mount
=> mount
-> AsyncResult
-> IO ()
mountEjectWithOperationFinish mount result =
propagateGError (\gErrorPtr -> do
(\(Mount arg1) (AsyncResult arg2) arg3 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->g_mount_eject_with_operation_finish argPtr1 argPtr2 arg3)
(toMount mount)
result
gErrorPtr
return ())
mountGuessContentType :: MountClass mount => mount
-> Bool
-> Maybe Cancellable
-> AsyncReadyCallback
-> IO ()
mountGuessContentType mount forceRescan cancellable callback = do
cCallback <- marshalAsyncReadyCallback callback
(\(Mount arg1) arg2 (Cancellable arg3) arg4 arg5 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg3 $ \argPtr3 ->g_mount_guess_content_type argPtr1 arg2 argPtr3 arg4 arg5)
(toMount mount)
(fromBool forceRescan)
(fromMaybe (Cancellable nullForeignPtr) cancellable)
cCallback
(castFunPtrToPtr cCallback)
mountGuessContentTypeFinish :: MountClass mount => mount
-> AsyncResult
-> IO [String]
mountGuessContentTypeFinish mount result =
propagateGError ((\(Mount arg1) (AsyncResult arg2) arg3 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->g_mount_guess_content_type_finish argPtr1 argPtr2 arg3) (toMount mount) result)
>>= readUTFStringArray0
mountGuessContentTypeSync :: MountClass mount => mount
-> Bool
-> Maybe Cancellable
-> IO [String]
mountGuessContentTypeSync mount forceRescan cancellable =
propagateGError ((\(Mount arg1) arg2 (Cancellable arg3) arg4 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg3 $ \argPtr3 ->g_mount_guess_content_type_sync argPtr1 arg2 argPtr3 arg4)
(toMount mount)
(fromBool forceRescan)
(fromMaybe (Cancellable nullForeignPtr) cancellable)
)
>>= readUTFStringArray0
mountIsShadowed :: MountClass mount => mount
-> IO Bool
mountIsShadowed mount =
liftM toBool $
(\(Mount arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_mount_is_shadowed argPtr1) (toMount mount)
mountShadow :: MountClass mount => mount -> IO ()
mountShadow mount =
(\(Mount arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_mount_shadow argPtr1) (toMount mount)
mountUnshadow :: MountClass mount => mount -> IO ()
mountUnshadow mount =
(\(Mount arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_mount_unshadow argPtr1) (toMount mount)
mountChanged :: MountClass mount => Signal mount (IO ())
mountChanged = Signal (connect_NONE__NONE "changed")
mountPreUnmount :: MountClass mount => Signal mount (IO ())
mountPreUnmount = Signal (connect_NONE__NONE "pre-unmount")
mountUnmounted :: MountClass mount => Signal mount (IO ())
mountUnmounted = Signal (connect_NONE__NONE "unmounted")
foreign import ccall safe "g_mount_get_name"
g_mount_get_name :: ((Ptr Mount) -> (IO (Ptr CChar)))
foreign import ccall safe "g_mount_get_uuid"
g_mount_get_uuid :: ((Ptr Mount) -> (IO (Ptr CChar)))
foreign import ccall safe "g_mount_get_icon"
g_mount_get_icon :: ((Ptr Mount) -> (IO (Ptr Icon)))
foreign import ccall safe "g_mount_get_drive"
g_mount_get_drive :: ((Ptr Mount) -> (IO (Ptr Drive)))
foreign import ccall safe "g_mount_get_root"
g_mount_get_root :: ((Ptr Mount) -> (IO (Ptr File)))
foreign import ccall safe "g_mount_get_volume"
g_mount_get_volume :: ((Ptr Mount) -> (IO (Ptr Volume)))
foreign import ccall safe "g_mount_get_default_location"
g_mount_get_default_location :: ((Ptr Mount) -> (IO (Ptr File)))
foreign import ccall safe "g_mount_can_unmount"
g_mount_can_unmount :: ((Ptr Mount) -> (IO CInt))
foreign import ccall safe "g_mount_unmount_with_operation"
g_mount_unmount_with_operation :: ((Ptr Mount) -> (CInt -> ((Ptr MountOperation) -> ((Ptr Cancellable) -> ((FunPtr ((Ptr ()) -> ((Ptr AsyncResult) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> (IO ())))))))
foreign import ccall safe "g_mount_unmount_with_operation_finish"
g_mount_unmount_with_operation_finish :: ((Ptr Mount) -> ((Ptr AsyncResult) -> ((Ptr (Ptr ())) -> (IO CInt))))
foreign import ccall safe "g_mount_remount"
g_mount_remount :: ((Ptr Mount) -> (CInt -> ((Ptr MountOperation) -> ((Ptr Cancellable) -> ((FunPtr ((Ptr ()) -> ((Ptr AsyncResult) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> (IO ())))))))
foreign import ccall safe "g_mount_remount_finish"
g_mount_remount_finish :: ((Ptr Mount) -> ((Ptr AsyncResult) -> ((Ptr (Ptr ())) -> (IO CInt))))
foreign import ccall safe "g_mount_can_eject"
g_mount_can_eject :: ((Ptr Mount) -> (IO CInt))
foreign import ccall safe "g_mount_eject_with_operation"
g_mount_eject_with_operation :: ((Ptr Mount) -> (CInt -> ((Ptr MountOperation) -> ((Ptr Cancellable) -> ((FunPtr ((Ptr ()) -> ((Ptr AsyncResult) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> (IO ())))))))
foreign import ccall safe "g_mount_eject_with_operation_finish"
g_mount_eject_with_operation_finish :: ((Ptr Mount) -> ((Ptr AsyncResult) -> ((Ptr (Ptr ())) -> (IO CInt))))
foreign import ccall safe "g_mount_guess_content_type"
g_mount_guess_content_type :: ((Ptr Mount) -> (CInt -> ((Ptr Cancellable) -> ((FunPtr ((Ptr ()) -> ((Ptr AsyncResult) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> (IO ()))))))
foreign import ccall safe "g_mount_guess_content_type_finish"
g_mount_guess_content_type_finish :: ((Ptr Mount) -> ((Ptr AsyncResult) -> ((Ptr (Ptr ())) -> (IO (Ptr (Ptr CChar))))))
foreign import ccall safe "g_mount_guess_content_type_sync"
g_mount_guess_content_type_sync :: ((Ptr Mount) -> (CInt -> ((Ptr Cancellable) -> ((Ptr (Ptr ())) -> (IO (Ptr (Ptr CChar)))))))
foreign import ccall safe "g_mount_is_shadowed"
g_mount_is_shadowed :: ((Ptr Mount) -> (IO CInt))
foreign import ccall safe "g_mount_shadow"
g_mount_shadow :: ((Ptr Mount) -> (IO ()))
foreign import ccall safe "g_mount_unshadow"
g_mount_unshadow :: ((Ptr Mount) -> (IO ()))