-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

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

module GI.Gio.Functions
    ( 

 -- * Methods


-- ** busGet #method:busGet#

    busGet                                  ,


-- ** busGetFinish #method:busGetFinish#

    busGetFinish                            ,


-- ** busGetSync #method:busGetSync#

    busGetSync                              ,


-- ** busOwnName #method:busOwnName#

    busOwnName                              ,


-- ** busOwnNameOnConnection #method:busOwnNameOnConnection#

    busOwnNameOnConnection                  ,


-- ** busUnownName #method:busUnownName#

    busUnownName                            ,


-- ** busUnwatchName #method:busUnwatchName#

    busUnwatchName                          ,


-- ** busWatchName #method:busWatchName#

    busWatchName                            ,


-- ** busWatchNameOnConnection #method:busWatchNameOnConnection#

    busWatchNameOnConnection                ,


-- ** contentTypeCanBeExecutable #method:contentTypeCanBeExecutable#

    contentTypeCanBeExecutable              ,


-- ** contentTypeEquals #method:contentTypeEquals#

    contentTypeEquals                       ,


-- ** contentTypeFromMimeType #method:contentTypeFromMimeType#

    contentTypeFromMimeType                 ,


-- ** contentTypeGetDescription #method:contentTypeGetDescription#

    contentTypeGetDescription               ,


-- ** contentTypeGetGenericIconName #method:contentTypeGetGenericIconName#

    contentTypeGetGenericIconName           ,


-- ** contentTypeGetIcon #method:contentTypeGetIcon#

    contentTypeGetIcon                      ,


-- ** contentTypeGetMimeDirs #method:contentTypeGetMimeDirs#

    contentTypeGetMimeDirs                  ,


-- ** contentTypeGetMimeType #method:contentTypeGetMimeType#

    contentTypeGetMimeType                  ,


-- ** contentTypeGetSymbolicIcon #method:contentTypeGetSymbolicIcon#

    contentTypeGetSymbolicIcon              ,


-- ** contentTypeGuess #method:contentTypeGuess#

    contentTypeGuess                        ,


-- ** contentTypeGuessForTree #method:contentTypeGuessForTree#

    contentTypeGuessForTree                 ,


-- ** contentTypeIsA #method:contentTypeIsA#

    contentTypeIsA                          ,


-- ** contentTypeIsMimeType #method:contentTypeIsMimeType#

    contentTypeIsMimeType                   ,


-- ** contentTypeIsUnknown #method:contentTypeIsUnknown#

    contentTypeIsUnknown                    ,


-- ** contentTypeSetMimeDirs #method:contentTypeSetMimeDirs#

    contentTypeSetMimeDirs                  ,


-- ** contentTypesGetRegistered #method:contentTypesGetRegistered#

    contentTypesGetRegistered               ,


-- ** dbusAddressEscapeValue #method:dbusAddressEscapeValue#

    dbusAddressEscapeValue                  ,


-- ** dbusAddressGetForBusSync #method:dbusAddressGetForBusSync#

    dbusAddressGetForBusSync                ,


-- ** dbusAddressGetStream #method:dbusAddressGetStream#

    dbusAddressGetStream                    ,


-- ** dbusAddressGetStreamFinish #method:dbusAddressGetStreamFinish#

    dbusAddressGetStreamFinish              ,


-- ** dbusAddressGetStreamSync #method:dbusAddressGetStreamSync#

    dbusAddressGetStreamSync                ,


-- ** dbusEscapeObjectPath #method:dbusEscapeObjectPath#

    dbusEscapeObjectPath                    ,


-- ** dbusEscapeObjectPathBytestring #method:dbusEscapeObjectPathBytestring#

    dbusEscapeObjectPathBytestring          ,


-- ** dbusGenerateGuid #method:dbusGenerateGuid#

    dbusGenerateGuid                        ,


-- ** dbusGvalueToGvariant #method:dbusGvalueToGvariant#

    dbusGvalueToGvariant                    ,


-- ** dbusGvariantToGvalue #method:dbusGvariantToGvalue#

    dbusGvariantToGvalue                    ,


-- ** dbusIsAddress #method:dbusIsAddress#

    dbusIsAddress                           ,


-- ** dbusIsErrorName #method:dbusIsErrorName#

    dbusIsErrorName                         ,


-- ** dbusIsGuid #method:dbusIsGuid#

    dbusIsGuid                              ,


-- ** dbusIsInterfaceName #method:dbusIsInterfaceName#

    dbusIsInterfaceName                     ,


-- ** dbusIsMemberName #method:dbusIsMemberName#

    dbusIsMemberName                        ,


-- ** dbusIsName #method:dbusIsName#

    dbusIsName                              ,


-- ** dbusIsSupportedAddress #method:dbusIsSupportedAddress#

    dbusIsSupportedAddress                  ,


-- ** dbusIsUniqueName #method:dbusIsUniqueName#

    dbusIsUniqueName                        ,


-- ** dbusUnescapeObjectPath #method:dbusUnescapeObjectPath#

    dbusUnescapeObjectPath                  ,


-- ** ioErrorFromErrno #method:ioErrorFromErrno#

    ioErrorFromErrno                        ,


-- ** ioErrorQuark #method:ioErrorQuark#

    ioErrorQuark                            ,


-- ** ioModulesScanAllInDirectory #method:ioModulesScanAllInDirectory#

    ioModulesScanAllInDirectory             ,


-- ** ioModulesScanAllInDirectoryWithScope #method:ioModulesScanAllInDirectoryWithScope#

    ioModulesScanAllInDirectoryWithScope    ,


-- ** ioSchedulerCancelAllJobs #method:ioSchedulerCancelAllJobs#

    ioSchedulerCancelAllJobs                ,


-- ** ioSchedulerPushJob #method:ioSchedulerPushJob#

    ioSchedulerPushJob                      ,


-- ** keyfileSettingsBackendNew #method:keyfileSettingsBackendNew#

    keyfileSettingsBackendNew               ,


-- ** memorySettingsBackendNew #method:memorySettingsBackendNew#

    memorySettingsBackendNew                ,


-- ** networkingInit #method:networkingInit#

    networkingInit                          ,


-- ** nullSettingsBackendNew #method:nullSettingsBackendNew#

    nullSettingsBackendNew                  ,


-- ** pollableSourceNew #method:pollableSourceNew#

    pollableSourceNew                       ,


-- ** pollableSourceNewFull #method:pollableSourceNewFull#

    pollableSourceNewFull                   ,


-- ** pollableStreamRead #method:pollableStreamRead#

    pollableStreamRead                      ,


-- ** pollableStreamWrite #method:pollableStreamWrite#

    pollableStreamWrite                     ,


-- ** pollableStreamWriteAll #method:pollableStreamWriteAll#

    pollableStreamWriteAll                  ,


-- ** resourcesEnumerateChildren #method:resourcesEnumerateChildren#

    resourcesEnumerateChildren              ,


-- ** resourcesGetInfo #method:resourcesGetInfo#

    resourcesGetInfo                        ,


-- ** resourcesLookupData #method:resourcesLookupData#

    resourcesLookupData                     ,


-- ** resourcesOpenStream #method:resourcesOpenStream#

    resourcesOpenStream                     ,


-- ** resourcesRegister #method:resourcesRegister#

    resourcesRegister                       ,


-- ** resourcesUnregister #method:resourcesUnregister#

    resourcesUnregister                     ,


-- ** simpleAsyncReportGerrorInIdle #method:simpleAsyncReportGerrorInIdle#

    simpleAsyncReportGerrorInIdle           ,


-- ** unixIsMountPathSystemInternal #method:unixIsMountPathSystemInternal#

    unixIsMountPathSystemInternal           ,


-- ** unixIsSystemDevicePath #method:unixIsSystemDevicePath#

    unixIsSystemDevicePath                  ,


-- ** unixIsSystemFsType #method:unixIsSystemFsType#

    unixIsSystemFsType                      ,


-- ** unixMountAt #method:unixMountAt#

    unixMountAt                             ,


-- ** unixMountCompare #method:unixMountCompare#

    unixMountCompare                        ,


-- ** unixMountCopy #method:unixMountCopy#

    unixMountCopy                           ,


-- ** unixMountFor #method:unixMountFor#

    unixMountFor                            ,


-- ** unixMountFree #method:unixMountFree#

    unixMountFree                           ,


-- ** unixMountGetDevicePath #method:unixMountGetDevicePath#

    unixMountGetDevicePath                  ,


-- ** unixMountGetFsType #method:unixMountGetFsType#

    unixMountGetFsType                      ,


-- ** unixMountGetMountPath #method:unixMountGetMountPath#

    unixMountGetMountPath                   ,


-- ** unixMountGetOptions #method:unixMountGetOptions#

    unixMountGetOptions                     ,


-- ** unixMountGetRootPath #method:unixMountGetRootPath#

    unixMountGetRootPath                    ,


-- ** unixMountGuessCanEject #method:unixMountGuessCanEject#

    unixMountGuessCanEject                  ,


-- ** unixMountGuessIcon #method:unixMountGuessIcon#

    unixMountGuessIcon                      ,


-- ** unixMountGuessName #method:unixMountGuessName#

    unixMountGuessName                      ,


-- ** unixMountGuessShouldDisplay #method:unixMountGuessShouldDisplay#

    unixMountGuessShouldDisplay             ,


-- ** unixMountGuessSymbolicIcon #method:unixMountGuessSymbolicIcon#

    unixMountGuessSymbolicIcon              ,


-- ** unixMountIsReadonly #method:unixMountIsReadonly#

    unixMountIsReadonly                     ,


-- ** unixMountIsSystemInternal #method:unixMountIsSystemInternal#

    unixMountIsSystemInternal               ,


-- ** unixMountPointsChangedSince #method:unixMountPointsChangedSince#

    unixMountPointsChangedSince             ,


-- ** unixMountPointsGet #method:unixMountPointsGet#

    unixMountPointsGet                      ,


-- ** unixMountsChangedSince #method:unixMountsChangedSince#

    unixMountsChangedSince                  ,


-- ** unixMountsGet #method:unixMountsGet#

    unixMountsGet                           ,




    ) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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 GHC.Records as R

import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GLib.Structs.Source as GLib.Source
import qualified GI.GLib.Structs.VariantType as GLib.VariantType
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.File as Gio.File
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Icon as Gio.Icon
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.DBusConnection as Gio.DBusConnection
import {-# SOURCE #-} qualified GI.Gio.Objects.IOStream as Gio.IOStream
import {-# SOURCE #-} qualified GI.Gio.Objects.InputStream as Gio.InputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.OutputStream as Gio.OutputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.SettingsBackend as Gio.SettingsBackend
import {-# SOURCE #-} qualified GI.Gio.Structs.IOModuleScope as Gio.IOModuleScope
import {-# SOURCE #-} qualified GI.Gio.Structs.Resource as Gio.Resource
import {-# SOURCE #-} qualified GI.Gio.Structs.UnixMountEntry as Gio.UnixMountEntry
import {-# SOURCE #-} qualified GI.Gio.Structs.UnixMountPoint as Gio.UnixMountPoint

-- function unix_mounts_get
-- Args: [ Arg
--           { argCName = "time_read"
--           , argType = TBasicType TUInt64
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "guint64 to contain a timestamp, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGList
--                  (TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }))
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mounts_get" g_unix_mounts_get :: 
    Ptr Word64 ->                           -- time_read : TBasicType TUInt64
    IO (Ptr (GList (Ptr Gio.UnixMountEntry.UnixMountEntry)))

-- | Gets a t'GI.GLib.Structs.List.List' of t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' containing the unix mounts.
-- If /@timeRead@/ is set, it will be filled with the mount
-- timestamp, allowing for checking if the mounts have changed
-- with 'GI.Gio.Functions.unixMountsChangedSince'.
unixMountsGet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m (([Gio.UnixMountEntry.UnixMountEntry], Word64))
    -- ^ __Returns:__ 
    --     a t'GI.GLib.Structs.List.List' of the UNIX mounts.
unixMountsGet :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
m ([UnixMountEntry], Word64)
unixMountsGet  = IO ([UnixMountEntry], Word64) -> m ([UnixMountEntry], Word64)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ([UnixMountEntry], Word64) -> m ([UnixMountEntry], Word64))
-> IO ([UnixMountEntry], Word64) -> m ([UnixMountEntry], Word64)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Word64
timeRead <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
    Ptr (GList (Ptr UnixMountEntry))
result <- Ptr Word64 -> IO (Ptr (GList (Ptr UnixMountEntry)))
g_unix_mounts_get Ptr Word64
timeRead
    [Ptr UnixMountEntry]
result' <- Ptr (GList (Ptr UnixMountEntry)) -> IO [Ptr UnixMountEntry]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr UnixMountEntry))
result
    [UnixMountEntry]
result'' <- (Ptr UnixMountEntry -> IO UnixMountEntry)
-> [Ptr UnixMountEntry] -> IO [UnixMountEntry]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr UnixMountEntry -> UnixMountEntry)
-> Ptr UnixMountEntry -> IO UnixMountEntry
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr UnixMountEntry -> UnixMountEntry
Gio.UnixMountEntry.UnixMountEntry) [Ptr UnixMountEntry]
result'
    Ptr (GList (Ptr UnixMountEntry)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr UnixMountEntry))
result
    Word64
timeRead' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
timeRead
    Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
timeRead
    ([UnixMountEntry], Word64) -> IO ([UnixMountEntry], Word64)
forall (m :: * -> *) a. Monad m => a -> m a
return ([UnixMountEntry]
result'', Word64
timeRead')


-- function unix_mounts_changed_since
-- Args: [ Arg
--           { argCName = "time"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "guint64 to contain a timestamp."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mounts_changed_since" g_unix_mounts_changed_since :: 
    Word64 ->                               -- time : TBasicType TUInt64
    IO CInt

-- | Checks if the unix mounts have changed since a given unix time.
unixMountsChangedSince ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    -- ^ /@time@/: guint64 to contain a timestamp.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the mounts have changed since /@time@/.
unixMountsChangedSince :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word64 -> m Bool
unixMountsChangedSince Word64
time = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CInt
result <- Word64 -> IO CInt
g_unix_mounts_changed_since Word64
time
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function unix_mount_points_get
-- Args: [ Arg
--           { argCName = "time_read"
--           , argType = TBasicType TUInt64
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "guint64 to contain a timestamp."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGList
--                  (TInterface Name { namespace = "Gio" , name = "UnixMountPoint" }))
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_points_get" g_unix_mount_points_get :: 
    Ptr Word64 ->                           -- time_read : TBasicType TUInt64
    IO (Ptr (GList (Ptr Gio.UnixMountPoint.UnixMountPoint)))

-- | Gets a t'GI.GLib.Structs.List.List' of t'GI.Gio.Structs.UnixMountPoint.UnixMountPoint' containing the unix mount points.
-- If /@timeRead@/ is set, it will be filled with the mount timestamp,
-- allowing for checking if the mounts have changed with
-- 'GI.Gio.Functions.unixMountPointsChangedSince'.
unixMountPointsGet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m (([Gio.UnixMountPoint.UnixMountPoint], Word64))
    -- ^ __Returns:__ 
    --     a t'GI.GLib.Structs.List.List' of the UNIX mountpoints.
unixMountPointsGet :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
m ([UnixMountPoint], Word64)
unixMountPointsGet  = IO ([UnixMountPoint], Word64) -> m ([UnixMountPoint], Word64)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ([UnixMountPoint], Word64) -> m ([UnixMountPoint], Word64))
-> IO ([UnixMountPoint], Word64) -> m ([UnixMountPoint], Word64)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Word64
timeRead <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
    Ptr (GList (Ptr UnixMountPoint))
result <- Ptr Word64 -> IO (Ptr (GList (Ptr UnixMountPoint)))
g_unix_mount_points_get Ptr Word64
timeRead
    [Ptr UnixMountPoint]
result' <- Ptr (GList (Ptr UnixMountPoint)) -> IO [Ptr UnixMountPoint]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr UnixMountPoint))
result
    [UnixMountPoint]
result'' <- (Ptr UnixMountPoint -> IO UnixMountPoint)
-> [Ptr UnixMountPoint] -> IO [UnixMountPoint]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr UnixMountPoint -> UnixMountPoint)
-> Ptr UnixMountPoint -> IO UnixMountPoint
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr UnixMountPoint -> UnixMountPoint
Gio.UnixMountPoint.UnixMountPoint) [Ptr UnixMountPoint]
result'
    Ptr (GList (Ptr UnixMountPoint)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr UnixMountPoint))
result
    Word64
timeRead' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
timeRead
    Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
timeRead
    ([UnixMountPoint], Word64) -> IO ([UnixMountPoint], Word64)
forall (m :: * -> *) a. Monad m => a -> m a
return ([UnixMountPoint]
result'', Word64
timeRead')


-- function unix_mount_points_changed_since
-- Args: [ Arg
--           { argCName = "time"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "guint64 to contain a timestamp."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_points_changed_since" g_unix_mount_points_changed_since :: 
    Word64 ->                               -- time : TBasicType TUInt64
    IO CInt

-- | Checks if the unix mount points have changed since a given unix time.
unixMountPointsChangedSince ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    -- ^ /@time@/: guint64 to contain a timestamp.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the mount points have changed since /@time@/.
unixMountPointsChangedSince :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word64 -> m Bool
unixMountPointsChangedSince Word64
time = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CInt
result <- Word64 -> IO CInt
g_unix_mount_points_changed_since Word64
time
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function unix_mount_is_system_internal
-- Args: [ Arg
--           { argCName = "mount_entry"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GUnixMount." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_is_system_internal" g_unix_mount_is_system_internal :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO CInt

-- | Checks if a Unix mount is a system mount. This is the Boolean OR of
-- 'GI.Gio.Functions.unixIsSystemFsType', 'GI.Gio.Functions.unixIsSystemDevicePath' and
-- 'GI.Gio.Functions.unixIsMountPathSystemInternal' on /@mountEntry@/’s properties.
-- 
-- The definition of what a ‘system’ mount entry is may change over time as new
-- file system types and device paths are ignored.
unixMountIsSystemInternal ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mountEntry@/: a @/GUnixMount/@.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the unix mount is for a system path.
unixMountIsSystemInternal :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> m Bool
unixMountIsSystemInternal UnixMountEntry
mountEntry = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountEntry
mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mountEntry
    CInt
result <- Ptr UnixMountEntry -> IO CInt
g_unix_mount_is_system_internal Ptr UnixMountEntry
mountEntry'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mountEntry
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function unix_mount_is_readonly
-- Args: [ Arg
--           { argCName = "mount_entry"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GUnixMount." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_is_readonly" g_unix_mount_is_readonly :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO CInt

-- | Checks if a unix mount is mounted read only.
unixMountIsReadonly ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mountEntry@/: a @/GUnixMount/@.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@mountEntry@/ is read only.
unixMountIsReadonly :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> m Bool
unixMountIsReadonly UnixMountEntry
mountEntry = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountEntry
mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mountEntry
    CInt
result <- Ptr UnixMountEntry -> IO CInt
g_unix_mount_is_readonly Ptr UnixMountEntry
mountEntry'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mountEntry
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function unix_mount_guess_symbolic_icon
-- Args: [ Arg
--           { argCName = "mount_entry"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GUnixMountEntry" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gio" , name = "Icon" })
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_guess_symbolic_icon" g_unix_mount_guess_symbolic_icon :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO (Ptr Gio.Icon.Icon)

-- | Guesses the symbolic icon of a Unix mount.
-- 
-- /Since: 2.34/
unixMountGuessSymbolicIcon ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'
    -> m Gio.Icon.Icon
    -- ^ __Returns:__ a t'GI.Gio.Interfaces.Icon.Icon'
unixMountGuessSymbolicIcon :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> m Icon
unixMountGuessSymbolicIcon UnixMountEntry
mountEntry = IO Icon -> m Icon
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Icon -> m Icon) -> IO Icon -> m Icon
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountEntry
mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mountEntry
    Ptr Icon
result <- Ptr UnixMountEntry -> IO (Ptr Icon)
g_unix_mount_guess_symbolic_icon Ptr UnixMountEntry
mountEntry'
    Text -> Ptr Icon -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"unixMountGuessSymbolicIcon" Ptr Icon
result
    Icon
result' <- ((ManagedPtr Icon -> Icon) -> Ptr Icon -> IO Icon
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Icon -> Icon
Gio.Icon.Icon) Ptr Icon
result
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mountEntry
    Icon -> IO Icon
forall (m :: * -> *) a. Monad m => a -> m a
return Icon
result'


-- function unix_mount_guess_should_display
-- Args: [ Arg
--           { argCName = "mount_entry"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GUnixMountEntry" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_guess_should_display" g_unix_mount_guess_should_display :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO CInt

-- | Guesses whether a Unix mount should be displayed in the UI.
unixMountGuessShouldDisplay ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@mountEntry@/ is deemed to be displayable.
unixMountGuessShouldDisplay :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> m Bool
unixMountGuessShouldDisplay UnixMountEntry
mountEntry = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountEntry
mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mountEntry
    CInt
result <- Ptr UnixMountEntry -> IO CInt
g_unix_mount_guess_should_display Ptr UnixMountEntry
mountEntry'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mountEntry
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function unix_mount_guess_name
-- Args: [ Arg
--           { argCName = "mount_entry"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GUnixMountEntry" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_guess_name" g_unix_mount_guess_name :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO CString

-- | Guesses the name of a Unix mount.
-- The result is a translated string.
unixMountGuessName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'
    -> m T.Text
    -- ^ __Returns:__ A newly allocated string that must
    --     be freed with 'GI.GLib.Functions.free'
unixMountGuessName :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> m Text
unixMountGuessName UnixMountEntry
mountEntry = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountEntry
mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mountEntry
    CString
result <- Ptr UnixMountEntry -> IO CString
g_unix_mount_guess_name Ptr UnixMountEntry
mountEntry'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"unixMountGuessName" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mountEntry
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function unix_mount_guess_icon
-- Args: [ Arg
--           { argCName = "mount_entry"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GUnixMountEntry" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gio" , name = "Icon" })
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_guess_icon" g_unix_mount_guess_icon :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO (Ptr Gio.Icon.Icon)

-- | Guesses the icon of a Unix mount.
unixMountGuessIcon ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'
    -> m Gio.Icon.Icon
    -- ^ __Returns:__ a t'GI.Gio.Interfaces.Icon.Icon'
unixMountGuessIcon :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> m Icon
unixMountGuessIcon UnixMountEntry
mountEntry = IO Icon -> m Icon
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Icon -> m Icon) -> IO Icon -> m Icon
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountEntry
mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mountEntry
    Ptr Icon
result <- Ptr UnixMountEntry -> IO (Ptr Icon)
g_unix_mount_guess_icon Ptr UnixMountEntry
mountEntry'
    Text -> Ptr Icon -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"unixMountGuessIcon" Ptr Icon
result
    Icon
result' <- ((ManagedPtr Icon -> Icon) -> Ptr Icon -> IO Icon
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Icon -> Icon
Gio.Icon.Icon) Ptr Icon
result
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mountEntry
    Icon -> IO Icon
forall (m :: * -> *) a. Monad m => a -> m a
return Icon
result'


-- function unix_mount_guess_can_eject
-- Args: [ Arg
--           { argCName = "mount_entry"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GUnixMountEntry" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_guess_can_eject" g_unix_mount_guess_can_eject :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO CInt

-- | Guesses whether a Unix mount can be ejected.
unixMountGuessCanEject ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@mountEntry@/ is deemed to be ejectable.
unixMountGuessCanEject :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> m Bool
unixMountGuessCanEject UnixMountEntry
mountEntry = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountEntry
mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mountEntry
    CInt
result <- Ptr UnixMountEntry -> IO CInt
g_unix_mount_guess_can_eject Ptr UnixMountEntry
mountEntry'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mountEntry
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function unix_mount_get_root_path
-- Args: [ Arg
--           { argCName = "mount_entry"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GUnixMountEntry."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_get_root_path" g_unix_mount_get_root_path :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO CString

-- | Gets the root of the mount within the filesystem. This is useful e.g. for
-- mounts created by bind operation, or btrfs subvolumes.
-- 
-- For example, the root path is equal to \"\/\" for mount created by
-- \"mount \/dev\/sda1 \/mnt\/foo\" and \"\/bar\" for
-- \"mount --bind \/mnt\/foo\/bar \/mnt\/bar\".
-- 
-- /Since: 2.60/
unixMountGetRootPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'.
    -> m (Maybe T.Text)
    -- ^ __Returns:__ a string containing the root, or 'P.Nothing' if not supported.
unixMountGetRootPath :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> m (Maybe Text)
unixMountGetRootPath UnixMountEntry
mountEntry = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountEntry
mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mountEntry
    CString
result <- Ptr UnixMountEntry -> IO CString
g_unix_mount_get_root_path Ptr UnixMountEntry
mountEntry'
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mountEntry
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function unix_mount_get_options
-- Args: [ Arg
--           { argCName = "mount_entry"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GUnixMountEntry."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_get_options" g_unix_mount_get_options :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO CString

-- | Gets a comma-separated list of mount options for the unix mount. For example,
-- @rw,relatime,seclabel,data=ordered@.
-- 
-- This is similar to 'GI.Gio.Structs.UnixMountPoint.unixMountPointGetOptions', but it takes
-- a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' as an argument.
-- 
-- /Since: 2.58/
unixMountGetOptions ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'.
    -> m (Maybe T.Text)
    -- ^ __Returns:__ a string containing the options, or 'P.Nothing' if not
    -- available.
unixMountGetOptions :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> m (Maybe Text)
unixMountGetOptions UnixMountEntry
mountEntry = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountEntry
mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mountEntry
    CString
result <- Ptr UnixMountEntry -> IO CString
g_unix_mount_get_options Ptr UnixMountEntry
mountEntry'
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mountEntry
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function unix_mount_get_mount_path
-- Args: [ Arg
--           { argCName = "mount_entry"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "input #GUnixMountEntry to get the mount path for."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFileName)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_get_mount_path" g_unix_mount_get_mount_path :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO CString

-- | Gets the mount path for a unix mount.
unixMountGetMountPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mountEntry@/: input t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' to get the mount path for.
    -> m [Char]
    -- ^ __Returns:__ the mount path for /@mountEntry@/.
unixMountGetMountPath :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> m [Char]
unixMountGetMountPath UnixMountEntry
mountEntry = IO [Char] -> m [Char]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Char] -> m [Char]) -> IO [Char] -> m [Char]
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountEntry
mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mountEntry
    CString
result <- Ptr UnixMountEntry -> IO CString
g_unix_mount_get_mount_path Ptr UnixMountEntry
mountEntry'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"unixMountGetMountPath" CString
result
    [Char]
result' <- HasCallStack => CString -> IO [Char]
CString -> IO [Char]
cstringToString CString
result
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mountEntry
    [Char] -> IO [Char]
forall (m :: * -> *) a. Monad m => a -> m a
return [Char]
result'


-- function unix_mount_get_fs_type
-- Args: [ Arg
--           { argCName = "mount_entry"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GUnixMount." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_get_fs_type" g_unix_mount_get_fs_type :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO CString

-- | Gets the filesystem type for the unix mount.
unixMountGetFsType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mountEntry@/: a @/GUnixMount/@.
    -> m T.Text
    -- ^ __Returns:__ a string containing the file system type.
unixMountGetFsType :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> m Text
unixMountGetFsType UnixMountEntry
mountEntry = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountEntry
mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mountEntry
    CString
result <- Ptr UnixMountEntry -> IO CString
g_unix_mount_get_fs_type Ptr UnixMountEntry
mountEntry'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"unixMountGetFsType" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mountEntry
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function unix_mount_get_device_path
-- Args: [ Arg
--           { argCName = "mount_entry"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GUnixMount." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFileName)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_get_device_path" g_unix_mount_get_device_path :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO CString

-- | Gets the device path for a unix mount.
unixMountGetDevicePath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mountEntry@/: a @/GUnixMount/@.
    -> m [Char]
    -- ^ __Returns:__ a string containing the device path.
unixMountGetDevicePath :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> m [Char]
unixMountGetDevicePath UnixMountEntry
mountEntry = IO [Char] -> m [Char]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Char] -> m [Char]) -> IO [Char] -> m [Char]
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountEntry
mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mountEntry
    CString
result <- Ptr UnixMountEntry -> IO CString
g_unix_mount_get_device_path Ptr UnixMountEntry
mountEntry'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"unixMountGetDevicePath" CString
result
    [Char]
result' <- HasCallStack => CString -> IO [Char]
CString -> IO [Char]
cstringToString CString
result
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mountEntry
    [Char] -> IO [Char]
forall (m :: * -> *) a. Monad m => a -> m a
return [Char]
result'


-- function unix_mount_free
-- Args: [ Arg
--           { argCName = "mount_entry"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GUnixMountEntry."
--                 , 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_free" g_unix_mount_free :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO ()

-- | Frees a unix mount.
unixMountFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'.
    -> m ()
unixMountFree :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> m ()
unixMountFree UnixMountEntry
mountEntry = 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 UnixMountEntry
mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mountEntry
    Ptr UnixMountEntry -> IO ()
g_unix_mount_free Ptr UnixMountEntry
mountEntry'
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mountEntry
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function unix_mount_for
-- Args: [ Arg
--           { argCName = "file_path"
--           , argType = TBasicType TFileName
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "file path on some unix mount."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "time_read"
--           , argType = TBasicType TUInt64
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "guint64 to contain a timestamp."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "UnixMountEntry" })
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_for" g_unix_mount_for :: 
    CString ->                              -- file_path : TBasicType TFileName
    Ptr Word64 ->                           -- time_read : TBasicType TUInt64
    IO (Ptr Gio.UnixMountEntry.UnixMountEntry)

-- | Gets a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' for a given file path. If /@timeRead@/
-- is set, it will be filled with a unix timestamp for checking
-- if the mounts have changed since with 'GI.Gio.Functions.unixMountsChangedSince'.
-- 
-- If more mounts have the same mount path, the last matching mount
-- is returned.
-- 
-- This will return 'P.Nothing' if looking up the mount entry fails, if
-- /@filePath@/ doesn’t exist or there is an I\/O error.
-- 
-- /Since: 2.52/
unixMountFor ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Char]
    -- ^ /@filePath@/: file path on some unix mount.
    -> m ((Maybe Gio.UnixMountEntry.UnixMountEntry, Word64))
    -- ^ __Returns:__ a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'.
unixMountFor :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
[Char] -> m (Maybe UnixMountEntry, Word64)
unixMountFor [Char]
filePath = IO (Maybe UnixMountEntry, Word64)
-> m (Maybe UnixMountEntry, Word64)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe UnixMountEntry, Word64)
 -> m (Maybe UnixMountEntry, Word64))
-> IO (Maybe UnixMountEntry, Word64)
-> m (Maybe UnixMountEntry, Word64)
forall a b. (a -> b) -> a -> b
$ do
    CString
filePath' <- [Char] -> IO CString
stringToCString [Char]
filePath
    Ptr Word64
timeRead <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
    Ptr UnixMountEntry
result <- CString -> Ptr Word64 -> IO (Ptr UnixMountEntry)
g_unix_mount_for CString
filePath' Ptr Word64
timeRead
    Maybe UnixMountEntry
maybeResult <- Ptr UnixMountEntry
-> (Ptr UnixMountEntry -> IO UnixMountEntry)
-> IO (Maybe UnixMountEntry)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr UnixMountEntry
result ((Ptr UnixMountEntry -> IO UnixMountEntry)
 -> IO (Maybe UnixMountEntry))
-> (Ptr UnixMountEntry -> IO UnixMountEntry)
-> IO (Maybe UnixMountEntry)
forall a b. (a -> b) -> a -> b
$ \Ptr UnixMountEntry
result' -> do
        UnixMountEntry
result'' <- ((ManagedPtr UnixMountEntry -> UnixMountEntry)
-> Ptr UnixMountEntry -> IO UnixMountEntry
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr UnixMountEntry -> UnixMountEntry
Gio.UnixMountEntry.UnixMountEntry) Ptr UnixMountEntry
result'
        UnixMountEntry -> IO UnixMountEntry
forall (m :: * -> *) a. Monad m => a -> m a
return UnixMountEntry
result''
    Word64
timeRead' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
timeRead
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filePath'
    Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
timeRead
    (Maybe UnixMountEntry, Word64) -> IO (Maybe UnixMountEntry, Word64)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe UnixMountEntry
maybeResult, Word64
timeRead')


-- function unix_mount_copy
-- Args: [ Arg
--           { argCName = "mount_entry"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GUnixMountEntry."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "UnixMountEntry" })
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_copy" g_unix_mount_copy :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO (Ptr Gio.UnixMountEntry.UnixMountEntry)

-- | Makes a copy of /@mountEntry@/.
-- 
-- /Since: 2.54/
unixMountCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'.
    -> m Gio.UnixMountEntry.UnixMountEntry
    -- ^ __Returns:__ a new t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'
unixMountCopy :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> m UnixMountEntry
unixMountCopy UnixMountEntry
mountEntry = IO UnixMountEntry -> m UnixMountEntry
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO UnixMountEntry -> m UnixMountEntry)
-> IO UnixMountEntry -> m UnixMountEntry
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountEntry
mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mountEntry
    Ptr UnixMountEntry
result <- Ptr UnixMountEntry -> IO (Ptr UnixMountEntry)
g_unix_mount_copy Ptr UnixMountEntry
mountEntry'
    Text -> Ptr UnixMountEntry -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"unixMountCopy" Ptr UnixMountEntry
result
    UnixMountEntry
result' <- ((ManagedPtr UnixMountEntry -> UnixMountEntry)
-> Ptr UnixMountEntry -> IO UnixMountEntry
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr UnixMountEntry -> UnixMountEntry
Gio.UnixMountEntry.UnixMountEntry) Ptr UnixMountEntry
result
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mountEntry
    UnixMountEntry -> IO UnixMountEntry
forall (m :: * -> *) a. Monad m => a -> m a
return UnixMountEntry
result'


-- function unix_mount_compare
-- Args: [ Arg
--           { argCName = "mount1"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "first #GUnixMountEntry to compare."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "mount2"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "second #GUnixMountEntry to compare."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_compare" g_unix_mount_compare :: 
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount1 : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount2 : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"})
    IO Int32

-- | Compares two unix mounts.
unixMountCompare ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mount1@/: first t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' to compare.
    -> Gio.UnixMountEntry.UnixMountEntry
    -- ^ /@mount2@/: second t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' to compare.
    -> m Int32
    -- ^ __Returns:__ 1, 0 or -1 if /@mount1@/ is greater than, equal to,
    -- or less than /@mount2@/, respectively.
unixMountCompare :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
UnixMountEntry -> UnixMountEntry -> m Int32
unixMountCompare UnixMountEntry
mount1 UnixMountEntry
mount2 = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr UnixMountEntry
mount1' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mount1
    Ptr UnixMountEntry
mount2' <- UnixMountEntry -> IO (Ptr UnixMountEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr UnixMountEntry
mount2
    Int32
result <- Ptr UnixMountEntry -> Ptr UnixMountEntry -> IO Int32
g_unix_mount_compare Ptr UnixMountEntry
mount1' Ptr UnixMountEntry
mount2'
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mount1
    UnixMountEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr UnixMountEntry
mount2
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function unix_mount_at
-- Args: [ Arg
--           { argCName = "mount_path"
--           , argType = TBasicType TFileName
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "path for a possible unix mount."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "time_read"
--           , argType = TBasicType TUInt64
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "guint64 to contain a timestamp."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "UnixMountEntry" })
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_mount_at" g_unix_mount_at :: 
    CString ->                              -- mount_path : TBasicType TFileName
    Ptr Word64 ->                           -- time_read : TBasicType TUInt64
    IO (Ptr Gio.UnixMountEntry.UnixMountEntry)

-- | Gets a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' for a given mount path. If /@timeRead@/
-- is set, it will be filled with a unix timestamp for checking
-- if the mounts have changed since with 'GI.Gio.Functions.unixMountsChangedSince'.
-- 
-- If more mounts have the same mount path, the last matching mount
-- is returned.
-- 
-- This will return 'P.Nothing' if there is no mount point at /@mountPath@/.
unixMountAt ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Char]
    -- ^ /@mountPath@/: path for a possible unix mount.
    -> m ((Maybe Gio.UnixMountEntry.UnixMountEntry, Word64))
    -- ^ __Returns:__ a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'.
unixMountAt :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
[Char] -> m (Maybe UnixMountEntry, Word64)
unixMountAt [Char]
mountPath = IO (Maybe UnixMountEntry, Word64)
-> m (Maybe UnixMountEntry, Word64)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe UnixMountEntry, Word64)
 -> m (Maybe UnixMountEntry, Word64))
-> IO (Maybe UnixMountEntry, Word64)
-> m (Maybe UnixMountEntry, Word64)
forall a b. (a -> b) -> a -> b
$ do
    CString
mountPath' <- [Char] -> IO CString
stringToCString [Char]
mountPath
    Ptr Word64
timeRead <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
    Ptr UnixMountEntry
result <- CString -> Ptr Word64 -> IO (Ptr UnixMountEntry)
g_unix_mount_at CString
mountPath' Ptr Word64
timeRead
    Maybe UnixMountEntry
maybeResult <- Ptr UnixMountEntry
-> (Ptr UnixMountEntry -> IO UnixMountEntry)
-> IO (Maybe UnixMountEntry)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr UnixMountEntry
result ((Ptr UnixMountEntry -> IO UnixMountEntry)
 -> IO (Maybe UnixMountEntry))
-> (Ptr UnixMountEntry -> IO UnixMountEntry)
-> IO (Maybe UnixMountEntry)
forall a b. (a -> b) -> a -> b
$ \Ptr UnixMountEntry
result' -> do
        UnixMountEntry
result'' <- ((ManagedPtr UnixMountEntry -> UnixMountEntry)
-> Ptr UnixMountEntry -> IO UnixMountEntry
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr UnixMountEntry -> UnixMountEntry
Gio.UnixMountEntry.UnixMountEntry) Ptr UnixMountEntry
result'
        UnixMountEntry -> IO UnixMountEntry
forall (m :: * -> *) a. Monad m => a -> m a
return UnixMountEntry
result''
    Word64
timeRead' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
timeRead
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
mountPath'
    Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
timeRead
    (Maybe UnixMountEntry, Word64) -> IO (Maybe UnixMountEntry, Word64)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe UnixMountEntry
maybeResult, Word64
timeRead')


-- function unix_is_system_fs_type
-- Args: [ Arg
--           { argCName = "fs_type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a file system type, e.g. `procfs` or `tmpfs`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_is_system_fs_type" g_unix_is_system_fs_type :: 
    CString ->                              -- fs_type : TBasicType TUTF8
    IO CInt

-- | Determines if /@fsType@/ is considered a type of file system which is only
-- used in implementation of the OS. This is primarily used for hiding
-- mounted volumes that are intended as APIs for programs to read, and system
-- administrators at a shell; rather than something that should, for example,
-- appear in a GUI. For example, the Linux @\/proc@ filesystem.
-- 
-- The list of file system types considered ‘system’ ones may change over time.
-- 
-- /Since: 2.56/
unixIsSystemFsType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@fsType@/: a file system type, e.g. @procfs@ or @tmpfs@
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@fsType@/ is considered an implementation detail of the OS.
unixIsSystemFsType :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool
unixIsSystemFsType Text
fsType = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
fsType' <- Text -> IO CString
textToCString Text
fsType
    CInt
result <- CString -> IO CInt
g_unix_is_system_fs_type CString
fsType'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
fsType'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function unix_is_system_device_path
-- Args: [ Arg
--           { argCName = "device_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a device path, e.g. `/dev/loop0` or `nfsd`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_is_system_device_path" g_unix_is_system_device_path :: 
    CString ->                              -- device_path : TBasicType TUTF8
    IO CInt

-- | Determines if /@devicePath@/ is considered a block device path which is only
-- used in implementation of the OS. This is primarily used for hiding
-- mounted volumes that are intended as APIs for programs to read, and system
-- administrators at a shell; rather than something that should, for example,
-- appear in a GUI. For example, the Linux @\/proc@ filesystem.
-- 
-- The list of device paths considered ‘system’ ones may change over time.
-- 
-- /Since: 2.56/
unixIsSystemDevicePath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@devicePath@/: a device path, e.g. @\/dev\/loop0@ or @nfsd@
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@devicePath@/ is considered an implementation detail of
    --    the OS.
unixIsSystemDevicePath :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool
unixIsSystemDevicePath Text
devicePath = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
devicePath' <- Text -> IO CString
textToCString Text
devicePath
    CInt
result <- CString -> IO CInt
g_unix_is_system_device_path CString
devicePath'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
devicePath'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function unix_is_mount_path_system_internal
-- Args: [ Arg
--           { argCName = "mount_path"
--           , argType = TBasicType TFileName
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a mount path, e.g. `/media/disk` or `/usr`"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_unix_is_mount_path_system_internal" g_unix_is_mount_path_system_internal :: 
    CString ->                              -- mount_path : TBasicType TFileName
    IO CInt

-- | Determines if /@mountPath@/ is considered an implementation of the
-- OS. This is primarily used for hiding mountable and mounted volumes
-- that only are used in the OS and has little to no relevance to the
-- casual user.
unixIsMountPathSystemInternal ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Char]
    -- ^ /@mountPath@/: a mount path, e.g. @\/media\/disk@ or @\/usr@
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@mountPath@/ is considered an implementation detail
    --     of the OS.
unixIsMountPathSystemInternal :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [Char] -> m Bool
unixIsMountPathSystemInternal [Char]
mountPath = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
mountPath' <- [Char] -> IO CString
stringToCString [Char]
mountPath
    CInt
result <- CString -> IO CInt
g_unix_is_mount_path_system_internal CString
mountPath'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
mountPath'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function simple_async_report_gerror_in_idle
-- Args: [ Arg
--           { argCName = "object"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GObject, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GAsyncReadyCallback."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user data passed to @callback."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "error"
--           , argType = TError
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GError to report"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_simple_async_report_gerror_in_idle" g_simple_async_report_gerror_in_idle :: 
    Ptr GObject.Object.Object ->            -- object : TInterface (Name {namespace = "GObject", name = "Object"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    Ptr GError ->                           -- error : TError
    IO ()

{-# DEPRECATED simpleAsyncReportGerrorInIdle ["(Since version 2.46)","Use 'GI.Gio.Objects.Task.taskReportError'."] #-}
-- | Reports an error in an idle function. Similar to
-- @/g_simple_async_report_error_in_idle()/@, but takes a t'GError' rather
-- than building a new one.
simpleAsyncReportGerrorInIdle ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a) =>
    Maybe (a)
    -- ^ /@object@/: a t'GI.GObject.Objects.Object.Object', or 'P.Nothing'
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: a t'GI.Gio.Callbacks.AsyncReadyCallback'.
    -> GError
    -- ^ /@error@/: the t'GError' to report
    -> m ()
simpleAsyncReportGerrorInIdle :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsObject a) =>
Maybe a -> Maybe AsyncReadyCallback -> GError -> m ()
simpleAsyncReportGerrorInIdle Maybe a
object Maybe AsyncReadyCallback
callback GError
error_ = 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 Object
maybeObject <- case Maybe a
object of
        Maybe a
Nothing -> Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
        Just a
jObject -> do
            Ptr Object
jObject' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jObject
            Ptr Object -> IO (Ptr Object)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jObject'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    Ptr GError
error_' <- GError -> IO (Ptr GError)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GError
error_
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    Ptr Object
-> FunPtr C_AsyncReadyCallback -> Ptr () -> Ptr GError -> IO ()
g_simple_async_report_gerror_in_idle Ptr Object
maybeObject FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData Ptr GError
error_'
    Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
object a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    GError -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GError
error_
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function resources_unregister
-- Args: [ Arg
--           { argCName = "resource"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resource" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GResource" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_resources_unregister" g_resources_unregister :: 
    Ptr Gio.Resource.Resource ->            -- resource : TInterface (Name {namespace = "Gio", name = "Resource"})
    IO ()

-- | Unregisters the resource from the process-global set of resources.
-- 
-- /Since: 2.32/
resourcesUnregister ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.Resource.Resource
    -- ^ /@resource@/: A t'GI.Gio.Structs.Resource.Resource'
    -> m ()
resourcesUnregister :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Resource -> m ()
resourcesUnregister Resource
resource = 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 Resource
resource' <- Resource -> IO (Ptr Resource)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Resource
resource
    Ptr Resource -> IO ()
g_resources_unregister Ptr Resource
resource'
    Resource -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Resource
resource
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function resources_register
-- Args: [ Arg
--           { argCName = "resource"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Resource" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GResource" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_resources_register" g_resources_register :: 
    Ptr Gio.Resource.Resource ->            -- resource : TInterface (Name {namespace = "Gio", name = "Resource"})
    IO ()

-- | Registers the resource with the process-global set of resources.
-- Once a resource is registered the files in it can be accessed
-- with the global resource lookup functions like 'GI.Gio.Functions.resourcesLookupData'.
-- 
-- /Since: 2.32/
resourcesRegister ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.Resource.Resource
    -- ^ /@resource@/: A t'GI.Gio.Structs.Resource.Resource'
    -> m ()
resourcesRegister :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Resource -> m ()
resourcesRegister Resource
resource = 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 Resource
resource' <- Resource -> IO (Ptr Resource)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Resource
resource
    Ptr Resource -> IO ()
g_resources_register Ptr Resource
resource'
    Resource -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Resource
resource
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function resources_open_stream
-- Args: [ Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A pathname inside the resource"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "lookup_flags"
--           , argType =
--               TInterface
--                 Name { namespace = "Gio" , name = "ResourceLookupFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GResourceLookupFlags"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gio" , name = "InputStream" })
-- throws : True
-- Skip return : False

foreign import ccall "g_resources_open_stream" g_resources_open_stream :: 
    CString ->                              -- path : TBasicType TUTF8
    CUInt ->                                -- lookup_flags : TInterface (Name {namespace = "Gio", name = "ResourceLookupFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Gio.InputStream.InputStream)

-- | Looks for a file at the specified /@path@/ in the set of
-- globally registered resources and returns a t'GI.Gio.Objects.InputStream.InputStream'
-- that lets you read the data.
-- 
-- /@lookupFlags@/ controls the behaviour of the lookup.
-- 
-- /Since: 2.32/
resourcesOpenStream ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@path@/: A pathname inside the resource
    -> [Gio.Flags.ResourceLookupFlags]
    -- ^ /@lookupFlags@/: A t'GI.Gio.Flags.ResourceLookupFlags'
    -> m Gio.InputStream.InputStream
    -- ^ __Returns:__ t'GI.Gio.Objects.InputStream.InputStream' or 'P.Nothing' on error.
    --     Free the returned object with 'GI.GObject.Objects.Object.objectUnref' /(Can throw 'Data.GI.Base.GError.GError')/
resourcesOpenStream :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> [ResourceLookupFlags] -> m InputStream
resourcesOpenStream Text
path [ResourceLookupFlags]
lookupFlags = IO InputStream -> m InputStream
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO InputStream -> m InputStream)
-> IO InputStream -> m InputStream
forall a b. (a -> b) -> a -> b
$ do
    CString
path' <- Text -> IO CString
textToCString Text
path
    let lookupFlags' :: CUInt
lookupFlags' = [ResourceLookupFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ResourceLookupFlags]
lookupFlags
    IO InputStream -> IO () -> IO InputStream
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr InputStream
result <- (Ptr (Ptr GError) -> IO (Ptr InputStream)) -> IO (Ptr InputStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr InputStream))
 -> IO (Ptr InputStream))
-> (Ptr (Ptr GError) -> IO (Ptr InputStream))
-> IO (Ptr InputStream)
forall a b. (a -> b) -> a -> b
$ CString -> CUInt -> Ptr (Ptr GError) -> IO (Ptr InputStream)
g_resources_open_stream CString
path' CUInt
lookupFlags'
        Text -> Ptr InputStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"resourcesOpenStream" Ptr InputStream
result
        InputStream
result' <- ((ManagedPtr InputStream -> InputStream)
-> Ptr InputStream -> IO InputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr InputStream -> InputStream
Gio.InputStream.InputStream) Ptr InputStream
result
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
        InputStream -> IO InputStream
forall (m :: * -> *) a. Monad m => a -> m a
return InputStream
result'
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
     )


-- function resources_lookup_data
-- Args: [ Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A pathname inside the resource"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "lookup_flags"
--           , argType =
--               TInterface
--                 Name { namespace = "Gio" , name = "ResourceLookupFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GResourceLookupFlags"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "GLib" , name = "Bytes" })
-- throws : True
-- Skip return : False

foreign import ccall "g_resources_lookup_data" g_resources_lookup_data :: 
    CString ->                              -- path : TBasicType TUTF8
    CUInt ->                                -- lookup_flags : TInterface (Name {namespace = "Gio", name = "ResourceLookupFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GLib.Bytes.Bytes)

-- | Looks for a file at the specified /@path@/ in the set of
-- globally registered resources and returns a t'GI.GLib.Structs.Bytes.Bytes' that
-- lets you directly access the data in memory.
-- 
-- The data is always followed by a zero byte, so you
-- can safely use the data as a C string. However, that byte
-- is not included in the size of the GBytes.
-- 
-- For uncompressed resource files this is a pointer directly into
-- the resource bundle, which is typically in some readonly data section
-- in the program binary. For compressed files we allocate memory on
-- the heap and automatically uncompress the data.
-- 
-- /@lookupFlags@/ controls the behaviour of the lookup.
-- 
-- /Since: 2.32/
resourcesLookupData ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@path@/: A pathname inside the resource
    -> [Gio.Flags.ResourceLookupFlags]
    -- ^ /@lookupFlags@/: A t'GI.Gio.Flags.ResourceLookupFlags'
    -> m GLib.Bytes.Bytes
    -- ^ __Returns:__ t'GI.GLib.Structs.Bytes.Bytes' or 'P.Nothing' on error.
    --     Free the returned object with 'GI.GLib.Structs.Bytes.bytesUnref' /(Can throw 'Data.GI.Base.GError.GError')/
resourcesLookupData :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> [ResourceLookupFlags] -> m Bytes
resourcesLookupData Text
path [ResourceLookupFlags]
lookupFlags = IO Bytes -> m Bytes
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bytes -> m Bytes) -> IO Bytes -> m Bytes
forall a b. (a -> b) -> a -> b
$ do
    CString
path' <- Text -> IO CString
textToCString Text
path
    let lookupFlags' :: CUInt
lookupFlags' = [ResourceLookupFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ResourceLookupFlags]
lookupFlags
    IO Bytes -> IO () -> IO Bytes
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr Bytes
result <- (Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes))
-> (Ptr (Ptr GError) -> IO (Ptr Bytes)) -> IO (Ptr Bytes)
forall a b. (a -> b) -> a -> b
$ CString -> CUInt -> Ptr (Ptr GError) -> IO (Ptr Bytes)
g_resources_lookup_data CString
path' CUInt
lookupFlags'
        Text -> Ptr Bytes -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"resourcesLookupData" Ptr Bytes
result
        Bytes
result' <- ((ManagedPtr Bytes -> Bytes) -> Ptr Bytes -> IO Bytes
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Bytes -> Bytes
GLib.Bytes.Bytes) Ptr Bytes
result
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
        Bytes -> IO Bytes
forall (m :: * -> *) a. Monad m => a -> m a
return Bytes
result'
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
     )


-- function resources_get_info
-- Args: [ Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A pathname inside the resource"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "lookup_flags"
--           , argType =
--               TInterface
--                 Name { namespace = "Gio" , name = "ResourceLookupFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GResourceLookupFlags"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "size"
--           , argType = TBasicType TUInt64
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a location to place the length of the contents of the file,\n   or %NULL if the length is not needed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "flags"
--           , argType = TBasicType TUInt32
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a location to place the #GResourceFlags about the file,\n   or %NULL if the flags are not needed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_resources_get_info" g_resources_get_info :: 
    CString ->                              -- path : TBasicType TUTF8
    CUInt ->                                -- lookup_flags : TInterface (Name {namespace = "Gio", name = "ResourceLookupFlags"})
    Ptr Word64 ->                           -- size : TBasicType TUInt64
    Ptr Word32 ->                           -- flags : TBasicType TUInt32
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Looks for a file at the specified /@path@/ in the set of
-- globally registered resources and if found returns information about it.
-- 
-- /@lookupFlags@/ controls the behaviour of the lookup.
-- 
-- /Since: 2.32/
resourcesGetInfo ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@path@/: A pathname inside the resource
    -> [Gio.Flags.ResourceLookupFlags]
    -- ^ /@lookupFlags@/: A t'GI.Gio.Flags.ResourceLookupFlags'
    -> m ((Word64, Word32))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
resourcesGetInfo :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> [ResourceLookupFlags] -> m (Word64, Word32)
resourcesGetInfo Text
path [ResourceLookupFlags]
lookupFlags = IO (Word64, Word32) -> m (Word64, Word32)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Word64, Word32) -> m (Word64, Word32))
-> IO (Word64, Word32) -> m (Word64, Word32)
forall a b. (a -> b) -> a -> b
$ do
    CString
path' <- Text -> IO CString
textToCString Text
path
    let lookupFlags' :: CUInt
lookupFlags' = [ResourceLookupFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ResourceLookupFlags]
lookupFlags
    Ptr Word64
size <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
    Ptr Word32
flags <- IO (Ptr Word32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word32)
    IO (Word64, Word32) -> IO () -> IO (Word64, Word32)
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CString
-> CUInt -> Ptr Word64 -> Ptr Word32 -> Ptr (Ptr GError) -> IO CInt
g_resources_get_info CString
path' CUInt
lookupFlags' Ptr Word64
size Ptr Word32
flags
        Word64
size' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
size
        Word32
flags' <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek Ptr Word32
flags
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
        Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
size
        Ptr Word32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word32
flags
        (Word64, Word32) -> IO (Word64, Word32)
forall (m :: * -> *) a. Monad m => a -> m a
return (Word64
size', Word32
flags')
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
        Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
size
        Ptr Word32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word32
flags
     )


-- function resources_enumerate_children
-- Args: [ Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A pathname inside the resource"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "lookup_flags"
--           , argType =
--               TInterface
--                 Name { namespace = "Gio" , name = "ResourceLookupFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GResourceLookupFlags"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : True
-- Skip return : False

foreign import ccall "g_resources_enumerate_children" g_resources_enumerate_children :: 
    CString ->                              -- path : TBasicType TUTF8
    CUInt ->                                -- lookup_flags : TInterface (Name {namespace = "Gio", name = "ResourceLookupFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr CString)

-- | Returns all the names of children at the specified /@path@/ in the set of
-- globally registered resources.
-- The return result is a 'P.Nothing' terminated list of strings which should
-- be released with 'GI.GLib.Functions.strfreev'.
-- 
-- /@lookupFlags@/ controls the behaviour of the lookup.
-- 
-- /Since: 2.32/
resourcesEnumerateChildren ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@path@/: A pathname inside the resource
    -> [Gio.Flags.ResourceLookupFlags]
    -- ^ /@lookupFlags@/: A t'GI.Gio.Flags.ResourceLookupFlags'
    -> m [T.Text]
    -- ^ __Returns:__ an array of constant strings /(Can throw 'Data.GI.Base.GError.GError')/
resourcesEnumerateChildren :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> [ResourceLookupFlags] -> m [Text]
resourcesEnumerateChildren Text
path [ResourceLookupFlags]
lookupFlags = IO [Text] -> m [Text]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
forall a b. (a -> b) -> a -> b
$ do
    CString
path' <- Text -> IO CString
textToCString Text
path
    let lookupFlags' :: CUInt
lookupFlags' = [ResourceLookupFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ResourceLookupFlags]
lookupFlags
    IO [Text] -> IO () -> IO [Text]
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr CString
result <- (Ptr (Ptr GError) -> IO (Ptr CString)) -> IO (Ptr CString)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr CString)) -> IO (Ptr CString))
-> (Ptr (Ptr GError) -> IO (Ptr CString)) -> IO (Ptr CString)
forall a b. (a -> b) -> a -> b
$ CString -> CUInt -> Ptr (Ptr GError) -> IO (Ptr CString)
g_resources_enumerate_children CString
path' CUInt
lookupFlags'
        Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"resourcesEnumerateChildren" Ptr CString
result
        [Text]
result' <- HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray Ptr CString
result
        (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
        [Text] -> IO [Text]
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result'
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
     )


-- function pollable_stream_write_all
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "OutputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GOutputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buffer"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the buffer\n  containing the data to write."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of bytes to write"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "blocking"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "whether to do blocking I/O"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "bytes_written"
--           , argType = TBasicType TUInt64
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "location to store the number of bytes that was\n  written to the stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "count"
--              , argType = TBasicType TUInt64
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the number of bytes to write"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_pollable_stream_write_all" g_pollable_stream_write_all :: 
    Ptr Gio.OutputStream.OutputStream ->    -- stream : TInterface (Name {namespace = "Gio", name = "OutputStream"})
    Ptr Word8 ->                            -- buffer : TCArray False (-1) 2 (TBasicType TUInt8)
    Word64 ->                               -- count : TBasicType TUInt64
    CInt ->                                 -- blocking : TBasicType TBoolean
    Ptr Word64 ->                           -- bytes_written : TBasicType TUInt64
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Tries to write /@count@/ bytes to /@stream@/, as with
-- 'GI.Gio.Objects.OutputStream.outputStreamWriteAll', but using 'GI.Gio.Functions.pollableStreamWrite'
-- rather than 'GI.Gio.Objects.OutputStream.outputStreamWrite'.
-- 
-- On a successful write of /@count@/ bytes, 'P.True' is returned, and
-- /@bytesWritten@/ is set to /@count@/.
-- 
-- If there is an error during the operation (including
-- 'GI.Gio.Enums.IOErrorEnumWouldBlock' in the non-blocking case), 'P.False' is
-- returned and /@error@/ is set to indicate the error status,
-- /@bytesWritten@/ is updated to contain the number of bytes written
-- into the stream before the error occurred.
-- 
-- As with 'GI.Gio.Functions.pollableStreamWrite', if /@blocking@/ is 'P.False', then
-- /@stream@/ must be a t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream' for which
-- 'GI.Gio.Interfaces.PollableOutputStream.pollableOutputStreamCanPoll' returns 'P.True' or else the
-- behavior is undefined. If /@blocking@/ is 'P.True', then /@stream@/ does not
-- need to be a t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream'.
-- 
-- /Since: 2.34/
pollableStreamWriteAll ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.OutputStream.IsOutputStream a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@stream@/: a t'GI.Gio.Objects.OutputStream.OutputStream'.
    -> ByteString
    -- ^ /@buffer@/: the buffer
    --   containing the data to write.
    -> Bool
    -- ^ /@blocking@/: whether to do blocking I\/O
    -> Maybe (b)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> m (Word64)
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
pollableStreamWriteAll :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) =>
a -> ByteString -> Bool -> Maybe b -> m Word64
pollableStreamWriteAll a
stream ByteString
buffer Bool
blocking Maybe b
cancellable = IO Word64 -> m Word64
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
forall a b. (a -> b) -> a -> b
$ do
    let count :: Word64
count = Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buffer
    Ptr OutputStream
stream' <- a -> IO (Ptr OutputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr Word8
buffer' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
buffer
    let blocking' :: CInt
blocking' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
blocking
    Ptr Word64
bytesWritten <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO Word64 -> IO () -> IO Word64
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr OutputStream
-> Ptr Word8
-> Word64
-> CInt
-> Ptr Word64
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO CInt
g_pollable_stream_write_all Ptr OutputStream
stream' Ptr Word8
buffer' Word64
count CInt
blocking' Ptr Word64
bytesWritten Ptr Cancellable
maybeCancellable
        Word64
bytesWritten' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
bytesWritten
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
        Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
bytesWritten
        Word64 -> IO Word64
forall (m :: * -> *) a. Monad m => a -> m a
return Word64
bytesWritten'
     ) (do
        Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
        Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
bytesWritten
     )


-- function pollable_stream_write
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "OutputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GOutputStream." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buffer"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the buffer\n  containing the data to write."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of bytes to write"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "blocking"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "whether to do blocking I/O"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "count"
--              , argType = TBasicType TUInt64
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the number of bytes to write"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TInt64)
-- throws : True
-- Skip return : False

foreign import ccall "g_pollable_stream_write" g_pollable_stream_write :: 
    Ptr Gio.OutputStream.OutputStream ->    -- stream : TInterface (Name {namespace = "Gio", name = "OutputStream"})
    Ptr Word8 ->                            -- buffer : TCArray False (-1) 2 (TBasicType TUInt8)
    Word64 ->                               -- count : TBasicType TUInt64
    CInt ->                                 -- blocking : TBasicType TBoolean
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO Int64

-- | Tries to write to /@stream@/, as with 'GI.Gio.Objects.OutputStream.outputStreamWrite' (if
-- /@blocking@/ is 'P.True') or 'GI.Gio.Interfaces.PollableOutputStream.pollableOutputStreamWriteNonblocking'
-- (if /@blocking@/ is 'P.False'). This can be used to more easily share
-- code between blocking and non-blocking implementations of a method.
-- 
-- If /@blocking@/ is 'P.False', then /@stream@/ must be a
-- t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream' for which
-- 'GI.Gio.Interfaces.PollableOutputStream.pollableOutputStreamCanPoll' returns 'P.True' or else the
-- behavior is undefined. If /@blocking@/ is 'P.True', then /@stream@/ does not
-- need to be a t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream'.
-- 
-- /Since: 2.34/
pollableStreamWrite ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.OutputStream.IsOutputStream a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@stream@/: a t'GI.Gio.Objects.OutputStream.OutputStream'.
    -> ByteString
    -- ^ /@buffer@/: the buffer
    --   containing the data to write.
    -> Bool
    -- ^ /@blocking@/: whether to do blocking I\/O
    -> Maybe (b)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> m Int64
    -- ^ __Returns:__ the number of bytes written, or -1 on error. /(Can throw 'Data.GI.Base.GError.GError')/
pollableStreamWrite :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) =>
a -> ByteString -> Bool -> Maybe b -> m Int64
pollableStreamWrite a
stream ByteString
buffer Bool
blocking Maybe b
cancellable = IO Int64 -> m Int64
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int64 -> m Int64) -> IO Int64 -> m Int64
forall a b. (a -> b) -> a -> b
$ do
    let count :: Word64
count = Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buffer
    Ptr OutputStream
stream' <- a -> IO (Ptr OutputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr Word8
buffer' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
buffer
    let blocking' :: CInt
blocking' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
blocking
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO Int64 -> IO () -> IO Int64
forall a b. IO a -> IO b -> IO a
onException (do
        Int64
result <- (Ptr (Ptr GError) -> IO Int64) -> IO Int64
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Int64) -> IO Int64)
-> (Ptr (Ptr GError) -> IO Int64) -> IO Int64
forall a b. (a -> b) -> a -> b
$ Ptr OutputStream
-> Ptr Word8
-> Word64
-> CInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO Int64
g_pollable_stream_write Ptr OutputStream
stream' Ptr Word8
buffer' Word64
count CInt
blocking' Ptr Cancellable
maybeCancellable
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
        Int64 -> IO Int64
forall (m :: * -> *) a. Monad m => a -> m a
return Int64
result
     ) (do
        Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
     )


-- function pollable_stream_read
-- Args: [ Arg
--           { argCName = "stream"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "InputStream" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GInputStream" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "buffer"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a buffer to\n  read data into"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "count"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of bytes to read"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "blocking"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "whether to do blocking I/O"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "count"
--              , argType = TBasicType TUInt64
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the number of bytes to read"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TInt64)
-- throws : True
-- Skip return : False

foreign import ccall "g_pollable_stream_read" g_pollable_stream_read :: 
    Ptr Gio.InputStream.InputStream ->      -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"})
    Ptr Word8 ->                            -- buffer : TCArray False (-1) 2 (TBasicType TUInt8)
    Word64 ->                               -- count : TBasicType TUInt64
    CInt ->                                 -- blocking : TBasicType TBoolean
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO Int64

-- | Tries to read from /@stream@/, as with 'GI.Gio.Objects.InputStream.inputStreamRead' (if
-- /@blocking@/ is 'P.True') or 'GI.Gio.Interfaces.PollableInputStream.pollableInputStreamReadNonblocking'
-- (if /@blocking@/ is 'P.False'). This can be used to more easily share
-- code between blocking and non-blocking implementations of a method.
-- 
-- If /@blocking@/ is 'P.False', then /@stream@/ must be a
-- t'GI.Gio.Interfaces.PollableInputStream.PollableInputStream' for which 'GI.Gio.Interfaces.PollableInputStream.pollableInputStreamCanPoll'
-- returns 'P.True', or else the behavior is undefined. If /@blocking@/ is
-- 'P.True', then /@stream@/ does not need to be a t'GI.Gio.Interfaces.PollableInputStream.PollableInputStream'.
-- 
-- /Since: 2.34/
pollableStreamRead ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.InputStream.IsInputStream a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@stream@/: a t'GI.Gio.Objects.InputStream.InputStream'
    -> ByteString
    -- ^ /@buffer@/: a buffer to
    --   read data into
    -> Bool
    -- ^ /@blocking@/: whether to do blocking I\/O
    -> Maybe (b)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> m Int64
    -- ^ __Returns:__ the number of bytes read, or -1 on error. /(Can throw 'Data.GI.Base.GError.GError')/
pollableStreamRead :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) =>
a -> ByteString -> Bool -> Maybe b -> m Int64
pollableStreamRead a
stream ByteString
buffer Bool
blocking Maybe b
cancellable = IO Int64 -> m Int64
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int64 -> m Int64) -> IO Int64 -> m Int64
forall a b. (a -> b) -> a -> b
$ do
    let count :: Word64
count = Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
buffer
    Ptr InputStream
stream' <- a -> IO (Ptr InputStream)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
stream
    Ptr Word8
buffer' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
buffer
    let blocking' :: CInt
blocking' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
blocking
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO Int64 -> IO () -> IO Int64
forall a b. IO a -> IO b -> IO a
onException (do
        Int64
result <- (Ptr (Ptr GError) -> IO Int64) -> IO Int64
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO Int64) -> IO Int64)
-> (Ptr (Ptr GError) -> IO Int64) -> IO Int64
forall a b. (a -> b) -> a -> b
$ Ptr InputStream
-> Ptr Word8
-> Word64
-> CInt
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO Int64
g_pollable_stream_read Ptr InputStream
stream' Ptr Word8
buffer' Word64
count CInt
blocking' Ptr Cancellable
maybeCancellable
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
stream
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
        Int64 -> IO Int64
forall (m :: * -> *) a. Monad m => a -> m a
return Int64
result
     ) (do
        Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
buffer'
     )


-- function pollable_source_new_full
-- Args: [ Arg
--           { argCName = "pollable_stream"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the stream associated with the\n  new source"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "child_source"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "Source" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "optional child source to attach"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "optional #GCancellable to attach"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "GLib" , name = "Source" })
-- throws : False
-- Skip return : False

foreign import ccall "g_pollable_source_new_full" g_pollable_source_new_full :: 
    Ptr GObject.Object.Object ->            -- pollable_stream : TInterface (Name {namespace = "GObject", name = "Object"})
    Ptr GLib.Source.Source ->               -- child_source : TInterface (Name {namespace = "GLib", name = "Source"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    IO (Ptr GLib.Source.Source)

-- | Utility method for t'GI.Gio.Interfaces.PollableInputStream.PollableInputStream' and t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream'
-- implementations. Creates a new t'GI.GLib.Structs.Source.Source', as with
-- 'GI.Gio.Functions.pollableSourceNew', but also attaching /@childSource@/ (with a
-- dummy callback), and /@cancellable@/, if they are non-'P.Nothing'.
-- 
-- /Since: 2.34/
pollableSourceNewFull ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@pollableStream@/: the stream associated with the
    --   new source
    -> Maybe (GLib.Source.Source)
    -- ^ /@childSource@/: optional child source to attach
    -> Maybe (b)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' to attach
    -> m GLib.Source.Source
    -- ^ __Returns:__ the new t'GI.GLib.Structs.Source.Source'.
pollableSourceNewFull :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsObject a, IsCancellable b) =>
a -> Maybe Source -> Maybe b -> m Source
pollableSourceNewFull a
pollableStream Maybe Source
childSource Maybe b
cancellable = IO Source -> m Source
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Source -> m Source) -> IO Source -> m Source
forall a b. (a -> b) -> a -> b
$ do
    Ptr Object
pollableStream' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pollableStream
    Ptr Source
maybeChildSource <- case Maybe Source
childSource of
        Maybe Source
Nothing -> Ptr Source -> IO (Ptr Source)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Source
forall a. Ptr a
nullPtr
        Just Source
jChildSource -> do
            Ptr Source
jChildSource' <- Source -> IO (Ptr Source)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Source
jChildSource
            Ptr Source -> IO (Ptr Source)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Source
jChildSource'
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    Ptr Source
result <- Ptr Object -> Ptr Source -> Ptr Cancellable -> IO (Ptr Source)
g_pollable_source_new_full Ptr Object
pollableStream' Ptr Source
maybeChildSource Ptr Cancellable
maybeCancellable
    Text -> Ptr Source -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"pollableSourceNewFull" Ptr Source
result
    Source
result' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Source -> Source
GLib.Source.Source) Ptr Source
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pollableStream
    Maybe Source -> (Source -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Source
childSource Source -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Source -> IO Source
forall (m :: * -> *) a. Monad m => a -> m a
return Source
result'


-- function pollable_source_new
-- Args: [ Arg
--           { argCName = "pollable_stream"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the stream associated with the new source"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "GLib" , name = "Source" })
-- throws : False
-- Skip return : False

foreign import ccall "g_pollable_source_new" g_pollable_source_new :: 
    Ptr GObject.Object.Object ->            -- pollable_stream : TInterface (Name {namespace = "GObject", name = "Object"})
    IO (Ptr GLib.Source.Source)

-- | Utility method for t'GI.Gio.Interfaces.PollableInputStream.PollableInputStream' and t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream'
-- implementations. Creates a new t'GI.GLib.Structs.Source.Source' that expects a callback of
-- type t'GI.Gio.Callbacks.PollableSourceFunc'. The new source does not actually do
-- anything on its own; use 'GI.GLib.Structs.Source.sourceAddChildSource' to add other
-- sources to it to cause it to trigger.
-- 
-- /Since: 2.28/
pollableSourceNew ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a) =>
    a
    -- ^ /@pollableStream@/: the stream associated with the new source
    -> m GLib.Source.Source
    -- ^ __Returns:__ the new t'GI.GLib.Structs.Source.Source'.
pollableSourceNew :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsObject a) =>
a -> m Source
pollableSourceNew a
pollableStream = IO Source -> m Source
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Source -> m Source) -> IO Source -> m Source
forall a b. (a -> b) -> a -> b
$ do
    Ptr Object
pollableStream' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
pollableStream
    Ptr Source
result <- Ptr Object -> IO (Ptr Source)
g_pollable_source_new Ptr Object
pollableStream'
    Text -> Ptr Source -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"pollableSourceNew" Ptr Source
result
    Source
result' <- ((ManagedPtr Source -> Source) -> Ptr Source -> IO Source
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Source -> Source
GLib.Source.Source) Ptr Source
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
pollableStream
    Source -> IO Source
forall (m :: * -> *) a. Monad m => a -> m a
return Source
result'


-- function null_settings_backend_new
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "SettingsBackend" })
-- throws : False
-- Skip return : False

foreign import ccall "g_null_settings_backend_new" g_null_settings_backend_new :: 
    IO (Ptr Gio.SettingsBackend.SettingsBackend)

-- | Creates a readonly t'GI.Gio.Objects.SettingsBackend.SettingsBackend'.
-- 
-- This backend does not allow changes to settings, so all settings
-- will always have their default values.
-- 
-- /Since: 2.28/
nullSettingsBackendNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Gio.SettingsBackend.SettingsBackend
    -- ^ __Returns:__ a newly created t'GI.Gio.Objects.SettingsBackend.SettingsBackend'
nullSettingsBackendNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
m SettingsBackend
nullSettingsBackendNew  = IO SettingsBackend -> m SettingsBackend
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SettingsBackend -> m SettingsBackend)
-> IO SettingsBackend -> m SettingsBackend
forall a b. (a -> b) -> a -> b
$ do
    Ptr SettingsBackend
result <- IO (Ptr SettingsBackend)
g_null_settings_backend_new
    Text -> Ptr SettingsBackend -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"nullSettingsBackendNew" Ptr SettingsBackend
result
    SettingsBackend
result' <- ((ManagedPtr SettingsBackend -> SettingsBackend)
-> Ptr SettingsBackend -> IO SettingsBackend
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SettingsBackend -> SettingsBackend
Gio.SettingsBackend.SettingsBackend) Ptr SettingsBackend
result
    SettingsBackend -> IO SettingsBackend
forall (m :: * -> *) a. Monad m => a -> m a
return SettingsBackend
result'


-- function networking_init
-- Args: []
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_networking_init" g_networking_init :: 
    IO ()

-- | Initializes the platform networking libraries (eg, on Windows, this
-- calls @/WSAStartup()/@). GLib will call this itself if it is needed, so
-- you only need to call it if you directly call system networking
-- functions (without calling any GLib networking functions first).
-- 
-- /Since: 2.36/
networkingInit ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
networkingInit :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
networkingInit  = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO ()
g_networking_init
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function memory_settings_backend_new
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "SettingsBackend" })
-- throws : False
-- Skip return : False

foreign import ccall "g_memory_settings_backend_new" g_memory_settings_backend_new :: 
    IO (Ptr Gio.SettingsBackend.SettingsBackend)

-- | Creates a memory-backed t'GI.Gio.Objects.SettingsBackend.SettingsBackend'.
-- 
-- This backend allows changes to settings, but does not write them
-- to any backing storage, so the next time you run your application,
-- the memory backend will start out with the default values again.
-- 
-- /Since: 2.28/
memorySettingsBackendNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Gio.SettingsBackend.SettingsBackend
    -- ^ __Returns:__ a newly created t'GI.Gio.Objects.SettingsBackend.SettingsBackend'
memorySettingsBackendNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
m SettingsBackend
memorySettingsBackendNew  = IO SettingsBackend -> m SettingsBackend
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SettingsBackend -> m SettingsBackend)
-> IO SettingsBackend -> m SettingsBackend
forall a b. (a -> b) -> a -> b
$ do
    Ptr SettingsBackend
result <- IO (Ptr SettingsBackend)
g_memory_settings_backend_new
    Text -> Ptr SettingsBackend -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"memorySettingsBackendNew" Ptr SettingsBackend
result
    SettingsBackend
result' <- ((ManagedPtr SettingsBackend -> SettingsBackend)
-> Ptr SettingsBackend -> IO SettingsBackend
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SettingsBackend -> SettingsBackend
Gio.SettingsBackend.SettingsBackend) Ptr SettingsBackend
result
    SettingsBackend -> IO SettingsBackend
forall (m :: * -> *) a. Monad m => a -> m a
return SettingsBackend
result'


-- function keyfile_settings_backend_new
-- Args: [ Arg
--           { argCName = "filename"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the filename of the keyfile"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "root_path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the path under which all settings keys appear"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "root_group"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the group name corresponding to\n             @root_path, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "SettingsBackend" })
-- throws : False
-- Skip return : False

foreign import ccall "g_keyfile_settings_backend_new" g_keyfile_settings_backend_new :: 
    CString ->                              -- filename : TBasicType TUTF8
    CString ->                              -- root_path : TBasicType TUTF8
    CString ->                              -- root_group : TBasicType TUTF8
    IO (Ptr Gio.SettingsBackend.SettingsBackend)

-- | Creates a keyfile-backed t'GI.Gio.Objects.SettingsBackend.SettingsBackend'.
-- 
-- The filename of the keyfile to use is given by /@filename@/.
-- 
-- All settings read to or written from the backend must fall under the
-- path given in /@rootPath@/ (which must start and end with a slash and
-- not contain two consecutive slashes).  /@rootPath@/ may be \"\/\".
-- 
-- If /@rootGroup@/ is non-'P.Nothing' then it specifies the name of the keyfile
-- group used for keys that are written directly below /@rootPath@/.  For
-- example, if /@rootPath@/ is \"\/apps\/example\/\" and /@rootGroup@/ is
-- \"toplevel\", then settings the key \"\/apps\/example\/enabled\" to a value
-- of 'P.True' will cause the following to appear in the keyfile:
-- 
-- >
-- >  [toplevel]
-- >  enabled=true
-- 
-- 
-- If /@rootGroup@/ is 'P.Nothing' then it is not permitted to store keys
-- directly below the /@rootPath@/.
-- 
-- For keys not stored directly below /@rootPath@/ (ie: in a sub-path),
-- the name of the subpath (with the final slash stripped) is used as
-- the name of the keyfile group.  To continue the example, if
-- \"\/apps\/example\/profiles\/default\/font-size\" were set to
-- 12 then the following would appear in the keyfile:
-- 
-- >
-- >  [profiles/default]
-- >  font-size=12
-- 
-- 
-- The backend will refuse writes (and return writability as being
-- 'P.False') for keys outside of /@rootPath@/ and, in the event that
-- /@rootGroup@/ is 'P.Nothing', also for keys directly under /@rootPath@/.
-- Writes will also be refused if the backend detects that it has the
-- inability to rewrite the keyfile (ie: the containing directory is not
-- writable).
-- 
-- There is no checking done for your key namespace clashing with the
-- syntax of the key file format.  For example, if you have \'[\' or \']\'
-- characters in your path names or \'=\' in your key names you may be in
-- trouble.
-- 
-- The backend reads default values from a keyfile called @defaults@ in
-- the directory specified by the @/GKeyfileSettingsBackend:defaults-dir/@ property,
-- and a list of locked keys from a text file with the name @locks@ in
-- the same location.
keyfileSettingsBackendNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@filename@/: the filename of the keyfile
    -> T.Text
    -- ^ /@rootPath@/: the path under which all settings keys appear
    -> Maybe (T.Text)
    -- ^ /@rootGroup@/: the group name corresponding to
    --              /@rootPath@/, or 'P.Nothing'
    -> m Gio.SettingsBackend.SettingsBackend
    -- ^ __Returns:__ a keyfile-backed t'GI.Gio.Objects.SettingsBackend.SettingsBackend'
keyfileSettingsBackendNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Text -> Maybe Text -> m SettingsBackend
keyfileSettingsBackendNew Text
filename Text
rootPath Maybe Text
rootGroup = IO SettingsBackend -> m SettingsBackend
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SettingsBackend -> m SettingsBackend)
-> IO SettingsBackend -> m SettingsBackend
forall a b. (a -> b) -> a -> b
$ do
    CString
filename' <- Text -> IO CString
textToCString Text
filename
    CString
rootPath' <- Text -> IO CString
textToCString Text
rootPath
    CString
maybeRootGroup <- case Maybe Text
rootGroup of
        Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jRootGroup -> do
            CString
jRootGroup' <- Text -> IO CString
textToCString Text
jRootGroup
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jRootGroup'
    Ptr SettingsBackend
result <- CString -> CString -> CString -> IO (Ptr SettingsBackend)
g_keyfile_settings_backend_new CString
filename' CString
rootPath' CString
maybeRootGroup
    Text -> Ptr SettingsBackend -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"keyfileSettingsBackendNew" Ptr SettingsBackend
result
    SettingsBackend
result' <- ((ManagedPtr SettingsBackend -> SettingsBackend)
-> Ptr SettingsBackend -> IO SettingsBackend
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr SettingsBackend -> SettingsBackend
Gio.SettingsBackend.SettingsBackend) Ptr SettingsBackend
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filename'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
rootPath'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeRootGroup
    SettingsBackend -> IO SettingsBackend
forall (m :: * -> *) a. Monad m => a -> m a
return SettingsBackend
result'


-- function io_scheduler_push_job
-- Args: [ Arg
--           { argCName = "job_func"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "IOSchedulerJobFunc" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GIOSchedulerJobFunc."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeNotified
--           , argClosure = 1
--           , argDestroy = 2
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data to pass to @job_func"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "notify"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "DestroyNotify" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GDestroyNotify for @user_data, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "io_priority"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the [I/O priority][io-priority]\nof the request."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "optional #GCancellable object, %NULL to ignore."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_io_scheduler_push_job" g_io_scheduler_push_job :: 
    FunPtr Gio.Callbacks.C_IOSchedulerJobFunc -> -- job_func : TInterface (Name {namespace = "Gio", name = "IOSchedulerJobFunc"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    Int32 ->                                -- io_priority : TBasicType TInt
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    IO ()

{-# DEPRECATED ioSchedulerPushJob ["use t'GI.GLib.Structs.ThreadPool.ThreadPool' or 'GI.Gio.Objects.Task.taskRunInThread'"] #-}
-- | Schedules the I\/O job to run in another thread.
-- 
-- /@notify@/ will be called on /@userData@/ after /@jobFunc@/ has returned,
-- regardless whether the job was cancelled or has run to completion.
-- 
-- If /@cancellable@/ is not 'P.Nothing', it can be used to cancel the I\/O job
-- by calling 'GI.Gio.Objects.Cancellable.cancellableCancel' or by calling
-- 'GI.Gio.Functions.ioSchedulerCancelAllJobs'.
ioSchedulerPushJob ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
    Gio.Callbacks.IOSchedulerJobFunc
    -- ^ /@jobFunc@/: a t'GI.Gio.Callbacks.IOSchedulerJobFunc'.
    -> Int32
    -- ^ /@ioPriority@/: the [I\/O priority][io-priority]
    -- of the request.
    -> Maybe (a)
    -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore.
    -> m ()
ioSchedulerPushJob :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
IOSchedulerJobFunc -> Int32 -> Maybe a -> m ()
ioSchedulerPushJob IOSchedulerJobFunc
jobFunc Int32
ioPriority Maybe a
cancellable = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    FunPtr C_IOSchedulerJobFunc
jobFunc' <- C_IOSchedulerJobFunc -> IO (FunPtr C_IOSchedulerJobFunc)
Gio.Callbacks.mk_IOSchedulerJobFunc (Maybe (Ptr (FunPtr C_IOSchedulerJobFunc))
-> IOSchedulerJobFunc_WithClosures -> C_IOSchedulerJobFunc
Gio.Callbacks.wrap_IOSchedulerJobFunc Maybe (Ptr (FunPtr C_IOSchedulerJobFunc))
forall a. Maybe a
Nothing (IOSchedulerJobFunc -> IOSchedulerJobFunc_WithClosures
Gio.Callbacks.drop_closures_IOSchedulerJobFunc IOSchedulerJobFunc
jobFunc))
    Ptr Cancellable
maybeCancellable <- case Maybe a
cancellable of
        Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just a
jCancellable -> do
            Ptr Cancellable
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    let userData :: Ptr ()
userData = FunPtr C_IOSchedulerJobFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_IOSchedulerJobFunc
jobFunc'
    let notify :: FunPtr (Ptr a -> IO ())
notify = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
SP.safeFreeFunPtrPtr
    FunPtr C_IOSchedulerJobFunc
-> Ptr ()
-> FunPtr C_DestroyNotify
-> Int32
-> Ptr Cancellable
-> IO ()
g_io_scheduler_push_job FunPtr C_IOSchedulerJobFunc
jobFunc' Ptr ()
userData FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
notify Int32
ioPriority Ptr Cancellable
maybeCancellable
    Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
cancellable a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function io_scheduler_cancel_all_jobs
-- Args: []
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_io_scheduler_cancel_all_jobs" g_io_scheduler_cancel_all_jobs :: 
    IO ()

{-# DEPRECATED ioSchedulerCancelAllJobs ["You should never call this function, since you don\\'t","know how other libraries in your program might be making use of","gioscheduler."] #-}
-- | Cancels all cancellable I\/O jobs.
-- 
-- A job is cancellable if a t'GI.Gio.Objects.Cancellable.Cancellable' was passed into
-- 'GI.Gio.Functions.ioSchedulerPushJob'.
ioSchedulerCancelAllJobs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
ioSchedulerCancelAllJobs :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
ioSchedulerCancelAllJobs  = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO ()
g_io_scheduler_cancel_all_jobs
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function io_modules_scan_all_in_directory_with_scope
-- Args: [ Arg
--           { argCName = "dirname"
--           , argType = TBasicType TFileName
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "pathname for a directory containing modules\n    to scan."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "scope"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "IOModuleScope" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a scope to use when scanning the modules"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_io_modules_scan_all_in_directory_with_scope" g_io_modules_scan_all_in_directory_with_scope :: 
    CString ->                              -- dirname : TBasicType TFileName
    Ptr Gio.IOModuleScope.IOModuleScope ->  -- scope : TInterface (Name {namespace = "Gio", name = "IOModuleScope"})
    IO ()

-- | Scans all the modules in the specified directory, ensuring that
-- any extension point implemented by a module is registered.
-- 
-- This may not actually load and initialize all the types in each
-- module, some modules may be lazily loaded and initialized when
-- an extension point it implements is used with e.g.
-- 'GI.Gio.Structs.IOExtensionPoint.iOExtensionPointGetExtensions' or
-- 'GI.Gio.Structs.IOExtensionPoint.iOExtensionPointGetExtensionByName'.
-- 
-- If you need to guarantee that all types are loaded in all the modules,
-- use @/g_io_modules_load_all_in_directory()/@.
-- 
-- /Since: 2.30/
ioModulesScanAllInDirectoryWithScope ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Char]
    -- ^ /@dirname@/: pathname for a directory containing modules
    --     to scan.
    -> Gio.IOModuleScope.IOModuleScope
    -- ^ /@scope@/: a scope to use when scanning the modules
    -> m ()
ioModulesScanAllInDirectoryWithScope :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
[Char] -> IOModuleScope -> m ()
ioModulesScanAllInDirectoryWithScope [Char]
dirname IOModuleScope
scope = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
dirname' <- [Char] -> IO CString
stringToCString [Char]
dirname
    Ptr IOModuleScope
scope' <- IOModuleScope -> IO (Ptr IOModuleScope)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr IOModuleScope
scope
    CString -> Ptr IOModuleScope -> IO ()
g_io_modules_scan_all_in_directory_with_scope CString
dirname' Ptr IOModuleScope
scope'
    IOModuleScope -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr IOModuleScope
scope
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
dirname'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function io_modules_scan_all_in_directory
-- Args: [ Arg
--           { argCName = "dirname"
--           , argType = TBasicType TFileName
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "pathname for a directory containing modules\n    to scan."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_io_modules_scan_all_in_directory" g_io_modules_scan_all_in_directory :: 
    CString ->                              -- dirname : TBasicType TFileName
    IO ()

-- | Scans all the modules in the specified directory, ensuring that
-- any extension point implemented by a module is registered.
-- 
-- This may not actually load and initialize all the types in each
-- module, some modules may be lazily loaded and initialized when
-- an extension point it implements is used with e.g.
-- 'GI.Gio.Structs.IOExtensionPoint.iOExtensionPointGetExtensions' or
-- 'GI.Gio.Structs.IOExtensionPoint.iOExtensionPointGetExtensionByName'.
-- 
-- If you need to guarantee that all types are loaded in all the modules,
-- use @/g_io_modules_load_all_in_directory()/@.
-- 
-- /Since: 2.24/
ioModulesScanAllInDirectory ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Char]
    -- ^ /@dirname@/: pathname for a directory containing modules
    --     to scan.
    -> m ()
ioModulesScanAllInDirectory :: forall (m :: * -> *). (HasCallStack, MonadIO m) => [Char] -> m ()
ioModulesScanAllInDirectory [Char]
dirname = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
dirname' <- [Char] -> IO CString
stringToCString [Char]
dirname
    CString -> IO ()
g_io_modules_scan_all_in_directory CString
dirname'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
dirname'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function io_error_quark
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "g_io_error_quark" g_io_error_quark :: 
    IO Word32

-- | Gets the GIO Error Quark.
ioErrorQuark ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word32
    -- ^ __Returns:__ a @/GQuark/@.
ioErrorQuark :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word32
ioErrorQuark  = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Word32
result <- IO Word32
g_io_error_quark
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function io_error_from_errno
-- Args: [ Arg
--           { argCName = "err_no"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Error number as defined in errno.h."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gio" , name = "IOErrorEnum" })
-- throws : False
-- Skip return : False

foreign import ccall "g_io_error_from_errno" g_io_error_from_errno :: 
    Int32 ->                                -- err_no : TBasicType TInt
    IO CUInt

-- | Converts errno.h error codes into GIO error codes. The fallback
-- value 'GI.Gio.Enums.IOErrorEnumFailed' is returned for error codes not currently
-- handled (but note that future GLib releases may return a more
-- specific value instead).
-- 
-- As @/errno/@ is global and may be modified by intermediate function
-- calls, you should save its value as soon as the call which sets it
ioErrorFromErrno ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@errNo@/: Error number as defined in errno.h.
    -> m Gio.Enums.IOErrorEnum
    -- ^ __Returns:__ t'GI.Gio.Enums.IOErrorEnum' value for the given errno.h error number.
ioErrorFromErrno :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Int32 -> m IOErrorEnum
ioErrorFromErrno Int32
errNo = IO IOErrorEnum -> m IOErrorEnum
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO IOErrorEnum -> m IOErrorEnum)
-> IO IOErrorEnum -> m IOErrorEnum
forall a b. (a -> b) -> a -> b
$ do
    CUInt
result <- Int32 -> IO CUInt
g_io_error_from_errno Int32
errNo
    let result' :: IOErrorEnum
result' = (Int -> IOErrorEnum
forall a. Enum a => Int -> a
toEnum (Int -> IOErrorEnum) -> (CUInt -> Int) -> CUInt -> IOErrorEnum
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    IOErrorEnum -> IO IOErrorEnum
forall (m :: * -> *) a. Monad m => a -> m a
return IOErrorEnum
result'


-- function dbus_unescape_object_path
-- Args: [ Arg
--           { argCName = "s"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the string to unescape"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUInt8))
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_unescape_object_path" g_dbus_unescape_object_path :: 
    CString ->                              -- s : TBasicType TUTF8
    IO (Ptr Word8)

-- | Unescapes an string that was previously escaped with
-- 'GI.Gio.Functions.dbusEscapeObjectPath'. If the string is in a format that could
-- not have been returned by 'GI.Gio.Functions.dbusEscapeObjectPath', this function
-- returns 'P.Nothing'.
-- 
-- Encoding alphanumeric characters which do not need to be
-- encoded is not allowed (e.g @_63@ is not valid, the string
-- should contain @c@ instead).
-- 
-- /Since: 2.68/
dbusUnescapeObjectPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@s@/: the string to unescape
    -> m (Maybe ByteString)
    -- ^ __Returns:__ an
    --   unescaped version of /@s@/, or 'P.Nothing' if /@s@/ is not a string returned
    --   from 'GI.Gio.Functions.dbusEscapeObjectPath'. Free with 'GI.GLib.Functions.free'.
dbusUnescapeObjectPath :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m (Maybe ByteString)
dbusUnescapeObjectPath Text
s = IO (Maybe ByteString) -> m (Maybe ByteString)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe ByteString) -> m (Maybe ByteString))
-> IO (Maybe ByteString) -> m (Maybe ByteString)
forall a b. (a -> b) -> a -> b
$ do
    CString
s' <- Text -> IO CString
textToCString Text
s
    Ptr Word8
result <- CString -> IO (Ptr Word8)
g_dbus_unescape_object_path CString
s'
    Maybe ByteString
maybeResult <- Ptr Word8 -> (Ptr Word8 -> IO ByteString) -> IO (Maybe ByteString)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Word8
result ((Ptr Word8 -> IO ByteString) -> IO (Maybe ByteString))
-> (Ptr Word8 -> IO ByteString) -> IO (Maybe ByteString)
forall a b. (a -> b) -> a -> b
$ \Ptr Word8
result' -> do
        ByteString
result'' <- Ptr Word8 -> IO ByteString
unpackZeroTerminatedByteString Ptr Word8
result'
        ByteString -> IO ByteString
forall (m :: * -> *) a. Monad m => a -> m a
return ByteString
result''
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
s'
    Maybe ByteString -> IO (Maybe ByteString)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ByteString
maybeResult


-- function dbus_is_unique_name
-- Args: [ Arg
--           { argCName = "string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The string to check."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_is_unique_name" g_dbus_is_unique_name :: 
    CString ->                              -- string : TBasicType TUTF8
    IO CInt

-- | Checks if /@string@/ is a valid D-Bus unique bus name.
-- 
-- /Since: 2.26/
dbusIsUniqueName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@string@/: The string to check.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if valid, 'P.False' otherwise.
dbusIsUniqueName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool
dbusIsUniqueName Text
string = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
string' <- Text -> IO CString
textToCString Text
string
    CInt
result <- CString -> IO CInt
g_dbus_is_unique_name CString
string'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function dbus_is_supported_address
-- Args: [ Arg
--           { argCName = "string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A string." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_is_supported_address" g_dbus_is_supported_address :: 
    CString ->                              -- string : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Like 'GI.Gio.Functions.dbusIsAddress' but also checks if the library supports the
-- transports in /@string@/ and that key\/value pairs for each transport
-- are valid. See the specification of the
-- <https://dbus.freedesktop.org/doc/dbus-specification.html#addresses D-Bus address format>.
-- 
-- /Since: 2.26/
dbusIsSupportedAddress ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@string@/: A string.
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
dbusIsSupportedAddress :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m ()
dbusIsSupportedAddress Text
string = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
string' <- Text -> IO CString
textToCString Text
string
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CString -> Ptr (Ptr GError) -> IO CInt
g_dbus_is_supported_address CString
string'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
     )


-- function dbus_is_name
-- Args: [ Arg
--           { argCName = "string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The string to check."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_is_name" g_dbus_is_name :: 
    CString ->                              -- string : TBasicType TUTF8
    IO CInt

-- | Checks if /@string@/ is a valid D-Bus bus name (either unique or well-known).
-- 
-- /Since: 2.26/
dbusIsName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@string@/: The string to check.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if valid, 'P.False' otherwise.
dbusIsName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool
dbusIsName Text
string = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
string' <- Text -> IO CString
textToCString Text
string
    CInt
result <- CString -> IO CInt
g_dbus_is_name CString
string'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function dbus_is_member_name
-- Args: [ Arg
--           { argCName = "string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The string to check."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_is_member_name" g_dbus_is_member_name :: 
    CString ->                              -- string : TBasicType TUTF8
    IO CInt

-- | Checks if /@string@/ is a valid D-Bus member (e.g. signal or method) name.
-- 
-- /Since: 2.26/
dbusIsMemberName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@string@/: The string to check.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if valid, 'P.False' otherwise.
dbusIsMemberName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool
dbusIsMemberName Text
string = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
string' <- Text -> IO CString
textToCString Text
string
    CInt
result <- CString -> IO CInt
g_dbus_is_member_name CString
string'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function dbus_is_interface_name
-- Args: [ Arg
--           { argCName = "string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The string to check."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_is_interface_name" g_dbus_is_interface_name :: 
    CString ->                              -- string : TBasicType TUTF8
    IO CInt

-- | Checks if /@string@/ is a valid D-Bus interface name.
-- 
-- /Since: 2.26/
dbusIsInterfaceName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@string@/: The string to check.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if valid, 'P.False' otherwise.
dbusIsInterfaceName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool
dbusIsInterfaceName Text
string = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
string' <- Text -> IO CString
textToCString Text
string
    CInt
result <- CString -> IO CInt
g_dbus_is_interface_name CString
string'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function dbus_is_guid
-- Args: [ Arg
--           { argCName = "string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The string to check."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_is_guid" g_dbus_is_guid :: 
    CString ->                              -- string : TBasicType TUTF8
    IO CInt

-- | Checks if /@string@/ is a D-Bus GUID.
-- 
-- See the documentation for 'GI.Gio.Functions.dbusGenerateGuid' for more information about
-- the format of a GUID.
-- 
-- /Since: 2.26/
dbusIsGuid ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@string@/: The string to check.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@string@/ is a GUID, 'P.False' otherwise.
dbusIsGuid :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool
dbusIsGuid Text
string = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
string' <- Text -> IO CString
textToCString Text
string
    CInt
result <- CString -> IO CInt
g_dbus_is_guid CString
string'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function dbus_is_error_name
-- Args: [ Arg
--           { argCName = "string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The string to check."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_is_error_name" g_dbus_is_error_name :: 
    CString ->                              -- string : TBasicType TUTF8
    IO CInt

-- | Check whether /@string@/ is a valid D-Bus error name.
-- 
-- This function returns the same result as 'GI.Gio.Functions.dbusIsInterfaceName',
-- because D-Bus error names are defined to have exactly the
-- same syntax as interface names.
-- 
-- /Since: 2.70/
dbusIsErrorName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@string@/: The string to check.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if valid, 'P.False' otherwise.
dbusIsErrorName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool
dbusIsErrorName Text
string = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
string' <- Text -> IO CString
textToCString Text
string
    CInt
result <- CString -> IO CInt
g_dbus_is_error_name CString
string'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function dbus_is_address
-- Args: [ Arg
--           { argCName = "string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A string." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_is_address" g_dbus_is_address :: 
    CString ->                              -- string : TBasicType TUTF8
    IO CInt

-- | Checks if /@string@/ is a
-- <https://dbus.freedesktop.org/doc/dbus-specification.html#addresses D-Bus address>.
-- 
-- This doesn\'t check if /@string@/ is actually supported by t'GI.Gio.Objects.DBusServer.DBusServer'
-- or t'GI.Gio.Objects.DBusConnection.DBusConnection' - use 'GI.Gio.Functions.dbusIsSupportedAddress' to do more
-- checks.
-- 
-- /Since: 2.26/
dbusIsAddress ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@string@/: A string.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@string@/ is a valid D-Bus address, 'P.False' otherwise.
dbusIsAddress :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool
dbusIsAddress Text
string = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
string' <- Text -> IO CString
textToCString Text
string
    CInt
result <- CString -> IO CInt
g_dbus_is_address CString
string'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function dbus_gvariant_to_gvalue
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GVariant." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_gvalue"
--           , argType = TGValue
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Return location pointing to a zero-filled (uninitialized) #GValue."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_gvariant_to_gvalue" g_dbus_gvariant_to_gvalue :: 
    Ptr GVariant ->                         -- value : TVariant
    Ptr GValue ->                           -- out_gvalue : TGValue
    IO ()

-- | Converts a t'GVariant' to a t'GI.GObject.Structs.Value.Value'. If /@value@/ is floating, it is consumed.
-- 
-- The rules specified in the 'GI.Gio.Functions.dbusGvalueToGvariant' function are
-- used - this function is essentially its reverse form. So, a t'GVariant'
-- containing any basic or string array type will be converted to a t'GI.GObject.Structs.Value.Value'
-- containing a basic value or string array. Any other t'GVariant' (handle,
-- variant, tuple, dict entry) will be converted to a t'GI.GObject.Structs.Value.Value' containing that
-- t'GVariant'.
-- 
-- The conversion never fails - a valid t'GI.GObject.Structs.Value.Value' is always returned in
-- /@outGvalue@/.
-- 
-- /Since: 2.30/
dbusGvariantToGvalue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GVariant
    -- ^ /@value@/: A t'GVariant'.
    -> m (GValue)
dbusGvariantToGvalue :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GVariant -> m GValue
dbusGvariantToGvalue GVariant
value = IO GValue -> m GValue
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GValue -> m GValue) -> IO GValue -> m GValue
forall a b. (a -> b) -> a -> b
$ do
    Ptr GVariant
value' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
value
    Ptr GValue
outGvalue <- Int -> IO (Ptr GValue)
forall a. Int -> IO (Ptr a)
SP.callocBytes Int
24 :: IO (Ptr GValue)
    Ptr GVariant -> Ptr GValue -> IO ()
g_dbus_gvariant_to_gvalue Ptr GVariant
value' Ptr GValue
outGvalue
    GValue
outGvalue' <- Ptr GValue -> IO GValue
B.GValue.wrapGValuePtr Ptr GValue
outGvalue
    GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GVariant
value
    GValue -> IO GValue
forall (m :: * -> *) a. Monad m => a -> m a
return GValue
outGvalue'


-- function dbus_gvalue_to_gvariant
-- Args: [ Arg
--           { argCName = "gvalue"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GValue to convert to a #GVariant"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "type"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "VariantType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GVariantType" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_gvalue_to_gvariant" g_dbus_gvalue_to_gvariant :: 
    Ptr GValue ->                           -- gvalue : TGValue
    Ptr GLib.VariantType.VariantType ->     -- type : TInterface (Name {namespace = "GLib", name = "VariantType"})
    IO (Ptr GVariant)

-- | Converts a t'GI.GObject.Structs.Value.Value' to a t'GVariant' of the type indicated by the /@type@/
-- parameter.
-- 
-- The conversion is using the following rules:
-- 
-- * @/G_TYPE_STRING/@: \'s\', \'o\', \'g\' or \'ay\'
-- * @/G_TYPE_STRV/@: \'as\', \'ao\' or \'aay\'
-- * @/G_TYPE_BOOLEAN/@: \'b\'
-- * @/G_TYPE_UCHAR/@: \'y\'
-- * @/G_TYPE_INT/@: \'i\', \'n\'
-- * @/G_TYPE_UINT/@: \'u\', \'q\'
-- * @/G_TYPE_INT64/@ \'x\'
-- * @/G_TYPE_UINT64/@: \'t\'
-- * @/G_TYPE_DOUBLE/@: \'d\'
-- * @/G_TYPE_VARIANT/@: Any t'GI.GLib.Structs.VariantType.VariantType'
-- 
-- 
-- This can fail if e.g. /@gvalue@/ is of type @/G_TYPE_STRING/@ and /@type@/
-- is [\'i\'][G-VARIANT-TYPE-INT32:CAPS]. It will also fail for any t'GType'
-- (including e.g. @/G_TYPE_OBJECT/@ and @/G_TYPE_BOXED/@ derived-types) not
-- in the table above.
-- 
-- Note that if /@gvalue@/ is of type @/G_TYPE_VARIANT/@ and its value is
-- 'P.Nothing', the empty t'GVariant' instance (never 'P.Nothing') for /@type@/ is
-- returned (e.g. 0 for scalar types, the empty string for string types,
-- \'\/\' for object path types, the empty array for any array type and so on).
-- 
-- See the 'GI.Gio.Functions.dbusGvariantToGvalue' function for how to convert a
-- t'GVariant' to a t'GI.GObject.Structs.Value.Value'.
-- 
-- /Since: 2.30/
dbusGvalueToGvariant ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@gvalue@/: A t'GI.GObject.Structs.Value.Value' to convert to a t'GVariant'
    -> GLib.VariantType.VariantType
    -- ^ /@type@/: A t'GI.GLib.Structs.VariantType.VariantType'
    -> m GVariant
    -- ^ __Returns:__ A t'GVariant' (never floating) of
    --     t'GI.GLib.Structs.VariantType.VariantType' /@type@/ holding the data from /@gvalue@/ or an empty t'GVariant'
    --     in case of failure. Free with 'GI.GLib.Structs.Variant.variantUnref'.
dbusGvalueToGvariant :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> VariantType -> m GVariant
dbusGvalueToGvariant GValue
gvalue VariantType
type_ = IO GVariant -> m GVariant
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GVariant -> m GVariant) -> IO GVariant -> m GVariant
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
gvalue' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
gvalue
    Ptr VariantType
type_' <- VariantType -> IO (Ptr VariantType)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr VariantType
type_
    Ptr GVariant
result <- Ptr GValue -> Ptr VariantType -> IO (Ptr GVariant)
g_dbus_gvalue_to_gvariant Ptr GValue
gvalue' Ptr VariantType
type_'
    Text -> Ptr GVariant -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"dbusGvalueToGvariant" Ptr GVariant
result
    GVariant
result' <- Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr Ptr GVariant
result
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
gvalue
    VariantType -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr VariantType
type_
    GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result'


-- function dbus_generate_guid
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_generate_guid" g_dbus_generate_guid :: 
    IO CString

-- | Generate a D-Bus GUID that can be used with
-- e.g. 'GI.Gio.Objects.DBusConnection.dBusConnectionNew'.
-- 
-- See the
-- <https://dbus.freedesktop.org/doc/dbus-specification.html#uuids D-Bus specification>
-- regarding what strings are valid D-Bus GUIDs. The specification refers to
-- these as ‘UUIDs’ whereas GLib (for historical reasons) refers to them as
-- ‘GUIDs’. The terms are interchangeable.
-- 
-- Note that D-Bus GUIDs do not follow
-- <https://datatracker.ietf.org/doc/html/rfc4122 RFC 4122>.
-- 
-- /Since: 2.26/
dbusGenerateGuid ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m T.Text
    -- ^ __Returns:__ A valid D-Bus GUID. Free with 'GI.GLib.Functions.free'.
dbusGenerateGuid :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Text
dbusGenerateGuid  = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
result <- IO CString
g_dbus_generate_guid
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"dbusGenerateGuid" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function dbus_escape_object_path_bytestring
-- Args: [ Arg
--           { argCName = "bytes"
--           , argType = TCArray True (-1) (-1) (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the string of bytes to escape"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_escape_object_path_bytestring" g_dbus_escape_object_path_bytestring :: 
    Ptr Word8 ->                            -- bytes : TCArray True (-1) (-1) (TBasicType TUInt8)
    IO CString

-- | Escapes /@bytes@/ for use in a D-Bus object path component.
-- /@bytes@/ is an array of zero or more nonzero bytes in an
-- unspecified encoding, followed by a single zero byte.
-- 
-- The escaping method consists of replacing all non-alphanumeric
-- characters (see @/g_ascii_isalnum()/@) with their hexadecimal value
-- preceded by an underscore (@_@). For example:
-- @foo.bar.baz@ will become @foo_2ebar_2ebaz@.
-- 
-- This method is appropriate to use when the input is nearly
-- a valid object path component but is not when your input
-- is far from being a valid object path component.
-- Other escaping algorithms are also valid to use with
-- D-Bus object paths.
-- 
-- This can be reversed with 'GI.Gio.Functions.dbusUnescapeObjectPath'.
-- 
-- /Since: 2.68/
dbusEscapeObjectPathBytestring ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@bytes@/: the string of bytes to escape
    -> m T.Text
    -- ^ __Returns:__ an escaped version of /@bytes@/. Free with 'GI.GLib.Functions.free'.
dbusEscapeObjectPathBytestring :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m Text
dbusEscapeObjectPathBytestring ByteString
bytes = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Word8
bytes' <- ByteString -> IO (Ptr Word8)
packZeroTerminatedByteString ByteString
bytes
    CString
result <- Ptr Word8 -> IO CString
g_dbus_escape_object_path_bytestring Ptr Word8
bytes'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"dbusEscapeObjectPathBytestring" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
bytes'
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function dbus_escape_object_path
-- Args: [ Arg
--           { argCName = "s"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the string to escape"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_escape_object_path" g_dbus_escape_object_path :: 
    CString ->                              -- s : TBasicType TUTF8
    IO CString

-- | This is a language binding friendly version of 'GI.Gio.Functions.dbusEscapeObjectPathBytestring'.
-- 
-- /Since: 2.68/
dbusEscapeObjectPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@s@/: the string to escape
    -> m T.Text
    -- ^ __Returns:__ an escaped version of /@s@/. Free with 'GI.GLib.Functions.free'.
dbusEscapeObjectPath :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
dbusEscapeObjectPath Text
s = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
s' <- Text -> IO CString
textToCString Text
s
    CString
result <- CString -> IO CString
g_dbus_escape_object_path CString
s'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"dbusEscapeObjectPath" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
s'
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function dbus_address_get_stream_sync
-- Args: [ Arg
--           { argCName = "address"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A valid D-Bus address."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_guid"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "%NULL or return location to store the GUID extracted from @address, if any."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GCancellable or %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gio" , name = "IOStream" })
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_address_get_stream_sync" g_dbus_address_get_stream_sync :: 
    CString ->                              -- address : TBasicType TUTF8
    Ptr CString ->                          -- out_guid : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Gio.IOStream.IOStream)

-- | Synchronously connects to an endpoint specified by /@address@/ and
-- sets up the connection so it is in a state to run the client-side
-- of the D-Bus authentication conversation. /@address@/ must be in the
-- <https://dbus.freedesktop.org/doc/dbus-specification.html#addresses D-Bus address format>.
-- 
-- A server is not required to set a GUID, so /@outGuid@/ may be set to 'P.Nothing'
-- even on success.
-- 
-- This is a synchronous failable function. See
-- 'GI.Gio.Functions.dbusAddressGetStream' for the asynchronous version.
-- 
-- /Since: 2.26/
dbusAddressGetStreamSync ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
    T.Text
    -- ^ /@address@/: A valid D-Bus address.
    -> Maybe (a)
    -- ^ /@cancellable@/: A t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing'.
    -> m ((Gio.IOStream.IOStream, Maybe T.Text))
    -- ^ __Returns:__ A t'GI.Gio.Objects.IOStream.IOStream' or 'P.Nothing' if /@error@/ is set. /(Can throw 'Data.GI.Base.GError.GError')/
dbusAddressGetStreamSync :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Text -> Maybe a -> m (IOStream, Maybe Text)
dbusAddressGetStreamSync Text
address Maybe a
cancellable = IO (IOStream, Maybe Text) -> m (IOStream, Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (IOStream, Maybe Text) -> m (IOStream, Maybe Text))
-> IO (IOStream, Maybe Text) -> m (IOStream, Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    CString
address' <- Text -> IO CString
textToCString Text
address
    Ptr CString
outGuid <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr Cancellable
maybeCancellable <- case Maybe a
cancellable of
        Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just a
jCancellable -> do
            Ptr Cancellable
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO (IOStream, Maybe Text) -> IO () -> IO (IOStream, Maybe Text)
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr IOStream
result <- (Ptr (Ptr GError) -> IO (Ptr IOStream)) -> IO (Ptr IOStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr IOStream)) -> IO (Ptr IOStream))
-> (Ptr (Ptr GError) -> IO (Ptr IOStream)) -> IO (Ptr IOStream)
forall a b. (a -> b) -> a -> b
$ CString
-> Ptr CString
-> Ptr Cancellable
-> Ptr (Ptr GError)
-> IO (Ptr IOStream)
g_dbus_address_get_stream_sync CString
address' Ptr CString
outGuid Ptr Cancellable
maybeCancellable
        Text -> Ptr IOStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"dbusAddressGetStreamSync" Ptr IOStream
result
        IOStream
result' <- ((ManagedPtr IOStream -> IOStream) -> Ptr IOStream -> IO IOStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr IOStream -> IOStream
Gio.IOStream.IOStream) Ptr IOStream
result
        CString
outGuid' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
outGuid
        Maybe Text
maybeOutGuid' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
outGuid' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
outGuid'' -> do
            Text
outGuid''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
outGuid''
            Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
outGuid'''
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
outGuid'
        Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
cancellable a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
address'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outGuid
        (IOStream, Maybe Text) -> IO (IOStream, Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (IOStream
result', Maybe Text
maybeOutGuid')
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
address'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outGuid
     )


-- function dbus_address_get_stream_finish
-- Args: [ Arg
--           { argCName = "res"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "A #GAsyncResult obtained from the GAsyncReadyCallback passed to g_dbus_address_get_stream()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out_guid"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "%NULL or return location to store the GUID extracted from @address, if any."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gio" , name = "IOStream" })
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_address_get_stream_finish" g_dbus_address_get_stream_finish :: 
    Ptr Gio.AsyncResult.AsyncResult ->      -- res : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr CString ->                          -- out_guid : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Gio.IOStream.IOStream)

-- | Finishes an operation started with 'GI.Gio.Functions.dbusAddressGetStream'.
-- 
-- A server is not required to set a GUID, so /@outGuid@/ may be set to 'P.Nothing'
-- even on success.
-- 
-- /Since: 2.26/
dbusAddressGetStreamFinish ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
    a
    -- ^ /@res@/: A t'GI.Gio.Interfaces.AsyncResult.AsyncResult' obtained from the GAsyncReadyCallback passed to 'GI.Gio.Functions.dbusAddressGetStream'.
    -> m ((Gio.IOStream.IOStream, Maybe T.Text))
    -- ^ __Returns:__ A t'GI.Gio.Objects.IOStream.IOStream' or 'P.Nothing' if /@error@/ is set. /(Can throw 'Data.GI.Base.GError.GError')/
dbusAddressGetStreamFinish :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAsyncResult a) =>
a -> m (IOStream, Maybe Text)
dbusAddressGetStreamFinish a
res = IO (IOStream, Maybe Text) -> m (IOStream, Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (IOStream, Maybe Text) -> m (IOStream, Maybe Text))
-> IO (IOStream, Maybe Text) -> m (IOStream, Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr AsyncResult
res' <- a -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
res
    Ptr CString
outGuid <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    IO (IOStream, Maybe Text) -> IO () -> IO (IOStream, Maybe Text)
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr IOStream
result <- (Ptr (Ptr GError) -> IO (Ptr IOStream)) -> IO (Ptr IOStream)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr IOStream)) -> IO (Ptr IOStream))
-> (Ptr (Ptr GError) -> IO (Ptr IOStream)) -> IO (Ptr IOStream)
forall a b. (a -> b) -> a -> b
$ Ptr AsyncResult
-> Ptr CString -> Ptr (Ptr GError) -> IO (Ptr IOStream)
g_dbus_address_get_stream_finish Ptr AsyncResult
res' Ptr CString
outGuid
        Text -> Ptr IOStream -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"dbusAddressGetStreamFinish" Ptr IOStream
result
        IOStream
result' <- ((ManagedPtr IOStream -> IOStream) -> Ptr IOStream -> IO IOStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr IOStream -> IOStream
Gio.IOStream.IOStream) Ptr IOStream
result
        CString
outGuid' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
outGuid
        Maybe Text
maybeOutGuid' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
outGuid' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
outGuid'' -> do
            Text
outGuid''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
outGuid''
            Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
outGuid'''
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
outGuid'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
res
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outGuid
        (IOStream, Maybe Text) -> IO (IOStream, Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (IOStream
result', Maybe Text
maybeOutGuid')
     ) (do
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outGuid
     )


-- function dbus_address_get_stream
-- Args: [ Arg
--           { argCName = "address"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A valid D-Bus address."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GCancellable or %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "A #GAsyncReadyCallback to call when the request is satisfied."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Data to pass to @callback."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_address_get_stream" g_dbus_address_get_stream :: 
    CString ->                              -- address : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Asynchronously connects to an endpoint specified by /@address@/ and
-- sets up the connection so it is in a state to run the client-side
-- of the D-Bus authentication conversation. /@address@/ must be in the
-- <https://dbus.freedesktop.org/doc/dbus-specification.html#addresses D-Bus address format>.
-- 
-- When the operation is finished, /@callback@/ will be invoked. You can
-- then call 'GI.Gio.Functions.dbusAddressGetStreamFinish' to get the result of
-- the operation.
-- 
-- This is an asynchronous failable function. See
-- 'GI.Gio.Functions.dbusAddressGetStreamSync' for the synchronous version.
-- 
-- /Since: 2.26/
dbusAddressGetStream ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
    T.Text
    -- ^ /@address@/: A valid D-Bus address.
    -> Maybe (a)
    -- ^ /@cancellable@/: A t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing'.
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: A t'GI.Gio.Callbacks.AsyncReadyCallback' to call when the request is satisfied.
    -> m ()
dbusAddressGetStream :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
Text -> Maybe a -> Maybe AsyncReadyCallback -> m ()
dbusAddressGetStream Text
address Maybe a
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
address' <- Text -> IO CString
textToCString Text
address
    Ptr Cancellable
maybeCancellable <- case Maybe a
cancellable of
        Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just a
jCancellable -> do
            Ptr Cancellable
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    CString
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> C_DestroyNotify
g_dbus_address_get_stream CString
address' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
    Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
cancellable a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
address'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function dbus_address_get_for_bus_sync
-- Args: [ Arg
--           { argCName = "bus_type"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "BusType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GBusType" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : True
-- Skip return : False

foreign import ccall "g_dbus_address_get_for_bus_sync" g_dbus_address_get_for_bus_sync :: 
    CInt ->                                 -- bus_type : TInterface (Name {namespace = "Gio", name = "BusType"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CString

-- | Synchronously looks up the D-Bus address for the well-known message
-- bus instance specified by /@busType@/. This may involve using various
-- platform specific mechanisms.
-- 
-- The returned address will be in the
-- <https://dbus.freedesktop.org/doc/dbus-specification.html#addresses D-Bus address format>.
-- 
-- /Since: 2.26/
dbusAddressGetForBusSync ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
    Gio.Enums.BusType
    -- ^ /@busType@/: a t'GI.Gio.Enums.BusType'
    -> Maybe (a)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing'
    -> m T.Text
    -- ^ __Returns:__ a valid D-Bus address string for /@busType@/ or
    --     'P.Nothing' if /@error@/ is set /(Can throw 'Data.GI.Base.GError.GError')/
dbusAddressGetForBusSync :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
BusType -> Maybe a -> m Text
dbusAddressGetForBusSync BusType
busType Maybe a
cancellable = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    let busType' :: CInt
busType' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (BusType -> Int) -> BusType -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BusType -> Int
forall a. Enum a => a -> Int
fromEnum) BusType
busType
    Ptr Cancellable
maybeCancellable <- case Maybe a
cancellable of
        Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just a
jCancellable -> do
            Ptr Cancellable
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO Text -> IO () -> IO Text
forall a b. IO a -> IO b -> IO a
onException (do
        CString
result <- (Ptr (Ptr GError) -> IO CString) -> IO CString
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CString) -> IO CString)
-> (Ptr (Ptr GError) -> IO CString) -> IO CString
forall a b. (a -> b) -> a -> b
$ CInt -> Ptr Cancellable -> Ptr (Ptr GError) -> IO CString
g_dbus_address_get_for_bus_sync CInt
busType' Ptr Cancellable
maybeCancellable
        Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"dbusAddressGetForBusSync" CString
result
        Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
        Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
cancellable a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )


-- function dbus_address_escape_value
-- Args: [ Arg
--           { argCName = "string"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "an unescaped string to be included in a D-Bus address\n    as the value in a key-value pair"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_dbus_address_escape_value" g_dbus_address_escape_value :: 
    CString ->                              -- string : TBasicType TUTF8
    IO CString

-- | Escape /@string@/ so it can appear in a D-Bus address as the value
-- part of a key-value pair.
-- 
-- For instance, if /@string@/ is @\/run\/bus-for-:0@,
-- this function would return @\/run\/bus-for-%3A0@,
-- which could be used in a D-Bus address like
-- @unix:nonce-tcp:host=127.0.0.1,port=42,noncefile=\/run\/bus-for-%3A0@.
-- 
-- /Since: 2.36/
dbusAddressEscapeValue ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@string@/: an unescaped string to be included in a D-Bus address
    --     as the value in a key-value pair
    -> m T.Text
    -- ^ __Returns:__ a copy of /@string@/ with all
    --     non-optionally-escaped bytes escaped
dbusAddressEscapeValue :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
dbusAddressEscapeValue Text
string = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
string' <- Text -> IO CString
textToCString Text
string
    CString
result <- CString -> IO CString
g_dbus_address_escape_value CString
string'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"dbusAddressEscapeValue" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
string'
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function content_types_get_registered
-- Args: []
-- Lengths: []
-- returnType: Just (TGList (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "g_content_types_get_registered" g_content_types_get_registered :: 
    IO (Ptr (GList CString))

-- | Gets a list of strings containing all the registered content types
-- known to the system. The list and its data should be freed using
-- @g_list_free_full (list, g_free)@.
contentTypesGetRegistered ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [T.Text]
    -- ^ __Returns:__ list of the registered
    --     content types
contentTypesGetRegistered :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m [Text]
contentTypesGetRegistered  = IO [Text] -> m [Text]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
forall a b. (a -> b) -> a -> b
$ do
    Ptr (GList CString)
result <- IO (Ptr (GList CString))
g_content_types_get_registered
    [CString]
result' <- Ptr (GList CString) -> IO [CString]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList CString)
result
    [Text]
result'' <- (CString -> IO Text) -> [CString] -> IO [Text]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText [CString]
result'
    (CString -> IO ()) -> Ptr (GList CString) -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (GList (Ptr a)) -> IO ()
mapGList CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (GList CString)
result
    Ptr (GList CString) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList CString)
result
    [Text] -> IO [Text]
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result''


-- function content_type_set_mime_dirs
-- Args: [ Arg
--           { argCName = "dirs"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "%NULL-terminated list of\n   directories to load MIME data from, including any `mime/` subdirectory,\n   and with the first directory to try listed first"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_set_mime_dirs" g_content_type_set_mime_dirs :: 
    Ptr CString ->                          -- dirs : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO ()

-- | Set the list of directories used by GIO to load the MIME database.
-- If /@dirs@/ is 'P.Nothing', the directories used are the default:
-- 
--  - the @mime@ subdirectory of the directory in @$XDG_DATA_HOME@
--  - the @mime@ subdirectory of every directory in @$XDG_DATA_DIRS@
-- 
-- This function is intended to be used when writing tests that depend on
-- information stored in the MIME database, in order to control the data.
-- 
-- Typically, in case your tests use 'GI.GLib.Constants.TEST_OPTION_ISOLATE_DIRS', but they
-- depend on the system’s MIME database, you should call this function
-- with /@dirs@/ set to 'P.Nothing' before calling @/g_test_init()/@, for instance:
-- 
-- 
-- === /C code/
-- >
-- >  // Load MIME data from the system
-- >  g_content_type_set_mime_dirs (NULL);
-- >  // Isolate the environment
-- >  g_test_init (&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL);
-- >
-- >  …
-- >
-- >  return g_test_run ();
-- 
-- 
-- /Since: 2.60/
contentTypeSetMimeDirs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe ([T.Text])
    -- ^ /@dirs@/: 'P.Nothing'-terminated list of
    --    directories to load MIME data from, including any @mime\/@ subdirectory,
    --    and with the first directory to try listed first
    -> m ()
contentTypeSetMimeDirs :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Maybe [Text] -> m ()
contentTypeSetMimeDirs Maybe [Text]
dirs = 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 CString
maybeDirs <- case Maybe [Text]
dirs of
        Maybe [Text]
Nothing -> Ptr CString -> IO (Ptr CString)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CString
forall a. Ptr a
nullPtr
        Just [Text]
jDirs -> do
            Ptr CString
jDirs' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
jDirs
            Ptr CString -> IO (Ptr CString)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CString
jDirs'
    Ptr CString -> IO ()
g_content_type_set_mime_dirs Ptr CString
maybeDirs
    (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
maybeDirs
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
maybeDirs
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function content_type_is_unknown
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a content type string"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_is_unknown" g_content_type_is_unknown :: 
    CString ->                              -- type : TBasicType TUTF8
    IO CInt

-- | Checks if the content type is the generic \"unknown\" type.
-- On UNIX this is the \"application\/octet-stream\" mimetype,
-- while on win32 it is \"*\" and on OSX it is a dynamic type
-- or octet-stream.
contentTypeIsUnknown ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@type@/: a content type string
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the type is the unknown type.
contentTypeIsUnknown :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool
contentTypeIsUnknown Text
type_ = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
type_' <- Text -> IO CString
textToCString Text
type_
    CInt
result <- CString -> IO CInt
g_content_type_is_unknown CString
type_'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
type_'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function content_type_is_mime_type
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a content type string"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "mime_type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a mime type string" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_is_mime_type" g_content_type_is_mime_type :: 
    CString ->                              -- type : TBasicType TUTF8
    CString ->                              -- mime_type : TBasicType TUTF8
    IO CInt

-- | Determines if /@type@/ is a subset of /@mimeType@/.
-- Convenience wrapper around 'GI.Gio.Functions.contentTypeIsA'.
-- 
-- /Since: 2.52/
contentTypeIsMimeType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@type@/: a content type string
    -> T.Text
    -- ^ /@mimeType@/: a mime type string
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@type@/ is a kind of /@mimeType@/,
    --     'P.False' otherwise.
contentTypeIsMimeType :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Text -> m Bool
contentTypeIsMimeType Text
type_ Text
mimeType = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
type_' <- Text -> IO CString
textToCString Text
type_
    CString
mimeType' <- Text -> IO CString
textToCString Text
mimeType
    CInt
result <- CString -> CString -> IO CInt
g_content_type_is_mime_type CString
type_' CString
mimeType'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
type_'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
mimeType'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function content_type_is_a
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a content type string"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "supertype"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a content type string"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_is_a" g_content_type_is_a :: 
    CString ->                              -- type : TBasicType TUTF8
    CString ->                              -- supertype : TBasicType TUTF8
    IO CInt

-- | Determines if /@type@/ is a subset of /@supertype@/.
contentTypeIsA ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@type@/: a content type string
    -> T.Text
    -- ^ /@supertype@/: a content type string
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@type@/ is a kind of /@supertype@/,
    --     'P.False' otherwise.
contentTypeIsA :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Text -> m Bool
contentTypeIsA Text
type_ Text
supertype = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
type_' <- Text -> IO CString
textToCString Text
type_
    CString
supertype' <- Text -> IO CString
textToCString Text
supertype
    CInt
result <- CString -> CString -> IO CInt
g_content_type_is_a CString
type_' CString
supertype'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
type_'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
supertype'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function content_type_guess_for_tree
-- Args: [ Arg
--           { argCName = "root"
--           , argType = TInterface Name { namespace = "Gio" , name = "File" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the root of the tree to guess a type for"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_guess_for_tree" g_content_type_guess_for_tree :: 
    Ptr Gio.File.File ->                    -- root : TInterface (Name {namespace = "Gio", name = "File"})
    IO (Ptr CString)

-- | Tries to guess the type of the tree with root /@root@/, by
-- looking at the files it contains. The result is an array
-- of content types, with the best guess coming first.
-- 
-- The types returned all have the form x-content\/foo, e.g.
-- x-content\/audio-cdda (for audio CDs) or x-content\/image-dcf
-- (for a camera memory card). See the
-- <http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec shared-mime-info>
-- specification for more on x-content types.
-- 
-- This function is useful in the implementation of
-- 'GI.Gio.Interfaces.Mount.mountGuessContentType'.
-- 
-- /Since: 2.18/
contentTypeGuessForTree ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a) =>
    a
    -- ^ /@root@/: the root of the tree to guess a type for
    -> m [T.Text]
    -- ^ __Returns:__ an 'P.Nothing'-terminated
    --     array of zero or more content types. Free with 'GI.GLib.Functions.strfreev'
contentTypeGuessForTree :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFile a) =>
a -> m [Text]
contentTypeGuessForTree a
root = IO [Text] -> m [Text]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
forall a b. (a -> b) -> a -> b
$ do
    Ptr File
root' <- a -> IO (Ptr File)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
root
    Ptr CString
result <- Ptr File -> IO (Ptr CString)
g_content_type_guess_for_tree Ptr File
root'
    Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"contentTypeGuessForTree" Ptr CString
result
    [Text]
result' <- HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray Ptr CString
result
    (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
root
    [Text] -> IO [Text]
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result'


-- function content_type_guess
-- Args: [ Arg
--           { argCName = "filename"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a string, or %NULL" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a stream of data, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data_size"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the size of @data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result_uncertain"
--           , argType = TBasicType TBoolean
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "return location for the certainty\n    of the result, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "data_size"
--              , argType = TBasicType TUInt64
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the size of @data" , sinceVersion = Nothing }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_guess" g_content_type_guess :: 
    CString ->                              -- filename : TBasicType TUTF8
    Ptr Word8 ->                            -- data : TCArray False (-1) 2 (TBasicType TUInt8)
    Word64 ->                               -- data_size : TBasicType TUInt64
    Ptr CInt ->                             -- result_uncertain : TBasicType TBoolean
    IO CString

-- | Guesses the content type based on example data. If the function is
-- uncertain, /@resultUncertain@/ will be set to 'P.True'. Either /@filename@/
-- or /@data@/ may be 'P.Nothing', in which case the guess will be based solely
-- on the other argument.
contentTypeGuess ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    -- ^ /@filename@/: a string, or 'P.Nothing'
    -> Maybe (ByteString)
    -- ^ /@data@/: a stream of data, or 'P.Nothing'
    -> m ((T.Text, Bool))
    -- ^ __Returns:__ a string indicating a guessed content type for the
    --     given data. Free with 'GI.GLib.Functions.free'
contentTypeGuess :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Maybe Text -> Maybe ByteString -> m (Text, Bool)
contentTypeGuess Maybe Text
filename Maybe ByteString
data_ = IO (Text, Bool) -> m (Text, Bool)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Text, Bool) -> m (Text, Bool))
-> IO (Text, Bool) -> m (Text, Bool)
forall a b. (a -> b) -> a -> b
$ do
    let dataSize :: Word64
dataSize = case Maybe ByteString
data_ of
            Maybe ByteString
Nothing -> Word64
0
            Just ByteString
jData_ -> Int -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word64) -> Int -> Word64
forall a b. (a -> b) -> a -> b
$ ByteString -> Int
B.length ByteString
jData_
    CString
maybeFilename <- case Maybe Text
filename of
        Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jFilename -> do
            CString
jFilename' <- Text -> IO CString
textToCString Text
jFilename
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jFilename'
    Ptr Word8
maybeData_ <- case Maybe ByteString
data_ of
        Maybe ByteString
Nothing -> Ptr Word8 -> IO (Ptr Word8)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Word8
forall a. Ptr a
nullPtr
        Just ByteString
jData_ -> do
            Ptr Word8
jData_' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
jData_
            Ptr Word8 -> IO (Ptr Word8)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Word8
jData_'
    Ptr CInt
resultUncertain <- IO (Ptr CInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CInt)
    CString
result <- CString -> Ptr Word8 -> Word64 -> Ptr CInt -> IO CString
g_content_type_guess CString
maybeFilename Ptr Word8
maybeData_ Word64
dataSize Ptr CInt
resultUncertain
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"contentTypeGuess" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CInt
resultUncertain' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
resultUncertain
    let resultUncertain'' :: Bool
resultUncertain'' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
resultUncertain'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeFilename
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
maybeData_
    Ptr CInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CInt
resultUncertain
    (Text, Bool) -> IO (Text, Bool)
forall (m :: * -> *) a. Monad m => a -> m a
return (Text
result', Bool
resultUncertain'')


-- function content_type_get_symbolic_icon
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a content type string"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gio" , name = "Icon" })
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_get_symbolic_icon" g_content_type_get_symbolic_icon :: 
    CString ->                              -- type : TBasicType TUTF8
    IO (Ptr Gio.Icon.Icon)

-- | Gets the symbolic icon for a content type.
-- 
-- /Since: 2.34/
contentTypeGetSymbolicIcon ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@type@/: a content type string
    -> m Gio.Icon.Icon
    -- ^ __Returns:__ symbolic t'GI.Gio.Interfaces.Icon.Icon' corresponding to the content type.
    --     Free the returned object with 'GI.GObject.Objects.Object.objectUnref'
contentTypeGetSymbolicIcon :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Icon
contentTypeGetSymbolicIcon Text
type_ = IO Icon -> m Icon
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Icon -> m Icon) -> IO Icon -> m Icon
forall a b. (a -> b) -> a -> b
$ do
    CString
type_' <- Text -> IO CString
textToCString Text
type_
    Ptr Icon
result <- CString -> IO (Ptr Icon)
g_content_type_get_symbolic_icon CString
type_'
    Text -> Ptr Icon -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"contentTypeGetSymbolicIcon" Ptr Icon
result
    Icon
result' <- ((ManagedPtr Icon -> Icon) -> Ptr Icon -> IO Icon
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Icon -> Icon
Gio.Icon.Icon) Ptr Icon
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
type_'
    Icon -> IO Icon
forall (m :: * -> *) a. Monad m => a -> m a
return Icon
result'


-- function content_type_get_mime_type
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a content type string"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_get_mime_type" g_content_type_get_mime_type :: 
    CString ->                              -- type : TBasicType TUTF8
    IO CString

-- | Gets the mime type for the content type, if one is registered.
contentTypeGetMimeType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@type@/: a content type string
    -> m (Maybe T.Text)
    -- ^ __Returns:__ the registered mime type for the
    --     given /@type@/, or 'P.Nothing' if unknown; free with 'GI.GLib.Functions.free'.
contentTypeGetMimeType :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m (Maybe Text)
contentTypeGetMimeType Text
type_ = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    CString
type_' <- Text -> IO CString
textToCString Text
type_
    CString
result <- CString -> IO CString
g_content_type_get_mime_type CString
type_'
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
type_'
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function content_type_get_mime_dirs
-- Args: []
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_get_mime_dirs" g_content_type_get_mime_dirs :: 
    IO (Ptr CString)

-- | Get the list of directories which MIME data is loaded from. See
-- 'GI.Gio.Functions.contentTypeSetMimeDirs' for details.
-- 
-- /Since: 2.60/
contentTypeGetMimeDirs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [T.Text]
    -- ^ __Returns:__ 'P.Nothing'-terminated list of
    --    directories to load MIME data from, including any @mime\/@ subdirectory,
    --    and with the first directory to try listed first
contentTypeGetMimeDirs :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m [Text]
contentTypeGetMimeDirs  = IO [Text] -> m [Text]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
forall a b. (a -> b) -> a -> b
$ do
    Ptr CString
result <- IO (Ptr CString)
g_content_type_get_mime_dirs
    Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"contentTypeGetMimeDirs" Ptr CString
result
    [Text]
result' <- HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray Ptr CString
result
    [Text] -> IO [Text]
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result'


-- function content_type_get_icon
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a content type string"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gio" , name = "Icon" })
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_get_icon" g_content_type_get_icon :: 
    CString ->                              -- type : TBasicType TUTF8
    IO (Ptr Gio.Icon.Icon)

-- | Gets the icon for a content type.
contentTypeGetIcon ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@type@/: a content type string
    -> m Gio.Icon.Icon
    -- ^ __Returns:__ t'GI.Gio.Interfaces.Icon.Icon' corresponding to the content type. Free the returned
    --     object with 'GI.GObject.Objects.Object.objectUnref'
contentTypeGetIcon :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Icon
contentTypeGetIcon Text
type_ = IO Icon -> m Icon
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Icon -> m Icon) -> IO Icon -> m Icon
forall a b. (a -> b) -> a -> b
$ do
    CString
type_' <- Text -> IO CString
textToCString Text
type_
    Ptr Icon
result <- CString -> IO (Ptr Icon)
g_content_type_get_icon CString
type_'
    Text -> Ptr Icon -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"contentTypeGetIcon" Ptr Icon
result
    Icon
result' <- ((ManagedPtr Icon -> Icon) -> Ptr Icon -> IO Icon
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Icon -> Icon
Gio.Icon.Icon) Ptr Icon
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
type_'
    Icon -> IO Icon
forall (m :: * -> *) a. Monad m => a -> m a
return Icon
result'


-- function content_type_get_generic_icon_name
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a content type string"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_get_generic_icon_name" g_content_type_get_generic_icon_name :: 
    CString ->                              -- type : TBasicType TUTF8
    IO CString

-- | Gets the generic icon name for a content type.
-- 
-- See the
-- <http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec shared-mime-info>
-- specification for more on the generic icon name.
-- 
-- /Since: 2.34/
contentTypeGetGenericIconName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@type@/: a content type string
    -> m (Maybe T.Text)
    -- ^ __Returns:__ the registered generic icon name for the given /@type@/,
    --     or 'P.Nothing' if unknown. Free with 'GI.GLib.Functions.free'
contentTypeGetGenericIconName :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m (Maybe Text)
contentTypeGetGenericIconName Text
type_ = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    CString
type_' <- Text -> IO CString
textToCString Text
type_
    CString
result <- CString -> IO CString
g_content_type_get_generic_icon_name CString
type_'
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
type_'
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function content_type_get_description
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a content type string"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_get_description" g_content_type_get_description :: 
    CString ->                              -- type : TBasicType TUTF8
    IO CString

-- | Gets the human readable description of the content type.
contentTypeGetDescription ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@type@/: a content type string
    -> m T.Text
    -- ^ __Returns:__ a short description of the content type /@type@/. Free the
    --     returned string with 'GI.GLib.Functions.free'
contentTypeGetDescription :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
contentTypeGetDescription Text
type_ = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
type_' <- Text -> IO CString
textToCString Text
type_
    CString
result <- CString -> IO CString
g_content_type_get_description CString
type_'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"contentTypeGetDescription" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
type_'
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function content_type_from_mime_type
-- Args: [ Arg
--           { argCName = "mime_type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a mime type string" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_from_mime_type" g_content_type_from_mime_type :: 
    CString ->                              -- mime_type : TBasicType TUTF8
    IO CString

-- | Tries to find a content type based on the mime type name.
-- 
-- /Since: 2.18/
contentTypeFromMimeType ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@mimeType@/: a mime type string
    -> m (Maybe T.Text)
    -- ^ __Returns:__ Newly allocated string with content type or
    --     'P.Nothing'. Free with 'GI.GLib.Functions.free'
contentTypeFromMimeType :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> m (Maybe Text)
contentTypeFromMimeType Text
mimeType = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    CString
mimeType' <- Text -> IO CString
textToCString Text
mimeType
    CString
result <- CString -> IO CString
g_content_type_from_mime_type CString
mimeType'
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
mimeType'
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function content_type_equals
-- Args: [ Arg
--           { argCName = "type1"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a content type string"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "type2"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a content type string"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_equals" g_content_type_equals :: 
    CString ->                              -- type1 : TBasicType TUTF8
    CString ->                              -- type2 : TBasicType TUTF8
    IO CInt

-- | Compares two content types for equality.
contentTypeEquals ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@type1@/: a content type string
    -> T.Text
    -- ^ /@type2@/: a content type string
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the two strings are identical or equivalent,
    --     'P.False' otherwise.
contentTypeEquals :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Text -> m Bool
contentTypeEquals Text
type1 Text
type2 = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
type1' <- Text -> IO CString
textToCString Text
type1
    CString
type2' <- Text -> IO CString
textToCString Text
type2
    CInt
result <- CString -> CString -> IO CInt
g_content_type_equals CString
type1' CString
type2'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
type1'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
type2'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function content_type_can_be_executable
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a content type string"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_content_type_can_be_executable" g_content_type_can_be_executable :: 
    CString ->                              -- type : TBasicType TUTF8
    IO CInt

-- | Checks if a content type can be executable. Note that for instance
-- things like text files can be executables (i.e. scripts and batch files).
contentTypeCanBeExecutable ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@type@/: a content type string
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the file type corresponds to a type that
    --     can be executable, 'P.False' otherwise.
contentTypeCanBeExecutable :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool
contentTypeCanBeExecutable Text
type_ = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CString
type_' <- Text -> IO CString
textToCString Text
type_
    CInt
result <- CString -> IO CInt
g_content_type_can_be_executable CString
type_'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
type_'
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function bus_watch_name_on_connection
-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GDBusConnection."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name (well-known or unique) to watch."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface
--                 Name { namespace = "Gio" , name = "BusNameWatcherFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Flags from the #GBusNameWatcherFlags enumeration."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name_appeared_closure"
--           , argType = TGClosure Nothing
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "#GClosure to invoke when @name is known\nto exist or %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name_vanished_closure"
--           , argType = TGClosure Nothing
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "#GClosure to invoke when @name is known\nto not exist or %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_bus_watch_name_on_connection_with_closures" g_bus_watch_name_on_connection_with_closures :: 
    Ptr Gio.DBusConnection.DBusConnection -> -- connection : TInterface (Name {namespace = "Gio", name = "DBusConnection"})
    CString ->                              -- name : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "BusNameWatcherFlags"})
    Ptr (GClosure ()) ->                    -- name_appeared_closure : TGClosure Nothing
    Ptr (GClosure ()) ->                    -- name_vanished_closure : TGClosure Nothing
    IO Word32

-- | Version of @/g_bus_watch_name_on_connection()/@ using closures instead of callbacks for
-- easier binding in other languages.
-- 
-- /Since: 2.26/
busWatchNameOnConnection ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
    a
    -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'.
    -> T.Text
    -- ^ /@name@/: The name (well-known or unique) to watch.
    -> [Gio.Flags.BusNameWatcherFlags]
    -- ^ /@flags@/: Flags from the t'GI.Gio.Flags.BusNameWatcherFlags' enumeration.
    -> Maybe (GClosure b)
    -- ^ /@nameAppearedClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is known
    -- to exist or 'P.Nothing'.
    -> Maybe (GClosure c)
    -- ^ /@nameVanishedClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is known
    -- to not exist or 'P.Nothing'.
    -> m Word32
    -- ^ __Returns:__ An identifier (never 0) that can be used with
    -- 'GI.Gio.Functions.busUnwatchName' to stop watching the name.
busWatchNameOnConnection :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
a
-> Text
-> [BusNameWatcherFlags]
-> Maybe (GClosure b)
-> Maybe (GClosure c)
-> m Word32
busWatchNameOnConnection a
connection Text
name [BusNameWatcherFlags]
flags Maybe (GClosure b)
nameAppearedClosure Maybe (GClosure c)
nameVanishedClosure = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    CString
name' <- Text -> IO CString
textToCString Text
name
    let flags' :: CUInt
flags' = [BusNameWatcherFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [BusNameWatcherFlags]
flags
    Ptr (GClosure ())
maybeNameAppearedClosure <- case Maybe (GClosure b)
nameAppearedClosure of
        Maybe (GClosure b)
Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
forall a. Ptr a
nullPtr
        Just GClosure b
jNameAppearedClosure -> do
            Ptr (GClosure ())
jNameAppearedClosure' <- GClosure b -> IO (Ptr (GClosure ()))
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr GClosure b
jNameAppearedClosure
            Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
jNameAppearedClosure'
    Ptr (GClosure ())
maybeNameVanishedClosure <- case Maybe (GClosure c)
nameVanishedClosure of
        Maybe (GClosure c)
Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
forall a. Ptr a
nullPtr
        Just GClosure c
jNameVanishedClosure -> do
            Ptr (GClosure ())
jNameVanishedClosure' <- GClosure c -> IO (Ptr (GClosure ()))
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr GClosure c
jNameVanishedClosure
            Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
jNameVanishedClosure'
    Word32
result <- Ptr DBusConnection
-> CString
-> CUInt
-> Ptr (GClosure ())
-> Ptr (GClosure ())
-> IO Word32
g_bus_watch_name_on_connection_with_closures Ptr DBusConnection
connection' CString
name' CUInt
flags' Ptr (GClosure ())
maybeNameAppearedClosure Ptr (GClosure ())
maybeNameVanishedClosure
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    Maybe (GClosure b) -> (GClosure b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe (GClosure b)
nameAppearedClosure GClosure b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Maybe (GClosure c) -> (GClosure c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe (GClosure c)
nameVanishedClosure GClosure c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function bus_watch_name
-- Args: [ Arg
--           { argCName = "bus_type"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "BusType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The type of bus to watch a name on."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The name (well-known or unique) to watch."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface
--                 Name { namespace = "Gio" , name = "BusNameWatcherFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Flags from the #GBusNameWatcherFlags enumeration."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name_appeared_closure"
--           , argType = TGClosure Nothing
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "#GClosure to invoke when @name is known\nto exist or %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name_vanished_closure"
--           , argType = TGClosure Nothing
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "#GClosure to invoke when @name is known\nto not exist or %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_bus_watch_name_with_closures" g_bus_watch_name_with_closures :: 
    CInt ->                                 -- bus_type : TInterface (Name {namespace = "Gio", name = "BusType"})
    CString ->                              -- name : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "BusNameWatcherFlags"})
    Ptr (GClosure ()) ->                    -- name_appeared_closure : TGClosure Nothing
    Ptr (GClosure ()) ->                    -- name_vanished_closure : TGClosure Nothing
    IO Word32

-- | Version of @/g_bus_watch_name()/@ using closures instead of callbacks for
-- easier binding in other languages.
-- 
-- /Since: 2.26/
busWatchName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.Enums.BusType
    -- ^ /@busType@/: The type of bus to watch a name on.
    -> T.Text
    -- ^ /@name@/: The name (well-known or unique) to watch.
    -> [Gio.Flags.BusNameWatcherFlags]
    -- ^ /@flags@/: Flags from the t'GI.Gio.Flags.BusNameWatcherFlags' enumeration.
    -> Maybe (GClosure a)
    -- ^ /@nameAppearedClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is known
    -- to exist or 'P.Nothing'.
    -> Maybe (GClosure b)
    -- ^ /@nameVanishedClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is known
    -- to not exist or 'P.Nothing'.
    -> m Word32
    -- ^ __Returns:__ An identifier (never 0) that can be used with
    -- 'GI.Gio.Functions.busUnwatchName' to stop watching the name.
busWatchName :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m) =>
BusType
-> Text
-> [BusNameWatcherFlags]
-> Maybe (GClosure a)
-> Maybe (GClosure b)
-> m Word32
busWatchName BusType
busType Text
name [BusNameWatcherFlags]
flags Maybe (GClosure a)
nameAppearedClosure Maybe (GClosure b)
nameVanishedClosure = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    let busType' :: CInt
busType' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (BusType -> Int) -> BusType -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BusType -> Int
forall a. Enum a => a -> Int
fromEnum) BusType
busType
    CString
name' <- Text -> IO CString
textToCString Text
name
    let flags' :: CUInt
flags' = [BusNameWatcherFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [BusNameWatcherFlags]
flags
    Ptr (GClosure ())
maybeNameAppearedClosure <- case Maybe (GClosure a)
nameAppearedClosure of
        Maybe (GClosure a)
Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
forall a. Ptr a
nullPtr
        Just GClosure a
jNameAppearedClosure -> do
            Ptr (GClosure ())
jNameAppearedClosure' <- GClosure a -> IO (Ptr (GClosure ()))
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr GClosure a
jNameAppearedClosure
            Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
jNameAppearedClosure'
    Ptr (GClosure ())
maybeNameVanishedClosure <- case Maybe (GClosure b)
nameVanishedClosure of
        Maybe (GClosure b)
Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
forall a. Ptr a
nullPtr
        Just GClosure b
jNameVanishedClosure -> do
            Ptr (GClosure ())
jNameVanishedClosure' <- GClosure b -> IO (Ptr (GClosure ()))
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr GClosure b
jNameVanishedClosure
            Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
jNameVanishedClosure'
    Word32
result <- CInt
-> CString
-> CUInt
-> Ptr (GClosure ())
-> Ptr (GClosure ())
-> IO Word32
g_bus_watch_name_with_closures CInt
busType' CString
name' CUInt
flags' Ptr (GClosure ())
maybeNameAppearedClosure Ptr (GClosure ())
maybeNameVanishedClosure
    Maybe (GClosure a) -> (GClosure a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe (GClosure a)
nameAppearedClosure GClosure a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Maybe (GClosure b) -> (GClosure b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe (GClosure b)
nameVanishedClosure GClosure b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function bus_unwatch_name
-- Args: [ Arg
--           { argCName = "watcher_id"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "An identifier obtained from g_bus_watch_name()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bus_unwatch_name" g_bus_unwatch_name :: 
    Word32 ->                               -- watcher_id : TBasicType TUInt
    IO ()

-- | Stops watching a name.
-- 
-- Note that there may still be D-Bus traffic to process (relating to watching
-- and unwatching the name) in the current thread-default t'GI.GLib.Structs.MainContext.MainContext' after
-- this function has returned. You should continue to iterate the t'GI.GLib.Structs.MainContext.MainContext'
-- until the t'GI.GLib.Callbacks.DestroyNotify' function passed to @/g_bus_watch_name()/@ is called, in
-- order to avoid memory leaks through callbacks queued on the t'GI.GLib.Structs.MainContext.MainContext'
-- after it’s stopped being iterated.
-- 
-- /Since: 2.26/
busUnwatchName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@watcherId@/: An identifier obtained from @/g_bus_watch_name()/@
    -> m ()
busUnwatchName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word32 -> m ()
busUnwatchName Word32
watcherId = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Word32 -> IO ()
g_bus_unwatch_name Word32
watcherId
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function bus_unown_name
-- Args: [ Arg
--           { argCName = "owner_id"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an identifier obtained from g_bus_own_name()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bus_unown_name" g_bus_unown_name :: 
    Word32 ->                               -- owner_id : TBasicType TUInt
    IO ()

-- | Stops owning a name.
-- 
-- Note that there may still be D-Bus traffic to process (relating to owning
-- and unowning the name) in the current thread-default t'GI.GLib.Structs.MainContext.MainContext' after
-- this function has returned. You should continue to iterate the t'GI.GLib.Structs.MainContext.MainContext'
-- until the t'GI.GLib.Callbacks.DestroyNotify' function passed to @/g_bus_own_name()/@ is called, in
-- order to avoid memory leaks through callbacks queued on the t'GI.GLib.Structs.MainContext.MainContext'
-- after it’s stopped being iterated.
-- 
-- /Since: 2.26/
busUnownName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@ownerId@/: an identifier obtained from @/g_bus_own_name()/@
    -> m ()
busUnownName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word32 -> m ()
busUnownName Word32
ownerId = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Word32 -> IO ()
g_bus_unown_name Word32
ownerId
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function bus_own_name_on_connection
-- Args: [ Arg
--           { argCName = "connection"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "DBusConnection" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GDBusConnection" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the well-known name to own"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "BusNameOwnerFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a set of flags from the #GBusNameOwnerFlags enumeration"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name_acquired_closure"
--           , argType = TGClosure Nothing
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "#GClosure to invoke when @name is\n    acquired or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name_lost_closure"
--           , argType = TGClosure Nothing
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "#GClosure to invoke when @name is lost\n    or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_bus_own_name_on_connection_with_closures" g_bus_own_name_on_connection_with_closures :: 
    Ptr Gio.DBusConnection.DBusConnection -> -- connection : TInterface (Name {namespace = "Gio", name = "DBusConnection"})
    CString ->                              -- name : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "BusNameOwnerFlags"})
    Ptr (GClosure ()) ->                    -- name_acquired_closure : TGClosure Nothing
    Ptr (GClosure ()) ->                    -- name_lost_closure : TGClosure Nothing
    IO Word32

-- | Version of @/g_bus_own_name_on_connection()/@ using closures instead of
-- callbacks for easier binding in other languages.
-- 
-- /Since: 2.26/
busOwnNameOnConnection ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
    a
    -- ^ /@connection@/: a t'GI.Gio.Objects.DBusConnection.DBusConnection'
    -> T.Text
    -- ^ /@name@/: the well-known name to own
    -> [Gio.Flags.BusNameOwnerFlags]
    -- ^ /@flags@/: a set of flags from the t'GI.Gio.Flags.BusNameOwnerFlags' enumeration
    -> Maybe (GClosure b)
    -- ^ /@nameAcquiredClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is
    --     acquired or 'P.Nothing'
    -> Maybe (GClosure c)
    -- ^ /@nameLostClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is lost
    --     or 'P.Nothing'
    -> m Word32
    -- ^ __Returns:__ an identifier (never 0) that can be used with
    --     'GI.Gio.Functions.busUnownName' to stop owning the name.
busOwnNameOnConnection :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsDBusConnection a) =>
a
-> Text
-> [BusNameOwnerFlags]
-> Maybe (GClosure b)
-> Maybe (GClosure c)
-> m Word32
busOwnNameOnConnection a
connection Text
name [BusNameOwnerFlags]
flags Maybe (GClosure b)
nameAcquiredClosure Maybe (GClosure c)
nameLostClosure = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    Ptr DBusConnection
connection' <- a -> IO (Ptr DBusConnection)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
connection
    CString
name' <- Text -> IO CString
textToCString Text
name
    let flags' :: CUInt
flags' = [BusNameOwnerFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [BusNameOwnerFlags]
flags
    Ptr (GClosure ())
maybeNameAcquiredClosure <- case Maybe (GClosure b)
nameAcquiredClosure of
        Maybe (GClosure b)
Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
forall a. Ptr a
nullPtr
        Just GClosure b
jNameAcquiredClosure -> do
            Ptr (GClosure ())
jNameAcquiredClosure' <- GClosure b -> IO (Ptr (GClosure ()))
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr GClosure b
jNameAcquiredClosure
            Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
jNameAcquiredClosure'
    Ptr (GClosure ())
maybeNameLostClosure <- case Maybe (GClosure c)
nameLostClosure of
        Maybe (GClosure c)
Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
forall a. Ptr a
nullPtr
        Just GClosure c
jNameLostClosure -> do
            Ptr (GClosure ())
jNameLostClosure' <- GClosure c -> IO (Ptr (GClosure ()))
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr GClosure c
jNameLostClosure
            Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
jNameLostClosure'
    Word32
result <- Ptr DBusConnection
-> CString
-> CUInt
-> Ptr (GClosure ())
-> Ptr (GClosure ())
-> IO Word32
g_bus_own_name_on_connection_with_closures Ptr DBusConnection
connection' CString
name' CUInt
flags' Ptr (GClosure ())
maybeNameAcquiredClosure Ptr (GClosure ())
maybeNameLostClosure
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
connection
    Maybe (GClosure b) -> (GClosure b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe (GClosure b)
nameAcquiredClosure GClosure b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Maybe (GClosure c) -> (GClosure c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe (GClosure c)
nameLostClosure GClosure c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function bus_own_name
-- Args: [ Arg
--           { argCName = "bus_type"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "BusType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the type of bus to own a name on"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the well-known name to own"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "BusNameOwnerFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a set of flags from the #GBusNameOwnerFlags enumeration"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "bus_acquired_closure"
--           , argType = TGClosure Nothing
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "#GClosure to invoke when connected to\n    the bus of type @bus_type or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name_acquired_closure"
--           , argType = TGClosure Nothing
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "#GClosure to invoke when @name is\n    acquired or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "name_lost_closure"
--           , argType = TGClosure Nothing
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "#GClosure to invoke when @name is lost or\n    %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_bus_own_name_with_closures" g_bus_own_name_with_closures :: 
    CInt ->                                 -- bus_type : TInterface (Name {namespace = "Gio", name = "BusType"})
    CString ->                              -- name : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "BusNameOwnerFlags"})
    Ptr (GClosure ()) ->                    -- bus_acquired_closure : TGClosure Nothing
    Ptr (GClosure ()) ->                    -- name_acquired_closure : TGClosure Nothing
    Ptr (GClosure ()) ->                    -- name_lost_closure : TGClosure Nothing
    IO Word32

-- | Version of @/g_bus_own_name()/@ using closures instead of callbacks for
-- easier binding in other languages.
-- 
-- /Since: 2.26/
busOwnName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gio.Enums.BusType
    -- ^ /@busType@/: the type of bus to own a name on
    -> T.Text
    -- ^ /@name@/: the well-known name to own
    -> [Gio.Flags.BusNameOwnerFlags]
    -- ^ /@flags@/: a set of flags from the t'GI.Gio.Flags.BusNameOwnerFlags' enumeration
    -> Maybe (GClosure a)
    -- ^ /@busAcquiredClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when connected to
    --     the bus of type /@busType@/ or 'P.Nothing'
    -> Maybe (GClosure b)
    -- ^ /@nameAcquiredClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is
    --     acquired or 'P.Nothing'
    -> Maybe (GClosure c)
    -- ^ /@nameLostClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is lost or
    --     'P.Nothing'
    -> m Word32
    -- ^ __Returns:__ an identifier (never 0) that can be used with
    --     'GI.Gio.Functions.busUnownName' to stop owning the name.
busOwnName :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m) =>
BusType
-> Text
-> [BusNameOwnerFlags]
-> Maybe (GClosure a)
-> Maybe (GClosure b)
-> Maybe (GClosure c)
-> m Word32
busOwnName BusType
busType Text
name [BusNameOwnerFlags]
flags Maybe (GClosure a)
busAcquiredClosure Maybe (GClosure b)
nameAcquiredClosure Maybe (GClosure c)
nameLostClosure = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    let busType' :: CInt
busType' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (BusType -> Int) -> BusType -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BusType -> Int
forall a. Enum a => a -> Int
fromEnum) BusType
busType
    CString
name' <- Text -> IO CString
textToCString Text
name
    let flags' :: CUInt
flags' = [BusNameOwnerFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [BusNameOwnerFlags]
flags
    Ptr (GClosure ())
maybeBusAcquiredClosure <- case Maybe (GClosure a)
busAcquiredClosure of
        Maybe (GClosure a)
Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
forall a. Ptr a
nullPtr
        Just GClosure a
jBusAcquiredClosure -> do
            Ptr (GClosure ())
jBusAcquiredClosure' <- GClosure a -> IO (Ptr (GClosure ()))
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr GClosure a
jBusAcquiredClosure
            Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
jBusAcquiredClosure'
    Ptr (GClosure ())
maybeNameAcquiredClosure <- case Maybe (GClosure b)
nameAcquiredClosure of
        Maybe (GClosure b)
Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
forall a. Ptr a
nullPtr
        Just GClosure b
jNameAcquiredClosure -> do
            Ptr (GClosure ())
jNameAcquiredClosure' <- GClosure b -> IO (Ptr (GClosure ()))
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr GClosure b
jNameAcquiredClosure
            Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
jNameAcquiredClosure'
    Ptr (GClosure ())
maybeNameLostClosure <- case Maybe (GClosure c)
nameLostClosure of
        Maybe (GClosure c)
Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
forall a. Ptr a
nullPtr
        Just GClosure c
jNameLostClosure -> do
            Ptr (GClosure ())
jNameLostClosure' <- GClosure c -> IO (Ptr (GClosure ()))
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr GClosure c
jNameLostClosure
            Ptr (GClosure ()) -> IO (Ptr (GClosure ()))
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (GClosure ())
jNameLostClosure'
    Word32
result <- CInt
-> CString
-> CUInt
-> Ptr (GClosure ())
-> Ptr (GClosure ())
-> Ptr (GClosure ())
-> IO Word32
g_bus_own_name_with_closures CInt
busType' CString
name' CUInt
flags' Ptr (GClosure ())
maybeBusAcquiredClosure Ptr (GClosure ())
maybeNameAcquiredClosure Ptr (GClosure ())
maybeNameLostClosure
    Maybe (GClosure a) -> (GClosure a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe (GClosure a)
busAcquiredClosure GClosure a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Maybe (GClosure b) -> (GClosure b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe (GClosure b)
nameAcquiredClosure GClosure b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Maybe (GClosure c) -> (GClosure c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe (GClosure c)
nameLostClosure GClosure c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
name'
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function bus_get_sync
-- Args: [ Arg
--           { argCName = "bus_type"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "BusType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GBusType" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "DBusConnection" })
-- throws : True
-- Skip return : False

foreign import ccall "g_bus_get_sync" g_bus_get_sync :: 
    CInt ->                                 -- bus_type : TInterface (Name {namespace = "Gio", name = "BusType"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Gio.DBusConnection.DBusConnection)

-- | Synchronously connects to the message bus specified by /@busType@/.
-- Note that the returned object may shared with other callers,
-- e.g. if two separate parts of a process calls this function with
-- the same /@busType@/, they will share the same object.
-- 
-- This is a synchronous failable function. See 'GI.Gio.Functions.busGet' and
-- 'GI.Gio.Functions.busGetFinish' for the asynchronous version.
-- 
-- The returned object is a singleton, that is, shared with other
-- callers of 'GI.Gio.Functions.busGet' and 'GI.Gio.Functions.busGetSync' for /@busType@/. In the
-- event that you need a private message bus connection, use
-- 'GI.Gio.Functions.dbusAddressGetForBusSync' and
-- 'GI.Gio.Objects.DBusConnection.dBusConnectionNewForAddress'.
-- 
-- Note that the returned t'GI.Gio.Objects.DBusConnection.DBusConnection' object will (usually) have
-- the [DBusConnection:exitOnClose]("GI.Gio.Objects.DBusConnection#g:attr:exitOnClose") property set to 'P.True'.
-- 
-- /Since: 2.26/
busGetSync ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
    Gio.Enums.BusType
    -- ^ /@busType@/: a t'GI.Gio.Enums.BusType'
    -> Maybe (a)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing'
    -> m Gio.DBusConnection.DBusConnection
    -- ^ __Returns:__ a t'GI.Gio.Objects.DBusConnection.DBusConnection' or 'P.Nothing' if /@error@/ is set.
    --     Free with 'GI.GObject.Objects.Object.objectUnref'. /(Can throw 'Data.GI.Base.GError.GError')/
busGetSync :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
BusType -> Maybe a -> m DBusConnection
busGetSync BusType
busType Maybe a
cancellable = IO DBusConnection -> m DBusConnection
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusConnection -> m DBusConnection)
-> IO DBusConnection -> m DBusConnection
forall a b. (a -> b) -> a -> b
$ do
    let busType' :: CInt
busType' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (BusType -> Int) -> BusType -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BusType -> Int
forall a. Enum a => a -> Int
fromEnum) BusType
busType
    Ptr Cancellable
maybeCancellable <- case Maybe a
cancellable of
        Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just a
jCancellable -> do
            Ptr Cancellable
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO DBusConnection -> IO () -> IO DBusConnection
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr DBusConnection
result <- (Ptr (Ptr GError) -> IO (Ptr DBusConnection))
-> IO (Ptr DBusConnection)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr DBusConnection))
 -> IO (Ptr DBusConnection))
-> (Ptr (Ptr GError) -> IO (Ptr DBusConnection))
-> IO (Ptr DBusConnection)
forall a b. (a -> b) -> a -> b
$ CInt
-> Ptr Cancellable -> Ptr (Ptr GError) -> IO (Ptr DBusConnection)
g_bus_get_sync CInt
busType' Ptr Cancellable
maybeCancellable
        Text -> Ptr DBusConnection -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"busGetSync" Ptr DBusConnection
result
        DBusConnection
result' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
result
        Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
cancellable a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        DBusConnection -> IO DBusConnection
forall (m :: * -> *) a. Monad m => a -> m a
return DBusConnection
result'
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )


-- function bus_get_finish
-- Args: [ Arg
--           { argCName = "res"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a #GAsyncResult obtained from the #GAsyncReadyCallback passed\n    to g_bus_get()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "DBusConnection" })
-- throws : True
-- Skip return : False

foreign import ccall "g_bus_get_finish" g_bus_get_finish :: 
    Ptr Gio.AsyncResult.AsyncResult ->      -- res : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Gio.DBusConnection.DBusConnection)

-- | Finishes an operation started with 'GI.Gio.Functions.busGet'.
-- 
-- The returned object is a singleton, that is, shared with other
-- callers of 'GI.Gio.Functions.busGet' and 'GI.Gio.Functions.busGetSync' for /@busType@/. In the
-- event that you need a private message bus connection, use
-- 'GI.Gio.Functions.dbusAddressGetForBusSync' and
-- 'GI.Gio.Objects.DBusConnection.dBusConnectionNewForAddress'.
-- 
-- Note that the returned t'GI.Gio.Objects.DBusConnection.DBusConnection' object will (usually) have
-- the [DBusConnection:exitOnClose]("GI.Gio.Objects.DBusConnection#g:attr:exitOnClose") property set to 'P.True'.
-- 
-- /Since: 2.26/
busGetFinish ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
    a
    -- ^ /@res@/: a t'GI.Gio.Interfaces.AsyncResult.AsyncResult' obtained from the t'GI.Gio.Callbacks.AsyncReadyCallback' passed
    --     to 'GI.Gio.Functions.busGet'
    -> m Gio.DBusConnection.DBusConnection
    -- ^ __Returns:__ a t'GI.Gio.Objects.DBusConnection.DBusConnection' or 'P.Nothing' if /@error@/ is set.
    --     Free with 'GI.GObject.Objects.Object.objectUnref'. /(Can throw 'Data.GI.Base.GError.GError')/
busGetFinish :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAsyncResult a) =>
a -> m DBusConnection
busGetFinish a
res = IO DBusConnection -> m DBusConnection
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DBusConnection -> m DBusConnection)
-> IO DBusConnection -> m DBusConnection
forall a b. (a -> b) -> a -> b
$ do
    Ptr AsyncResult
res' <- a -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
res
    IO DBusConnection -> IO () -> IO DBusConnection
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr DBusConnection
result <- (Ptr (Ptr GError) -> IO (Ptr DBusConnection))
-> IO (Ptr DBusConnection)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr DBusConnection))
 -> IO (Ptr DBusConnection))
-> (Ptr (Ptr GError) -> IO (Ptr DBusConnection))
-> IO (Ptr DBusConnection)
forall a b. (a -> b) -> a -> b
$ Ptr AsyncResult -> Ptr (Ptr GError) -> IO (Ptr DBusConnection)
g_bus_get_finish Ptr AsyncResult
res'
        Text -> Ptr DBusConnection -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"busGetFinish" Ptr DBusConnection
result
        DBusConnection
result' <- ((ManagedPtr DBusConnection -> DBusConnection)
-> Ptr DBusConnection -> IO DBusConnection
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr DBusConnection -> DBusConnection
Gio.DBusConnection.DBusConnection) Ptr DBusConnection
result
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
res
        DBusConnection -> IO DBusConnection
forall (m :: * -> *) a. Monad m => a -> m a
return DBusConnection
result'
     ) (do
        () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )


-- function bus_get
-- Args: [ Arg
--           { argCName = "bus_type"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "BusType" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GBusType" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a #GAsyncReadyCallback to call when the request is satisfied"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the data to pass to @callback"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_bus_get" g_bus_get :: 
    CInt ->                                 -- bus_type : TInterface (Name {namespace = "Gio", name = "BusType"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Asynchronously connects to the message bus specified by /@busType@/.
-- 
-- When the operation is finished, /@callback@/ will be invoked. You can
-- then call 'GI.Gio.Functions.busGetFinish' to get the result of the operation.
-- 
-- This is an asynchronous failable function. See 'GI.Gio.Functions.busGetSync' for
-- the synchronous version.
-- 
-- /Since: 2.26/
busGet ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
    Gio.Enums.BusType
    -- ^ /@busType@/: a t'GI.Gio.Enums.BusType'
    -> Maybe (a)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing'
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: a t'GI.Gio.Callbacks.AsyncReadyCallback' to call when the request is satisfied
    -> m ()
busGet :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsCancellable a) =>
BusType -> Maybe a -> Maybe AsyncReadyCallback -> m ()
busGet BusType
busType Maybe a
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let busType' :: CInt
busType' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (BusType -> Int) -> BusType -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BusType -> Int
forall a. Enum a => a -> Int
fromEnum) BusType
busType
    Ptr Cancellable
maybeCancellable <- case Maybe a
cancellable of
        Maybe a
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just a
jCancellable -> do
            Ptr Cancellable
jCancellable' <- a -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    CInt
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> C_DestroyNotify
g_bus_get CInt
busType' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
    Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
cancellable a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()