{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Watches @/GUnixMounts/@ for changes.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Gio.Objects.UnixMountMonitor
    ( 

-- * Exported types
    UnixMountMonitor(..)                    ,
    IsUnixMountMonitor                      ,
    toUnixMountMonitor                      ,
    noUnixMountMonitor                      ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveUnixMountMonitorMethod           ,
#endif


-- ** get #method:get#

    unixMountMonitorGet                     ,


-- ** new #method:new#

    unixMountMonitorNew                     ,


-- ** setRateLimit #method:setRateLimit#

#if defined(ENABLE_OVERLOADING)
    UnixMountMonitorSetRateLimitMethodInfo  ,
#endif
    unixMountMonitorSetRateLimit            ,




 -- * Signals
-- ** mountpointsChanged #signal:mountpointsChanged#

    C_UnixMountMonitorMountpointsChangedCallback,
    UnixMountMonitorMountpointsChangedCallback,
#if defined(ENABLE_OVERLOADING)
    UnixMountMonitorMountpointsChangedSignalInfo,
#endif
    afterUnixMountMonitorMountpointsChanged ,
    genClosure_UnixMountMonitorMountpointsChanged,
    mk_UnixMountMonitorMountpointsChangedCallback,
    noUnixMountMonitorMountpointsChangedCallback,
    onUnixMountMonitorMountpointsChanged    ,
    wrap_UnixMountMonitorMountpointsChangedCallback,


-- ** mountsChanged #signal:mountsChanged#

    C_UnixMountMonitorMountsChangedCallback ,
    UnixMountMonitorMountsChangedCallback   ,
#if defined(ENABLE_OVERLOADING)
    UnixMountMonitorMountsChangedSignalInfo ,
#endif
    afterUnixMountMonitorMountsChanged      ,
    genClosure_UnixMountMonitorMountsChanged,
    mk_UnixMountMonitorMountsChangedCallback,
    noUnixMountMonitorMountsChangedCallback ,
    onUnixMountMonitorMountsChanged         ,
    wrap_UnixMountMonitorMountsChangedCallback,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object

-- | Memory-managed wrapper type.
newtype UnixMountMonitor = UnixMountMonitor (ManagedPtr UnixMountMonitor)
    deriving (UnixMountMonitor -> UnixMountMonitor -> Bool
(UnixMountMonitor -> UnixMountMonitor -> Bool)
-> (UnixMountMonitor -> UnixMountMonitor -> Bool)
-> Eq UnixMountMonitor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnixMountMonitor -> UnixMountMonitor -> Bool
$c/= :: UnixMountMonitor -> UnixMountMonitor -> Bool
== :: UnixMountMonitor -> UnixMountMonitor -> Bool
$c== :: UnixMountMonitor -> UnixMountMonitor -> Bool
Eq)
foreign import ccall "g_unix_mount_monitor_get_type"
    c_g_unix_mount_monitor_get_type :: IO GType

instance GObject UnixMountMonitor where
    gobjectType :: IO GType
gobjectType = IO GType
c_g_unix_mount_monitor_get_type
    

-- | Convert 'UnixMountMonitor' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue UnixMountMonitor where
    toGValue :: UnixMountMonitor -> IO GValue
toGValue o :: UnixMountMonitor
o = do
        GType
gtype <- IO GType
c_g_unix_mount_monitor_get_type
        UnixMountMonitor
-> (Ptr UnixMountMonitor -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr UnixMountMonitor
o (GType
-> (GValue -> Ptr UnixMountMonitor -> IO ())
-> Ptr UnixMountMonitor
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr UnixMountMonitor -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO UnixMountMonitor
fromGValue gv :: GValue
gv = do
        Ptr UnixMountMonitor
ptr <- GValue -> IO (Ptr UnixMountMonitor)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr UnixMountMonitor)
        (ManagedPtr UnixMountMonitor -> UnixMountMonitor)
-> Ptr UnixMountMonitor -> IO UnixMountMonitor
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr UnixMountMonitor -> UnixMountMonitor
UnixMountMonitor Ptr UnixMountMonitor
ptr
        
    

-- | Type class for types which can be safely cast to `UnixMountMonitor`, for instance with `toUnixMountMonitor`.
class (GObject o, O.IsDescendantOf UnixMountMonitor o) => IsUnixMountMonitor o
instance (GObject o, O.IsDescendantOf UnixMountMonitor o) => IsUnixMountMonitor o

instance O.HasParentTypes UnixMountMonitor
type instance O.ParentTypes UnixMountMonitor = '[GObject.Object.Object]

-- | Cast to `UnixMountMonitor`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toUnixMountMonitor :: (MonadIO m, IsUnixMountMonitor o) => o -> m UnixMountMonitor
toUnixMountMonitor :: o -> m UnixMountMonitor
toUnixMountMonitor = IO UnixMountMonitor -> m UnixMountMonitor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO UnixMountMonitor -> m UnixMountMonitor)
-> (o -> IO UnixMountMonitor) -> o -> m UnixMountMonitor
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr UnixMountMonitor -> UnixMountMonitor)
-> o -> IO UnixMountMonitor
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr UnixMountMonitor -> UnixMountMonitor
UnixMountMonitor

-- | A convenience alias for `Nothing` :: `Maybe` `UnixMountMonitor`.
noUnixMountMonitor :: Maybe UnixMountMonitor
noUnixMountMonitor :: Maybe UnixMountMonitor
noUnixMountMonitor = Maybe UnixMountMonitor
forall a. Maybe a
Nothing

#if defined(ENABLE_OVERLOADING)
type family ResolveUnixMountMonitorMethod (t :: Symbol) (o :: *) :: * where
    ResolveUnixMountMonitorMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveUnixMountMonitorMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveUnixMountMonitorMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveUnixMountMonitorMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveUnixMountMonitorMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveUnixMountMonitorMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveUnixMountMonitorMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveUnixMountMonitorMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveUnixMountMonitorMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveUnixMountMonitorMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveUnixMountMonitorMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveUnixMountMonitorMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveUnixMountMonitorMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveUnixMountMonitorMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveUnixMountMonitorMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveUnixMountMonitorMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveUnixMountMonitorMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveUnixMountMonitorMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveUnixMountMonitorMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveUnixMountMonitorMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveUnixMountMonitorMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveUnixMountMonitorMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveUnixMountMonitorMethod "setRateLimit" o = UnixMountMonitorSetRateLimitMethodInfo
    ResolveUnixMountMonitorMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveUnixMountMonitorMethod t UnixMountMonitor, O.MethodInfo info UnixMountMonitor p) => OL.IsLabel t (UnixMountMonitor -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif

-- signal UnixMountMonitor::mountpoints-changed
-- | Emitted when the unix mount points have changed.
type UnixMountMonitorMountpointsChangedCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `UnixMountMonitorMountpointsChangedCallback`@.
noUnixMountMonitorMountpointsChangedCallback :: Maybe UnixMountMonitorMountpointsChangedCallback
noUnixMountMonitorMountpointsChangedCallback :: Maybe (IO ())
noUnixMountMonitorMountpointsChangedCallback = Maybe (IO ())
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_UnixMountMonitorMountpointsChangedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_UnixMountMonitorMountpointsChangedCallback`.
foreign import ccall "wrapper"
    mk_UnixMountMonitorMountpointsChangedCallback :: C_UnixMountMonitorMountpointsChangedCallback -> IO (FunPtr C_UnixMountMonitorMountpointsChangedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_UnixMountMonitorMountpointsChanged :: MonadIO m => UnixMountMonitorMountpointsChangedCallback -> m (GClosure C_UnixMountMonitorMountpointsChangedCallback)
genClosure_UnixMountMonitorMountpointsChanged :: IO () -> m (GClosure C_UnixMountMonitorMountpointsChangedCallback)
genClosure_UnixMountMonitorMountpointsChanged cb :: IO ()
cb = IO (GClosure C_UnixMountMonitorMountpointsChangedCallback)
-> m (GClosure C_UnixMountMonitorMountpointsChangedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_UnixMountMonitorMountpointsChangedCallback)
 -> m (GClosure C_UnixMountMonitorMountpointsChangedCallback))
-> IO (GClosure C_UnixMountMonitorMountpointsChangedCallback)
-> m (GClosure C_UnixMountMonitorMountpointsChangedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_UnixMountMonitorMountpointsChangedCallback
cb' = IO () -> C_UnixMountMonitorMountpointsChangedCallback
wrap_UnixMountMonitorMountpointsChangedCallback IO ()
cb
    C_UnixMountMonitorMountpointsChangedCallback
-> IO (FunPtr C_UnixMountMonitorMountpointsChangedCallback)
mk_UnixMountMonitorMountpointsChangedCallback C_UnixMountMonitorMountpointsChangedCallback
cb' IO (FunPtr C_UnixMountMonitorMountpointsChangedCallback)
-> (FunPtr C_UnixMountMonitorMountpointsChangedCallback
    -> IO (GClosure C_UnixMountMonitorMountpointsChangedCallback))
-> IO (GClosure C_UnixMountMonitorMountpointsChangedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_UnixMountMonitorMountpointsChangedCallback
-> IO (GClosure C_UnixMountMonitorMountpointsChangedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `UnixMountMonitorMountpointsChangedCallback` into a `C_UnixMountMonitorMountpointsChangedCallback`.
wrap_UnixMountMonitorMountpointsChangedCallback ::
    UnixMountMonitorMountpointsChangedCallback ->
    C_UnixMountMonitorMountpointsChangedCallback
wrap_UnixMountMonitorMountpointsChangedCallback :: IO () -> C_UnixMountMonitorMountpointsChangedCallback
wrap_UnixMountMonitorMountpointsChangedCallback _cb :: IO ()
_cb _ _ = do
    IO ()
_cb 


-- | Connect a signal handler for the [mountpointsChanged](#signal:mountpointsChanged) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' unixMountMonitor #mountpointsChanged callback
-- @
-- 
-- 
onUnixMountMonitorMountpointsChanged :: (IsUnixMountMonitor a, MonadIO m) => a -> UnixMountMonitorMountpointsChangedCallback -> m SignalHandlerId
onUnixMountMonitorMountpointsChanged :: a -> IO () -> m SignalHandlerId
onUnixMountMonitorMountpointsChanged obj :: a
obj cb :: IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_UnixMountMonitorMountpointsChangedCallback
cb' = IO () -> C_UnixMountMonitorMountpointsChangedCallback
wrap_UnixMountMonitorMountpointsChangedCallback IO ()
cb
    FunPtr C_UnixMountMonitorMountpointsChangedCallback
cb'' <- C_UnixMountMonitorMountpointsChangedCallback
-> IO (FunPtr C_UnixMountMonitorMountpointsChangedCallback)
mk_UnixMountMonitorMountpointsChangedCallback C_UnixMountMonitorMountpointsChangedCallback
cb'
    a
-> Text
-> FunPtr C_UnixMountMonitorMountpointsChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "mountpoints-changed" FunPtr C_UnixMountMonitorMountpointsChangedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [mountpointsChanged](#signal:mountpointsChanged) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' unixMountMonitor #mountpointsChanged callback
-- @
-- 
-- 
afterUnixMountMonitorMountpointsChanged :: (IsUnixMountMonitor a, MonadIO m) => a -> UnixMountMonitorMountpointsChangedCallback -> m SignalHandlerId
afterUnixMountMonitorMountpointsChanged :: a -> IO () -> m SignalHandlerId
afterUnixMountMonitorMountpointsChanged obj :: a
obj cb :: IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_UnixMountMonitorMountpointsChangedCallback
cb' = IO () -> C_UnixMountMonitorMountpointsChangedCallback
wrap_UnixMountMonitorMountpointsChangedCallback IO ()
cb
    FunPtr C_UnixMountMonitorMountpointsChangedCallback
cb'' <- C_UnixMountMonitorMountpointsChangedCallback
-> IO (FunPtr C_UnixMountMonitorMountpointsChangedCallback)
mk_UnixMountMonitorMountpointsChangedCallback C_UnixMountMonitorMountpointsChangedCallback
cb'
    a
-> Text
-> FunPtr C_UnixMountMonitorMountpointsChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "mountpoints-changed" FunPtr C_UnixMountMonitorMountpointsChangedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data UnixMountMonitorMountpointsChangedSignalInfo
instance SignalInfo UnixMountMonitorMountpointsChangedSignalInfo where
    type HaskellCallbackType UnixMountMonitorMountpointsChangedSignalInfo = UnixMountMonitorMountpointsChangedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_UnixMountMonitorMountpointsChangedCallback cb
        cb'' <- mk_UnixMountMonitorMountpointsChangedCallback cb'
        connectSignalFunPtr obj "mountpoints-changed" cb'' connectMode detail

#endif

-- signal UnixMountMonitor::mounts-changed
-- | Emitted when the unix mounts have changed.
type UnixMountMonitorMountsChangedCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `UnixMountMonitorMountsChangedCallback`@.
noUnixMountMonitorMountsChangedCallback :: Maybe UnixMountMonitorMountsChangedCallback
noUnixMountMonitorMountsChangedCallback :: Maybe (IO ())
noUnixMountMonitorMountsChangedCallback = Maybe (IO ())
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_UnixMountMonitorMountsChangedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_UnixMountMonitorMountsChangedCallback`.
foreign import ccall "wrapper"
    mk_UnixMountMonitorMountsChangedCallback :: C_UnixMountMonitorMountsChangedCallback -> IO (FunPtr C_UnixMountMonitorMountsChangedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_UnixMountMonitorMountsChanged :: MonadIO m => UnixMountMonitorMountsChangedCallback -> m (GClosure C_UnixMountMonitorMountsChangedCallback)
genClosure_UnixMountMonitorMountsChanged :: IO () -> m (GClosure C_UnixMountMonitorMountpointsChangedCallback)
genClosure_UnixMountMonitorMountsChanged cb :: IO ()
cb = IO (GClosure C_UnixMountMonitorMountpointsChangedCallback)
-> m (GClosure C_UnixMountMonitorMountpointsChangedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_UnixMountMonitorMountpointsChangedCallback)
 -> m (GClosure C_UnixMountMonitorMountpointsChangedCallback))
-> IO (GClosure C_UnixMountMonitorMountpointsChangedCallback)
-> m (GClosure C_UnixMountMonitorMountpointsChangedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_UnixMountMonitorMountpointsChangedCallback
cb' = IO () -> C_UnixMountMonitorMountpointsChangedCallback
wrap_UnixMountMonitorMountsChangedCallback IO ()
cb
    C_UnixMountMonitorMountpointsChangedCallback
-> IO (FunPtr C_UnixMountMonitorMountpointsChangedCallback)
mk_UnixMountMonitorMountsChangedCallback C_UnixMountMonitorMountpointsChangedCallback
cb' IO (FunPtr C_UnixMountMonitorMountpointsChangedCallback)
-> (FunPtr C_UnixMountMonitorMountpointsChangedCallback
    -> IO (GClosure C_UnixMountMonitorMountpointsChangedCallback))
-> IO (GClosure C_UnixMountMonitorMountpointsChangedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_UnixMountMonitorMountpointsChangedCallback
-> IO (GClosure C_UnixMountMonitorMountpointsChangedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `UnixMountMonitorMountsChangedCallback` into a `C_UnixMountMonitorMountsChangedCallback`.
wrap_UnixMountMonitorMountsChangedCallback ::
    UnixMountMonitorMountsChangedCallback ->
    C_UnixMountMonitorMountsChangedCallback
wrap_UnixMountMonitorMountsChangedCallback :: IO () -> C_UnixMountMonitorMountpointsChangedCallback
wrap_UnixMountMonitorMountsChangedCallback _cb :: IO ()
_cb _ _ = do
    IO ()
_cb 


-- | Connect a signal handler for the [mountsChanged](#signal:mountsChanged) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' unixMountMonitor #mountsChanged callback
-- @
-- 
-- 
onUnixMountMonitorMountsChanged :: (IsUnixMountMonitor a, MonadIO m) => a -> UnixMountMonitorMountsChangedCallback -> m SignalHandlerId
onUnixMountMonitorMountsChanged :: a -> IO () -> m SignalHandlerId
onUnixMountMonitorMountsChanged obj :: a
obj cb :: IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_UnixMountMonitorMountpointsChangedCallback
cb' = IO () -> C_UnixMountMonitorMountpointsChangedCallback
wrap_UnixMountMonitorMountsChangedCallback IO ()
cb
    FunPtr C_UnixMountMonitorMountpointsChangedCallback
cb'' <- C_UnixMountMonitorMountpointsChangedCallback
-> IO (FunPtr C_UnixMountMonitorMountpointsChangedCallback)
mk_UnixMountMonitorMountsChangedCallback C_UnixMountMonitorMountpointsChangedCallback
cb'
    a
-> Text
-> FunPtr C_UnixMountMonitorMountpointsChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "mounts-changed" FunPtr C_UnixMountMonitorMountpointsChangedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [mountsChanged](#signal:mountsChanged) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' unixMountMonitor #mountsChanged callback
-- @
-- 
-- 
afterUnixMountMonitorMountsChanged :: (IsUnixMountMonitor a, MonadIO m) => a -> UnixMountMonitorMountsChangedCallback -> m SignalHandlerId
afterUnixMountMonitorMountsChanged :: a -> IO () -> m SignalHandlerId
afterUnixMountMonitorMountsChanged obj :: a
obj cb :: IO ()
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_UnixMountMonitorMountpointsChangedCallback
cb' = IO () -> C_UnixMountMonitorMountpointsChangedCallback
wrap_UnixMountMonitorMountsChangedCallback IO ()
cb
    FunPtr C_UnixMountMonitorMountpointsChangedCallback
cb'' <- C_UnixMountMonitorMountpointsChangedCallback
-> IO (FunPtr C_UnixMountMonitorMountpointsChangedCallback)
mk_UnixMountMonitorMountsChangedCallback C_UnixMountMonitorMountpointsChangedCallback
cb'
    a
-> Text
-> FunPtr C_UnixMountMonitorMountpointsChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "mounts-changed" FunPtr C_UnixMountMonitorMountpointsChangedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data UnixMountMonitorMountsChangedSignalInfo
instance SignalInfo UnixMountMonitorMountsChangedSignalInfo where
    type HaskellCallbackType UnixMountMonitorMountsChangedSignalInfo = UnixMountMonitorMountsChangedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_UnixMountMonitorMountsChangedCallback cb
        cb'' <- mk_UnixMountMonitorMountsChangedCallback cb'
        connectSignalFunPtr obj "mounts-changed" cb'' connectMode detail

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList UnixMountMonitor
type instance O.AttributeList UnixMountMonitor = UnixMountMonitorAttributeList
type UnixMountMonitorAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList UnixMountMonitor = UnixMountMonitorSignalList
type UnixMountMonitorSignalList = ('[ '("mountpointsChanged", UnixMountMonitorMountpointsChangedSignalInfo), '("mountsChanged", UnixMountMonitorMountsChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method UnixMountMonitor::new
-- method type : Constructor
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "UnixMountMonitor" })
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_monitor_new" g_unix_mount_monitor_new :: 
    IO (Ptr UnixMountMonitor)

{-# DEPRECATED unixMountMonitorNew ["(Since version 2.44)","Use 'GI.Gio.Objects.UnixMountMonitor.unixMountMonitorGet' instead."] #-}
-- | Deprecated alias for 'GI.Gio.Objects.UnixMountMonitor.unixMountMonitorGet'.
-- 
-- This function was never a true constructor, which is why it was
-- renamed.
unixMountMonitorNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m UnixMountMonitor
    -- ^ __Returns:__ a t'GI.Gio.Objects.UnixMountMonitor.UnixMountMonitor'.
unixMountMonitorNew :: m UnixMountMonitor
unixMountMonitorNew  = IO UnixMountMonitor -> m UnixMountMonitor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO UnixMountMonitor -> m UnixMountMonitor)
-> IO UnixMountMonitor -> m UnixMountMonitor
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountMonitor
result <- IO (Ptr UnixMountMonitor)
g_unix_mount_monitor_new
    Text -> Ptr UnixMountMonitor -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "unixMountMonitorNew" Ptr UnixMountMonitor
result
    UnixMountMonitor
result' <- ((ManagedPtr UnixMountMonitor -> UnixMountMonitor)
-> Ptr UnixMountMonitor -> IO UnixMountMonitor
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr UnixMountMonitor -> UnixMountMonitor
UnixMountMonitor) Ptr UnixMountMonitor
result
    UnixMountMonitor -> IO UnixMountMonitor
forall (m :: * -> *) a. Monad m => a -> m a
return UnixMountMonitor
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method UnixMountMonitor::set_rate_limit
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "mount_monitor"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountMonitor" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GUnixMountMonitor"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "limit_msec"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a integer with the limit in milliseconds to\n    poll for changes."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_monitor_set_rate_limit" g_unix_mount_monitor_set_rate_limit :: 
    Ptr UnixMountMonitor ->                 -- mount_monitor : TInterface (Name {namespace = "Gio", name = "UnixMountMonitor"})
    Int32 ->                                -- limit_msec : TBasicType TInt
    IO ()

{-# DEPRECATED unixMountMonitorSetRateLimit ["(Since version 2.44)","This function does nothing.  Don\\'t call it."] #-}
-- | This function does nothing.
-- 
-- Before 2.44, this was a partially-effective way of controlling the
-- rate at which events would be reported under some uncommon
-- circumstances.  Since /@mountMonitor@/ is a singleton, it also meant
-- that calling this function would have side effects for other users of
-- the monitor.
-- 
-- /Since: 2.18/
unixMountMonitorSetRateLimit ::
    (B.CallStack.HasCallStack, MonadIO m, IsUnixMountMonitor a) =>
    a
    -- ^ /@mountMonitor@/: a t'GI.Gio.Objects.UnixMountMonitor.UnixMountMonitor'
    -> Int32
    -- ^ /@limitMsec@/: a integer with the limit in milliseconds to
    --     poll for changes.
    -> m ()
unixMountMonitorSetRateLimit :: a -> Int32 -> m ()
unixMountMonitorSetRateLimit mountMonitor :: a
mountMonitor limitMsec :: Int32
limitMsec = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountMonitor
mountMonitor' <- a -> IO (Ptr UnixMountMonitor)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
mountMonitor
    Ptr UnixMountMonitor -> Int32 -> IO ()
g_unix_mount_monitor_set_rate_limit Ptr UnixMountMonitor
mountMonitor' Int32
limitMsec
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
mountMonitor
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data UnixMountMonitorSetRateLimitMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsUnixMountMonitor a) => O.MethodInfo UnixMountMonitorSetRateLimitMethodInfo a signature where
    overloadedMethod = unixMountMonitorSetRateLimit

#endif

-- method UnixMountMonitor::get
-- method type : MemberFunction
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "UnixMountMonitor" })
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_monitor_get" g_unix_mount_monitor_get :: 
    IO (Ptr UnixMountMonitor)

-- | Gets the t'GI.Gio.Objects.UnixMountMonitor.UnixMountMonitor' for the current thread-default main
-- context.
-- 
-- The mount monitor can be used to monitor for changes to the list of
-- mounted filesystems as well as the list of mount points (ie: fstab
-- entries).
-- 
-- You must only call 'GI.GObject.Objects.Object.objectUnref' on the return value from under
-- the same main context as you called this function.
-- 
-- /Since: 2.44/
unixMountMonitorGet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m UnixMountMonitor
    -- ^ __Returns:__ the t'GI.Gio.Objects.UnixMountMonitor.UnixMountMonitor'.
unixMountMonitorGet :: m UnixMountMonitor
unixMountMonitorGet  = IO UnixMountMonitor -> m UnixMountMonitor
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO UnixMountMonitor -> m UnixMountMonitor)
-> IO UnixMountMonitor -> m UnixMountMonitor
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountMonitor
result <- IO (Ptr UnixMountMonitor)
g_unix_mount_monitor_get
    Text -> Ptr UnixMountMonitor -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "unixMountMonitorGet" Ptr UnixMountMonitor
result
    UnixMountMonitor
result' <- ((ManagedPtr UnixMountMonitor -> UnixMountMonitor)
-> Ptr UnixMountMonitor -> IO UnixMountMonitor
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr UnixMountMonitor -> UnixMountMonitor
UnixMountMonitor) Ptr UnixMountMonitor
result
    UnixMountMonitor -> IO UnixMountMonitor
forall (m :: * -> *) a. Monad m => a -> m a
return UnixMountMonitor
result'

#if defined(ENABLE_OVERLOADING)
#endif