module System.GIO.Volumes.VolumeMonitor (
VolumeMonitor(..),
VolumeMonitorClass,
volumeMonitorGet,
volumeMonitorGetConnectedDrives,
volumeMonitorGetVolumes,
volumeMonitorGetMounts,
volumeMonitorGetMountForUUID,
volumeMonitorGetVolumeForUUID,
vmDriveChanged,
vmDriveConnected,
vmDriveDisconnected,
vmDriveEjectButton,
vmDriveStopButton,
vmMountAdded,
vmMountChanged,
vmMountPreUnmount,
vmMountRemoved,
vmVolumeAdded,
vmVolumeChanged,
vmVolumeRemoved,
) where
import Control.Monad
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.Signals
import System.GIO.Types
volumeMonitorGet :: IO VolumeMonitor
volumeMonitorGet =
wrapNewGObject mkVolumeMonitor $
g_volume_monitor_get
volumeMonitorGetConnectedDrives :: VolumeMonitorClass monitor => monitor
-> IO [Drive]
volumeMonitorGetConnectedDrives monitor = do
glistPtr <- (\(VolumeMonitor arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_volume_monitor_get_connected_drives argPtr1) (toVolumeMonitor monitor)
drivePtrs <- fromGList glistPtr
mapM (wrapNewGObject mkDrive . return) drivePtrs
volumeMonitorGetVolumes :: VolumeMonitorClass monitor => monitor
-> IO [Drive]
volumeMonitorGetVolumes monitor = do
glistPtr <- (\(VolumeMonitor arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_volume_monitor_get_volumes argPtr1) (toVolumeMonitor monitor)
volumePtrs <- fromGList glistPtr
mapM (wrapNewGObject mkDrive . return) volumePtrs
volumeMonitorGetMounts :: VolumeMonitorClass monitor => monitor
-> IO [Drive]
volumeMonitorGetMounts monitor = do
glistPtr <- (\(VolumeMonitor arg1) -> withForeignPtr arg1 $ \argPtr1 ->g_volume_monitor_get_mounts argPtr1) (toVolumeMonitor monitor)
mountPtrs <- fromGList glistPtr
mapM (wrapNewGObject mkDrive . return) mountPtrs
volumeMonitorGetMountForUUID :: VolumeMonitorClass monitor => monitor
-> String
-> IO (Maybe Mount)
volumeMonitorGetMountForUUID monitor uuid =
maybeNull (wrapNewGObject mkMount) $
withUTFString uuid $ \ uuidPtr ->
(\(VolumeMonitor arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->g_volume_monitor_get_mount_for_uuid argPtr1 arg2) (toVolumeMonitor monitor) uuidPtr
volumeMonitorGetVolumeForUUID :: VolumeMonitorClass monitor => monitor
-> String
-> IO (Maybe Volume)
volumeMonitorGetVolumeForUUID monitor uuid =
maybeNull (wrapNewGObject mkVolume) $
withUTFString uuid $ \ uuidPtr ->
(\(VolumeMonitor arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->g_volume_monitor_get_volume_for_uuid argPtr1 arg2) (toVolumeMonitor monitor) uuidPtr
vmDriveChanged :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())
vmDriveChanged = Signal (connect_OBJECT__NONE "drive-changed")
vmDriveConnected :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())
vmDriveConnected = Signal (connect_OBJECT__NONE "drive-connected")
vmDriveDisconnected :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())
vmDriveDisconnected = Signal (connect_OBJECT__NONE "drive-disconnected")
vmDriveEjectButton :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())
vmDriveEjectButton = Signal (connect_OBJECT__NONE "drive-eject-button")
vmDriveStopButton :: VolumeMonitorClass monitor => Signal monitor (Drive -> IO ())
vmDriveStopButton = Signal (connect_OBJECT__NONE "drive-stop-button")
vmMountAdded :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ())
vmMountAdded = Signal (connect_OBJECT__NONE "mount-added")
vmMountChanged :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ())
vmMountChanged = Signal (connect_OBJECT__NONE "mount-changed")
vmMountPreUnmount :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ())
vmMountPreUnmount = Signal (connect_OBJECT__NONE "mount-pre-unmount")
vmMountRemoved :: VolumeMonitorClass monitor => Signal monitor (Mount -> IO ())
vmMountRemoved = Signal (connect_OBJECT__NONE "mount-removed")
vmVolumeAdded :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ())
vmVolumeAdded = Signal (connect_OBJECT__NONE "volume-added")
vmVolumeChanged :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ())
vmVolumeChanged = Signal (connect_OBJECT__NONE "volume-changed")
vmVolumeRemoved :: VolumeMonitorClass monitor => Signal monitor (Volume -> IO ())
vmVolumeRemoved = Signal (connect_OBJECT__NONE "volume-removed")
foreign import ccall safe "g_volume_monitor_get"
g_volume_monitor_get :: (IO (Ptr VolumeMonitor))
foreign import ccall safe "g_volume_monitor_get_connected_drives"
g_volume_monitor_get_connected_drives :: ((Ptr VolumeMonitor) -> (IO (Ptr ())))
foreign import ccall safe "g_volume_monitor_get_volumes"
g_volume_monitor_get_volumes :: ((Ptr VolumeMonitor) -> (IO (Ptr ())))
foreign import ccall safe "g_volume_monitor_get_mounts"
g_volume_monitor_get_mounts :: ((Ptr VolumeMonitor) -> (IO (Ptr ())))
foreign import ccall safe "g_volume_monitor_get_mount_for_uuid"
g_volume_monitor_get_mount_for_uuid :: ((Ptr VolumeMonitor) -> ((Ptr CChar) -> (IO (Ptr Mount))))
foreign import ccall safe "g_volume_monitor_get_volume_for_uuid"
g_volume_monitor_get_volume_for_uuid :: ((Ptr VolumeMonitor) -> ((Ptr CChar) -> (IO (Ptr Volume))))