#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Functions
(
busGet ,
busGetFinish ,
busGetSync ,
busOwnName ,
busOwnNameOnConnection ,
busUnownName ,
busUnwatchName ,
busWatchName ,
busWatchNameOnConnection ,
contentTypeCanBeExecutable ,
contentTypeEquals ,
contentTypeFromMimeType ,
contentTypeGetDescription ,
contentTypeGetGenericIconName ,
contentTypeGetIcon ,
contentTypeGetMimeDirs ,
contentTypeGetMimeType ,
contentTypeGetSymbolicIcon ,
contentTypeGuess ,
contentTypeGuessForTree ,
contentTypeIsA ,
contentTypeIsMimeType ,
contentTypeIsUnknown ,
contentTypeSetMimeDirs ,
contentTypesGetRegistered ,
dbusAddressEscapeValue ,
dbusAddressGetForBusSync ,
dbusAddressGetStream ,
dbusAddressGetStreamFinish ,
dbusAddressGetStreamSync ,
dbusGenerateGuid ,
dbusGvalueToGvariant ,
dbusGvariantToGvalue ,
dbusIsAddress ,
dbusIsGuid ,
dbusIsInterfaceName ,
dbusIsMemberName ,
dbusIsName ,
dbusIsSupportedAddress ,
dbusIsUniqueName ,
ioErrorFromErrno ,
ioErrorQuark ,
ioModulesScanAllInDirectory ,
ioModulesScanAllInDirectoryWithScope ,
ioSchedulerCancelAllJobs ,
ioSchedulerPushJob ,
keyfileSettingsBackendNew ,
memorySettingsBackendNew ,
networkingInit ,
nullSettingsBackendNew ,
pollableSourceNew ,
pollableSourceNewFull ,
pollableStreamRead ,
pollableStreamWrite ,
pollableStreamWriteAll ,
resourcesEnumerateChildren ,
resourcesGetInfo ,
resourcesLookupData ,
resourcesOpenStream ,
resourcesRegister ,
resourcesUnregister ,
simpleAsyncReportGerrorInIdle ,
unixIsMountPathSystemInternal ,
unixIsSystemDevicePath ,
unixIsSystemFsType ,
unixMountAt ,
unixMountCompare ,
unixMountCopy ,
unixMountFor ,
unixMountFree ,
unixMountGetDevicePath ,
unixMountGetFsType ,
unixMountGetMountPath ,
unixMountGetOptions ,
unixMountGetRootPath ,
unixMountGuessCanEject ,
unixMountGuessIcon ,
unixMountGuessName ,
unixMountGuessShouldDisplay ,
unixMountGuessSymbolicIcon ,
unixMountIsReadonly ,
unixMountIsSystemInternal ,
unixMountPointsChangedSince ,
unixMountPointsGet ,
unixMountsChangedSince ,
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.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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.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
foreign import ccall "g_unix_mounts_get" g_unix_mounts_get ::
Ptr Word64 ->
IO (Ptr (GList (Ptr Gio.UnixMountEntry.UnixMountEntry)))
unixMountsGet ::
(B.CallStack.HasCallStack, MonadIO m) =>
m (([Gio.UnixMountEntry.UnixMountEntry], Word64))
unixMountsGet :: 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')
foreign import ccall "g_unix_mounts_changed_since" g_unix_mounts_changed_since ::
Word64 ->
IO CInt
unixMountsChangedSince ::
(B.CallStack.HasCallStack, MonadIO m) =>
Word64
-> m Bool
unixMountsChangedSince :: 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'
foreign import ccall "g_unix_mount_points_get" g_unix_mount_points_get ::
Ptr Word64 ->
IO (Ptr (GList (Ptr Gio.UnixMountPoint.UnixMountPoint)))
unixMountPointsGet ::
(B.CallStack.HasCallStack, MonadIO m) =>
m (([Gio.UnixMountPoint.UnixMountPoint], Word64))
unixMountPointsGet :: 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')
foreign import ccall "g_unix_mount_points_changed_since" g_unix_mount_points_changed_since ::
Word64 ->
IO CInt
unixMountPointsChangedSince ::
(B.CallStack.HasCallStack, MonadIO m) =>
Word64
-> m Bool
unixMountPointsChangedSince :: 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'
foreign import ccall "g_unix_mount_is_system_internal" g_unix_mount_is_system_internal ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO CInt
unixMountIsSystemInternal ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> m Bool
unixMountIsSystemInternal :: 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'
foreign import ccall "g_unix_mount_is_readonly" g_unix_mount_is_readonly ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO CInt
unixMountIsReadonly ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> m Bool
unixMountIsReadonly :: 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'
foreign import ccall "g_unix_mount_guess_symbolic_icon" g_unix_mount_guess_symbolic_icon ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO (Ptr Gio.Icon.Icon)
unixMountGuessSymbolicIcon ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> m Gio.Icon.Icon
unixMountGuessSymbolicIcon :: 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'
foreign import ccall "g_unix_mount_guess_should_display" g_unix_mount_guess_should_display ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO CInt
unixMountGuessShouldDisplay ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> m Bool
unixMountGuessShouldDisplay :: 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'
foreign import ccall "g_unix_mount_guess_name" g_unix_mount_guess_name ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO CString
unixMountGuessName ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> m T.Text
unixMountGuessName :: 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'
foreign import ccall "g_unix_mount_guess_icon" g_unix_mount_guess_icon ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO (Ptr Gio.Icon.Icon)
unixMountGuessIcon ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> m Gio.Icon.Icon
unixMountGuessIcon :: 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'
foreign import ccall "g_unix_mount_guess_can_eject" g_unix_mount_guess_can_eject ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO CInt
unixMountGuessCanEject ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> m Bool
unixMountGuessCanEject :: 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'
foreign import ccall "g_unix_mount_get_root_path" g_unix_mount_get_root_path ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO CString
unixMountGetRootPath ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> m (Maybe T.Text)
unixMountGetRootPath :: 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
foreign import ccall "g_unix_mount_get_options" g_unix_mount_get_options ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO CString
unixMountGetOptions ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> m (Maybe T.Text)
unixMountGetOptions :: 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
foreign import ccall "g_unix_mount_get_mount_path" g_unix_mount_get_mount_path ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO CString
unixMountGetMountPath ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> m [Char]
unixMountGetMountPath :: 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'
foreign import ccall "g_unix_mount_get_fs_type" g_unix_mount_get_fs_type ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO CString
unixMountGetFsType ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> m T.Text
unixMountGetFsType :: 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'
foreign import ccall "g_unix_mount_get_device_path" g_unix_mount_get_device_path ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO CString
unixMountGetDevicePath ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> m [Char]
unixMountGetDevicePath :: 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'
foreign import ccall "g_unix_mount_free" g_unix_mount_free ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO ()
unixMountFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> m ()
unixMountFree :: 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 ()
foreign import ccall "g_unix_mount_for" g_unix_mount_for ::
CString ->
Ptr Word64 ->
IO (Ptr Gio.UnixMountEntry.UnixMountEntry)
unixMountFor ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Char]
-> m ((Gio.UnixMountEntry.UnixMountEntry, Word64))
unixMountFor :: [Char] -> m (UnixMountEntry, Word64)
unixMountFor [Char]
filePath = 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
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
Text -> Ptr UnixMountEntry -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"unixMountFor" 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
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
(UnixMountEntry, Word64) -> IO (UnixMountEntry, Word64)
forall (m :: * -> *) a. Monad m => a -> m a
return (UnixMountEntry
result', Word64
timeRead')
foreign import ccall "g_unix_mount_copy" g_unix_mount_copy ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO (Ptr Gio.UnixMountEntry.UnixMountEntry)
unixMountCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> m Gio.UnixMountEntry.UnixMountEntry
unixMountCopy :: 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'
foreign import ccall "g_unix_mount_compare" g_unix_mount_compare ::
Ptr Gio.UnixMountEntry.UnixMountEntry ->
Ptr Gio.UnixMountEntry.UnixMountEntry ->
IO Int32
unixMountCompare ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.UnixMountEntry.UnixMountEntry
-> Gio.UnixMountEntry.UnixMountEntry
-> m Int32
unixMountCompare :: 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
foreign import ccall "g_unix_mount_at" g_unix_mount_at ::
CString ->
Ptr Word64 ->
IO (Ptr Gio.UnixMountEntry.UnixMountEntry)
unixMountAt ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Char]
-> m ((Gio.UnixMountEntry.UnixMountEntry, Word64))
unixMountAt :: [Char] -> m (UnixMountEntry, Word64)
unixMountAt [Char]
mountPath = 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
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
Text -> Ptr UnixMountEntry -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"unixMountAt" 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
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
(UnixMountEntry, Word64) -> IO (UnixMountEntry, Word64)
forall (m :: * -> *) a. Monad m => a -> m a
return (UnixMountEntry
result', Word64
timeRead')
foreign import ccall "g_unix_is_system_fs_type" g_unix_is_system_fs_type ::
CString ->
IO CInt
unixIsSystemFsType ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Bool
unixIsSystemFsType :: 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'
foreign import ccall "g_unix_is_system_device_path" g_unix_is_system_device_path ::
CString ->
IO CInt
unixIsSystemDevicePath ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Bool
unixIsSystemDevicePath :: 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'
foreign import ccall "g_unix_is_mount_path_system_internal" g_unix_is_mount_path_system_internal ::
CString ->
IO CInt
unixIsMountPathSystemInternal ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Char]
-> m Bool
unixIsMountPathSystemInternal :: [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'
foreign import ccall "g_simple_async_report_gerror_in_idle" g_simple_async_report_gerror_in_idle ::
Ptr GObject.Object.Object ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
Ptr GError ->
IO ()
{-# DEPRECATED simpleAsyncReportGerrorInIdle ["(Since version 2.46)","Use 'GI.Gio.Objects.Task.taskReportError'."] #-}
simpleAsyncReportGerrorInIdle ::
(B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a) =>
Maybe (a)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> GError
-> m ()
simpleAsyncReportGerrorInIdle :: 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 ()
foreign import ccall "g_resources_unregister" g_resources_unregister ::
Ptr Gio.Resource.Resource ->
IO ()
resourcesUnregister ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.Resource.Resource
-> m ()
resourcesUnregister :: 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 ()
foreign import ccall "g_resources_register" g_resources_register ::
Ptr Gio.Resource.Resource ->
IO ()
resourcesRegister ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.Resource.Resource
-> m ()
resourcesRegister :: 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 ()
foreign import ccall "g_resources_open_stream" g_resources_open_stream ::
CString ->
CUInt ->
Ptr (Ptr GError) ->
IO (Ptr Gio.InputStream.InputStream)
resourcesOpenStream ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> [Gio.Flags.ResourceLookupFlags]
-> m Gio.InputStream.InputStream
resourcesOpenStream :: 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'
)
foreign import ccall "g_resources_lookup_data" g_resources_lookup_data ::
CString ->
CUInt ->
Ptr (Ptr GError) ->
IO (Ptr GLib.Bytes.Bytes)
resourcesLookupData ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> [Gio.Flags.ResourceLookupFlags]
-> m GLib.Bytes.Bytes
resourcesLookupData :: 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'
)
foreign import ccall "g_resources_get_info" g_resources_get_info ::
CString ->
CUInt ->
Ptr Word64 ->
Ptr Word32 ->
Ptr (Ptr GError) ->
IO CInt
resourcesGetInfo ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> [Gio.Flags.ResourceLookupFlags]
-> m ((Word64, Word32))
resourcesGetInfo :: 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
)
foreign import ccall "g_resources_enumerate_children" g_resources_enumerate_children ::
CString ->
CUInt ->
Ptr (Ptr GError) ->
IO (Ptr CString)
resourcesEnumerateChildren ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> [Gio.Flags.ResourceLookupFlags]
-> m [T.Text]
resourcesEnumerateChildren :: 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'
)
foreign import ccall "g_pollable_stream_write_all" g_pollable_stream_write_all ::
Ptr Gio.OutputStream.OutputStream ->
Ptr Word8 ->
Word64 ->
CInt ->
Ptr Word64 ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CInt
pollableStreamWriteAll ::
(B.CallStack.HasCallStack, MonadIO m, Gio.OutputStream.IsOutputStream a, Gio.Cancellable.IsCancellable b) =>
a
-> ByteString
-> Bool
-> Maybe (b)
-> m (Word64)
pollableStreamWriteAll :: 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
)
foreign import ccall "g_pollable_stream_write" g_pollable_stream_write ::
Ptr Gio.OutputStream.OutputStream ->
Ptr Word8 ->
Word64 ->
CInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO Int64
pollableStreamWrite ::
(B.CallStack.HasCallStack, MonadIO m, Gio.OutputStream.IsOutputStream a, Gio.Cancellable.IsCancellable b) =>
a
-> ByteString
-> Bool
-> Maybe (b)
-> m Int64
pollableStreamWrite :: 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'
)
foreign import ccall "g_pollable_stream_read" g_pollable_stream_read ::
Ptr Gio.InputStream.InputStream ->
Ptr Word8 ->
Word64 ->
CInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO Int64
pollableStreamRead ::
(B.CallStack.HasCallStack, MonadIO m, Gio.InputStream.IsInputStream a, Gio.Cancellable.IsCancellable b) =>
a
-> ByteString
-> Bool
-> Maybe (b)
-> m Int64
pollableStreamRead :: 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'
)
foreign import ccall "g_pollable_source_new_full" g_pollable_source_new_full ::
Ptr GObject.Object.Object ->
Ptr GLib.Source.Source ->
Ptr Gio.Cancellable.Cancellable ->
IO (Ptr GLib.Source.Source)
pollableSourceNewFull ::
(B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a, Gio.Cancellable.IsCancellable b) =>
a
-> Maybe (GLib.Source.Source)
-> Maybe (b)
-> m GLib.Source.Source
pollableSourceNewFull :: 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'
foreign import ccall "g_pollable_source_new" g_pollable_source_new ::
Ptr GObject.Object.Object ->
IO (Ptr GLib.Source.Source)
pollableSourceNew ::
(B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a) =>
a
-> m GLib.Source.Source
pollableSourceNew :: 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'
foreign import ccall "g_null_settings_backend_new" g_null_settings_backend_new ::
IO (Ptr Gio.SettingsBackend.SettingsBackend)
nullSettingsBackendNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Gio.SettingsBackend.SettingsBackend
nullSettingsBackendNew :: 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'
foreign import ccall "g_networking_init" g_networking_init ::
IO ()
networkingInit ::
(B.CallStack.HasCallStack, MonadIO m) =>
m ()
networkingInit :: 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 ()
foreign import ccall "g_memory_settings_backend_new" g_memory_settings_backend_new ::
IO (Ptr Gio.SettingsBackend.SettingsBackend)
memorySettingsBackendNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Gio.SettingsBackend.SettingsBackend
memorySettingsBackendNew :: 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'
foreign import ccall "g_keyfile_settings_backend_new" g_keyfile_settings_backend_new ::
CString ->
CString ->
CString ->
IO (Ptr Gio.SettingsBackend.SettingsBackend)
keyfileSettingsBackendNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> T.Text
-> Maybe (T.Text)
-> m Gio.SettingsBackend.SettingsBackend
keyfileSettingsBackendNew :: 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'
foreign import ccall "g_io_scheduler_push_job" g_io_scheduler_push_job ::
FunPtr Gio.Callbacks.C_IOSchedulerJobFunc ->
Ptr () ->
FunPtr GLib.Callbacks.C_DestroyNotify ->
Int32 ->
Ptr Gio.Cancellable.Cancellable ->
IO ()
{-# DEPRECATED ioSchedulerPushJob ["use t'GI.GLib.Structs.ThreadPool.ThreadPool' or 'GI.Gio.Objects.Task.taskRunInThread'"] #-}
ioSchedulerPushJob ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Gio.Callbacks.IOSchedulerJobFunc
-> Int32
-> Maybe (a)
-> m ()
ioSchedulerPushJob :: 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 ())
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 ()
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."] #-}
ioSchedulerCancelAllJobs ::
(B.CallStack.HasCallStack, MonadIO m) =>
m ()
ioSchedulerCancelAllJobs :: 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 ()
foreign import ccall "g_io_modules_scan_all_in_directory_with_scope" g_io_modules_scan_all_in_directory_with_scope ::
CString ->
Ptr Gio.IOModuleScope.IOModuleScope ->
IO ()
ioModulesScanAllInDirectoryWithScope ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Char]
-> Gio.IOModuleScope.IOModuleScope
-> m ()
ioModulesScanAllInDirectoryWithScope :: [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 ()
foreign import ccall "g_io_modules_scan_all_in_directory" g_io_modules_scan_all_in_directory ::
CString ->
IO ()
ioModulesScanAllInDirectory ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Char]
-> m ()
ioModulesScanAllInDirectory :: [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 ()
foreign import ccall "g_io_error_quark" g_io_error_quark ::
IO Word32
ioErrorQuark ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Word32
ioErrorQuark :: 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
foreign import ccall "g_io_error_from_errno" g_io_error_from_errno ::
Int32 ->
IO CUInt
ioErrorFromErrno ::
(B.CallStack.HasCallStack, MonadIO m) =>
Int32
-> m Gio.Enums.IOErrorEnum
ioErrorFromErrno :: 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'
foreign import ccall "g_dbus_is_unique_name" g_dbus_is_unique_name ::
CString ->
IO CInt
dbusIsUniqueName ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Bool
dbusIsUniqueName :: 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'
foreign import ccall "g_dbus_is_supported_address" g_dbus_is_supported_address ::
CString ->
Ptr (Ptr GError) ->
IO CInt
dbusIsSupportedAddress ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m ()
dbusIsSupportedAddress :: 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'
)
foreign import ccall "g_dbus_is_name" g_dbus_is_name ::
CString ->
IO CInt
dbusIsName ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Bool
dbusIsName :: 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'
foreign import ccall "g_dbus_is_member_name" g_dbus_is_member_name ::
CString ->
IO CInt
dbusIsMemberName ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Bool
dbusIsMemberName :: 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'
foreign import ccall "g_dbus_is_interface_name" g_dbus_is_interface_name ::
CString ->
IO CInt
dbusIsInterfaceName ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Bool
dbusIsInterfaceName :: 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'
foreign import ccall "g_dbus_is_guid" g_dbus_is_guid ::
CString ->
IO CInt
dbusIsGuid ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Bool
dbusIsGuid :: 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'
foreign import ccall "g_dbus_is_address" g_dbus_is_address ::
CString ->
IO CInt
dbusIsAddress ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Bool
dbusIsAddress :: 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'
foreign import ccall "g_dbus_gvariant_to_gvalue" g_dbus_gvariant_to_gvalue ::
Ptr GVariant ->
Ptr GValue ->
IO ()
dbusGvariantToGvalue ::
(B.CallStack.HasCallStack, MonadIO m) =>
GVariant
-> m (GValue)
dbusGvariantToGvalue :: 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
Ptr GValue -> IO ()
B.GValue.unsetGValue 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'
foreign import ccall "g_dbus_gvalue_to_gvariant" g_dbus_gvalue_to_gvariant ::
Ptr GValue ->
Ptr GLib.VariantType.VariantType ->
IO (Ptr GVariant)
dbusGvalueToGvariant ::
(B.CallStack.HasCallStack, MonadIO m) =>
GValue
-> GLib.VariantType.VariantType
-> m GVariant
dbusGvalueToGvariant :: 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_
Ptr GValue -> IO ()
B.GValue.unsetGValue Ptr GValue
gvalue'
GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result'
foreign import ccall "g_dbus_generate_guid" g_dbus_generate_guid ::
IO CString
dbusGenerateGuid ::
(B.CallStack.HasCallStack, MonadIO m) =>
m T.Text
dbusGenerateGuid :: 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'
foreign import ccall "g_dbus_address_get_stream_sync" g_dbus_address_get_stream_sync ::
CString ->
Ptr CString ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.IOStream.IOStream)
dbusAddressGetStreamSync ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
T.Text
-> Maybe (a)
-> m ((Gio.IOStream.IOStream, T.Text))
dbusAddressGetStreamSync :: Text -> Maybe a -> m (IOStream, Text)
dbusAddressGetStreamSync Text
address Maybe a
cancellable = IO (IOStream, Text) -> m (IOStream, Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (IOStream, Text) -> m (IOStream, Text))
-> IO (IOStream, Text) -> m (IOStream, 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, Text) -> IO () -> IO (IOStream, 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
Text
outGuid'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
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, Text) -> IO (IOStream, Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (IOStream
result', Text
outGuid'')
) (do
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
address'
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outGuid
)
foreign import ccall "g_dbus_address_get_stream_finish" g_dbus_address_get_stream_finish ::
Ptr Gio.AsyncResult.AsyncResult ->
Ptr CString ->
Ptr (Ptr GError) ->
IO (Ptr Gio.IOStream.IOStream)
dbusAddressGetStreamFinish ::
(B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
a
-> m ((Gio.IOStream.IOStream, T.Text))
dbusAddressGetStreamFinish :: a -> m (IOStream, Text)
dbusAddressGetStreamFinish a
res = IO (IOStream, Text) -> m (IOStream, Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (IOStream, Text) -> m (IOStream, Text))
-> IO (IOStream, Text) -> m (IOStream, 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, Text) -> IO () -> IO (IOStream, 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
Text
outGuid'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
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, Text) -> IO (IOStream, Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (IOStream
result', Text
outGuid'')
) (do
Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
outGuid
)
foreign import ccall "g_dbus_address_get_stream" g_dbus_address_get_stream ::
CString ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
dbusAddressGetStream ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
T.Text
-> Maybe (a)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
dbusAddressGetStream :: 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 ()
foreign import ccall "g_dbus_address_get_for_bus_sync" g_dbus_address_get_for_bus_sync ::
CInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO CString
dbusAddressGetForBusSync ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Gio.Enums.BusType
-> Maybe (a)
-> m T.Text
dbusAddressGetForBusSync :: 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 ()
)
foreign import ccall "g_dbus_address_escape_value" g_dbus_address_escape_value ::
CString ->
IO CString
dbusAddressEscapeValue ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m T.Text
dbusAddressEscapeValue :: 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'
foreign import ccall "g_content_types_get_registered" g_content_types_get_registered ::
IO (Ptr (GList CString))
contentTypesGetRegistered ::
(B.CallStack.HasCallStack, MonadIO m) =>
m [T.Text]
contentTypesGetRegistered :: 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''
foreign import ccall "g_content_type_set_mime_dirs" g_content_type_set_mime_dirs ::
Ptr CString ->
IO ()
contentTypeSetMimeDirs ::
(B.CallStack.HasCallStack, MonadIO m) =>
Maybe ([T.Text])
-> m ()
contentTypeSetMimeDirs :: 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 ()
foreign import ccall "g_content_type_is_unknown" g_content_type_is_unknown ::
CString ->
IO CInt
contentTypeIsUnknown ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Bool
contentTypeIsUnknown :: 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'
foreign import ccall "g_content_type_is_mime_type" g_content_type_is_mime_type ::
CString ->
CString ->
IO CInt
contentTypeIsMimeType ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> T.Text
-> m Bool
contentTypeIsMimeType :: 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'
foreign import ccall "g_content_type_is_a" g_content_type_is_a ::
CString ->
CString ->
IO CInt
contentTypeIsA ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> T.Text
-> m Bool
contentTypeIsA :: 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'
foreign import ccall "g_content_type_guess_for_tree" g_content_type_guess_for_tree ::
Ptr Gio.File.File ->
IO (Ptr CString)
contentTypeGuessForTree ::
(B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a) =>
a
-> m [T.Text]
contentTypeGuessForTree :: 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'
foreign import ccall "g_content_type_guess" g_content_type_guess ::
CString ->
Ptr Word8 ->
Word64 ->
Ptr CInt ->
IO CString
contentTypeGuess ::
(B.CallStack.HasCallStack, MonadIO m) =>
Maybe (T.Text)
-> Maybe (ByteString)
-> m ((T.Text, Bool))
contentTypeGuess :: 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'')
foreign import ccall "g_content_type_get_symbolic_icon" g_content_type_get_symbolic_icon ::
CString ->
IO (Ptr Gio.Icon.Icon)
contentTypeGetSymbolicIcon ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Gio.Icon.Icon
contentTypeGetSymbolicIcon :: 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'
foreign import ccall "g_content_type_get_mime_type" g_content_type_get_mime_type ::
CString ->
IO CString
contentTypeGetMimeType ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m (Maybe T.Text)
contentTypeGetMimeType :: 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
foreign import ccall "g_content_type_get_mime_dirs" g_content_type_get_mime_dirs ::
IO (Ptr CString)
contentTypeGetMimeDirs ::
(B.CallStack.HasCallStack, MonadIO m) =>
m [T.Text]
contentTypeGetMimeDirs :: 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'
foreign import ccall "g_content_type_get_icon" g_content_type_get_icon ::
CString ->
IO (Ptr Gio.Icon.Icon)
contentTypeGetIcon ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Gio.Icon.Icon
contentTypeGetIcon :: 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'
foreign import ccall "g_content_type_get_generic_icon_name" g_content_type_get_generic_icon_name ::
CString ->
IO CString
contentTypeGetGenericIconName ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m (Maybe T.Text)
contentTypeGetGenericIconName :: 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
foreign import ccall "g_content_type_get_description" g_content_type_get_description ::
CString ->
IO CString
contentTypeGetDescription ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m T.Text
contentTypeGetDescription :: 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'
foreign import ccall "g_content_type_from_mime_type" g_content_type_from_mime_type ::
CString ->
IO CString
contentTypeFromMimeType ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m (Maybe T.Text)
contentTypeFromMimeType :: 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
foreign import ccall "g_content_type_equals" g_content_type_equals ::
CString ->
CString ->
IO CInt
contentTypeEquals ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> T.Text
-> m Bool
contentTypeEquals :: 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'
foreign import ccall "g_content_type_can_be_executable" g_content_type_can_be_executable ::
CString ->
IO CInt
contentTypeCanBeExecutable ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> m Bool
contentTypeCanBeExecutable :: 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'
foreign import ccall "g_bus_watch_name_on_connection_with_closures" g_bus_watch_name_on_connection_with_closures ::
Ptr Gio.DBusConnection.DBusConnection ->
CString ->
CUInt ->
Ptr (GClosure ()) ->
Ptr (GClosure ()) ->
IO Word32
busWatchNameOnConnection ::
(B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
a
-> T.Text
-> [Gio.Flags.BusNameWatcherFlags]
-> Maybe (GClosure b)
-> Maybe (GClosure c)
-> m Word32
busWatchNameOnConnection :: 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
foreign import ccall "g_bus_watch_name_with_closures" g_bus_watch_name_with_closures ::
CInt ->
CString ->
CUInt ->
Ptr (GClosure ()) ->
Ptr (GClosure ()) ->
IO Word32
busWatchName ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.Enums.BusType
-> T.Text
-> [Gio.Flags.BusNameWatcherFlags]
-> Maybe (GClosure a)
-> Maybe (GClosure b)
-> m Word32
busWatchName :: 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
foreign import ccall "g_bus_unwatch_name" g_bus_unwatch_name ::
Word32 ->
IO ()
busUnwatchName ::
(B.CallStack.HasCallStack, MonadIO m) =>
Word32
-> m ()
busUnwatchName :: 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 ()
foreign import ccall "g_bus_unown_name" g_bus_unown_name ::
Word32 ->
IO ()
busUnownName ::
(B.CallStack.HasCallStack, MonadIO m) =>
Word32
-> m ()
busUnownName :: 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 ()
foreign import ccall "g_bus_own_name_on_connection_with_closures" g_bus_own_name_on_connection_with_closures ::
Ptr Gio.DBusConnection.DBusConnection ->
CString ->
CUInt ->
Ptr (GClosure ()) ->
Ptr (GClosure ()) ->
IO Word32
busOwnNameOnConnection ::
(B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) =>
a
-> T.Text
-> [Gio.Flags.BusNameOwnerFlags]
-> Maybe (GClosure b)
-> Maybe (GClosure c)
-> m Word32
busOwnNameOnConnection :: 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
foreign import ccall "g_bus_own_name_with_closures" g_bus_own_name_with_closures ::
CInt ->
CString ->
CUInt ->
Ptr (GClosure ()) ->
Ptr (GClosure ()) ->
Ptr (GClosure ()) ->
IO Word32
busOwnName ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gio.Enums.BusType
-> T.Text
-> [Gio.Flags.BusNameOwnerFlags]
-> Maybe (GClosure a)
-> Maybe (GClosure b)
-> Maybe (GClosure c)
-> m Word32
busOwnName :: 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
foreign import ccall "g_bus_get_sync" g_bus_get_sync ::
CInt ->
Ptr Gio.Cancellable.Cancellable ->
Ptr (Ptr GError) ->
IO (Ptr Gio.DBusConnection.DBusConnection)
busGetSync ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Gio.Enums.BusType
-> Maybe (a)
-> m Gio.DBusConnection.DBusConnection
busGetSync :: 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 ()
)
foreign import ccall "g_bus_get_finish" g_bus_get_finish ::
Ptr Gio.AsyncResult.AsyncResult ->
Ptr (Ptr GError) ->
IO (Ptr Gio.DBusConnection.DBusConnection)
busGetFinish ::
(B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) =>
a
-> m Gio.DBusConnection.DBusConnection
busGetFinish :: 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 ()
)
foreign import ccall "g_bus_get" g_bus_get ::
CInt ->
Ptr Gio.Cancellable.Cancellable ->
FunPtr Gio.Callbacks.C_AsyncReadyCallback ->
Ptr () ->
IO ()
busGet ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) =>
Gio.Enums.BusType
-> Maybe (a)
-> Maybe (Gio.Callbacks.AsyncReadyCallback)
-> m ()
busGet :: 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 ()