-- | Copyright : Will Thompson and Iñaki García Etxebarria -- License : LGPL-2.1 -- Maintainer : Iñaki García Etxebarria #if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__)) #define ENABLE_OVERLOADING #endif module GI.Gio.Functions ( -- * Methods -- ** busGet #method:busGet# busGet , -- ** busGetFinish #method:busGetFinish# busGetFinish , -- ** busGetSync #method:busGetSync# busGetSync , -- ** busOwnName #method:busOwnName# busOwnName , -- ** busOwnNameOnConnection #method:busOwnNameOnConnection# busOwnNameOnConnection , -- ** busUnownName #method:busUnownName# busUnownName , -- ** busUnwatchName #method:busUnwatchName# busUnwatchName , -- ** busWatchName #method:busWatchName# busWatchName , -- ** busWatchNameOnConnection #method:busWatchNameOnConnection# busWatchNameOnConnection , -- ** contentTypeCanBeExecutable #method:contentTypeCanBeExecutable# contentTypeCanBeExecutable , -- ** contentTypeEquals #method:contentTypeEquals# contentTypeEquals , -- ** contentTypeFromMimeType #method:contentTypeFromMimeType# contentTypeFromMimeType , -- ** contentTypeGetDescription #method:contentTypeGetDescription# contentTypeGetDescription , -- ** contentTypeGetGenericIconName #method:contentTypeGetGenericIconName# contentTypeGetGenericIconName , -- ** contentTypeGetIcon #method:contentTypeGetIcon# contentTypeGetIcon , -- ** contentTypeGetMimeDirs #method:contentTypeGetMimeDirs# contentTypeGetMimeDirs , -- ** contentTypeGetMimeType #method:contentTypeGetMimeType# contentTypeGetMimeType , -- ** contentTypeGetSymbolicIcon #method:contentTypeGetSymbolicIcon# contentTypeGetSymbolicIcon , -- ** contentTypeGuess #method:contentTypeGuess# contentTypeGuess , -- ** contentTypeGuessForTree #method:contentTypeGuessForTree# contentTypeGuessForTree , -- ** contentTypeIsA #method:contentTypeIsA# contentTypeIsA , -- ** contentTypeIsMimeType #method:contentTypeIsMimeType# contentTypeIsMimeType , -- ** contentTypeIsUnknown #method:contentTypeIsUnknown# contentTypeIsUnknown , -- ** contentTypeSetMimeDirs #method:contentTypeSetMimeDirs# contentTypeSetMimeDirs , -- ** contentTypesGetRegistered #method:contentTypesGetRegistered# contentTypesGetRegistered , -- ** dbusAddressEscapeValue #method:dbusAddressEscapeValue# dbusAddressEscapeValue , -- ** dbusAddressGetForBusSync #method:dbusAddressGetForBusSync# dbusAddressGetForBusSync , -- ** dbusAddressGetStream #method:dbusAddressGetStream# dbusAddressGetStream , -- ** dbusAddressGetStreamFinish #method:dbusAddressGetStreamFinish# dbusAddressGetStreamFinish , -- ** dbusAddressGetStreamSync #method:dbusAddressGetStreamSync# dbusAddressGetStreamSync , -- ** dbusEscapeObjectPath #method:dbusEscapeObjectPath# dbusEscapeObjectPath , -- ** dbusEscapeObjectPathBytestring #method:dbusEscapeObjectPathBytestring# dbusEscapeObjectPathBytestring , -- ** dbusGenerateGuid #method:dbusGenerateGuid# dbusGenerateGuid , -- ** dbusGvalueToGvariant #method:dbusGvalueToGvariant# dbusGvalueToGvariant , -- ** dbusGvariantToGvalue #method:dbusGvariantToGvalue# dbusGvariantToGvalue , -- ** dbusIsAddress #method:dbusIsAddress# dbusIsAddress , -- ** dbusIsErrorName #method:dbusIsErrorName# dbusIsErrorName , -- ** dbusIsGuid #method:dbusIsGuid# dbusIsGuid , -- ** dbusIsInterfaceName #method:dbusIsInterfaceName# dbusIsInterfaceName , -- ** dbusIsMemberName #method:dbusIsMemberName# dbusIsMemberName , -- ** dbusIsName #method:dbusIsName# dbusIsName , -- ** dbusIsSupportedAddress #method:dbusIsSupportedAddress# dbusIsSupportedAddress , -- ** dbusIsUniqueName #method:dbusIsUniqueName# dbusIsUniqueName , -- ** dbusUnescapeObjectPath #method:dbusUnescapeObjectPath# dbusUnescapeObjectPath , -- ** ioErrorFromErrno #method:ioErrorFromErrno# ioErrorFromErrno , -- ** ioErrorFromFileError #method:ioErrorFromFileError# ioErrorFromFileError , -- ** ioErrorQuark #method:ioErrorQuark# ioErrorQuark , -- ** ioModulesScanAllInDirectory #method:ioModulesScanAllInDirectory# ioModulesScanAllInDirectory , -- ** ioModulesScanAllInDirectoryWithScope #method:ioModulesScanAllInDirectoryWithScope# ioModulesScanAllInDirectoryWithScope , -- ** ioSchedulerCancelAllJobs #method:ioSchedulerCancelAllJobs# ioSchedulerCancelAllJobs , -- ** ioSchedulerPushJob #method:ioSchedulerPushJob# ioSchedulerPushJob , -- ** keyfileSettingsBackendNew #method:keyfileSettingsBackendNew# keyfileSettingsBackendNew , -- ** memorySettingsBackendNew #method:memorySettingsBackendNew# memorySettingsBackendNew , -- ** networkingInit #method:networkingInit# networkingInit , -- ** nullSettingsBackendNew #method:nullSettingsBackendNew# nullSettingsBackendNew , -- ** pollableSourceNew #method:pollableSourceNew# pollableSourceNew , -- ** pollableSourceNewFull #method:pollableSourceNewFull# pollableSourceNewFull , -- ** pollableStreamRead #method:pollableStreamRead# pollableStreamRead , -- ** pollableStreamWrite #method:pollableStreamWrite# pollableStreamWrite , -- ** pollableStreamWriteAll #method:pollableStreamWriteAll# pollableStreamWriteAll , -- ** resourcesEnumerateChildren #method:resourcesEnumerateChildren# resourcesEnumerateChildren , -- ** resourcesGetInfo #method:resourcesGetInfo# resourcesGetInfo , -- ** resourcesLookupData #method:resourcesLookupData# resourcesLookupData , -- ** resourcesOpenStream #method:resourcesOpenStream# resourcesOpenStream , -- ** resourcesRegister #method:resourcesRegister# resourcesRegister , -- ** resourcesUnregister #method:resourcesUnregister# resourcesUnregister , -- ** simpleAsyncReportGerrorInIdle #method:simpleAsyncReportGerrorInIdle# simpleAsyncReportGerrorInIdle , -- ** unixIsMountPathSystemInternal #method:unixIsMountPathSystemInternal# unixIsMountPathSystemInternal , -- ** unixIsSystemDevicePath #method:unixIsSystemDevicePath# unixIsSystemDevicePath , -- ** unixIsSystemFsType #method:unixIsSystemFsType# unixIsSystemFsType , -- ** unixMountAt #method:unixMountAt# unixMountAt , -- ** unixMountCompare #method:unixMountCompare# unixMountCompare , -- ** unixMountCopy #method:unixMountCopy# unixMountCopy , -- ** unixMountFor #method:unixMountFor# unixMountFor , -- ** unixMountFree #method:unixMountFree# unixMountFree , -- ** unixMountGetDevicePath #method:unixMountGetDevicePath# unixMountGetDevicePath , -- ** unixMountGetFsType #method:unixMountGetFsType# unixMountGetFsType , -- ** unixMountGetMountPath #method:unixMountGetMountPath# unixMountGetMountPath , -- ** unixMountGetOptions #method:unixMountGetOptions# unixMountGetOptions , -- ** unixMountGetRootPath #method:unixMountGetRootPath# unixMountGetRootPath , -- ** unixMountGuessCanEject #method:unixMountGuessCanEject# unixMountGuessCanEject , -- ** unixMountGuessIcon #method:unixMountGuessIcon# unixMountGuessIcon , -- ** unixMountGuessName #method:unixMountGuessName# unixMountGuessName , -- ** unixMountGuessShouldDisplay #method:unixMountGuessShouldDisplay# unixMountGuessShouldDisplay , -- ** unixMountGuessSymbolicIcon #method:unixMountGuessSymbolicIcon# unixMountGuessSymbolicIcon , -- ** unixMountIsReadonly #method:unixMountIsReadonly# unixMountIsReadonly , -- ** unixMountIsSystemInternal #method:unixMountIsSystemInternal# unixMountIsSystemInternal , -- ** unixMountPointsChangedSince #method:unixMountPointsChangedSince# unixMountPointsChangedSince , -- ** unixMountPointsGet #method:unixMountPointsGet# unixMountPointsGet , -- ** unixMountsChangedSince #method:unixMountsChangedSince# unixMountsChangedSince , -- ** unixMountsGet #method:unixMountsGet# unixMountsGet , ) where import Data.GI.Base.ShortPrelude import qualified Data.GI.Base.ShortPrelude as SP import qualified Data.GI.Base.Overloading as O import qualified Prelude as P import qualified Data.GI.Base.Attributes as GI.Attributes import qualified Data.GI.Base.BasicTypes as B.Types import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr import qualified Data.GI.Base.GArray as B.GArray import qualified Data.GI.Base.GClosure as B.GClosure import qualified Data.GI.Base.GError as B.GError import qualified Data.GI.Base.GHashTable as B.GHT import qualified Data.GI.Base.GVariant as B.GVariant import qualified Data.GI.Base.GValue as B.GValue import qualified Data.GI.Base.GParamSpec as B.GParamSpec import qualified Data.GI.Base.CallStack as B.CallStack import qualified Data.GI.Base.Properties as B.Properties import qualified Data.GI.Base.Signals as B.Signals import qualified Control.Monad.IO.Class as MIO import qualified Data.Coerce as Coerce import qualified Data.Text as T import qualified Data.Kind as DK import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import qualified Foreign.Ptr as FP import qualified GHC.OverloadedLabels as OL import qualified GHC.Records as R import qualified Data.Word as DW import qualified Data.Int as DI import qualified System.Posix.Types as SPT import qualified Foreign.C.Types as FCT -- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392 #if MIN_VERSION_base(4,18,0) import qualified GI.GLib.Callbacks as GLib.Callbacks import qualified GI.GLib.Enums as GLib.Enums import qualified GI.GLib.Structs.Bytes as GLib.Bytes import qualified GI.GLib.Structs.DateTime as GLib.DateTime import qualified GI.GLib.Structs.PollFD as GLib.PollFD import qualified GI.GLib.Structs.Source as GLib.Source import qualified GI.GLib.Structs.String as GLib.String import qualified GI.GLib.Structs.TimeVal as GLib.TimeVal import qualified GI.GLib.Structs.Tree as GLib.Tree import qualified GI.GLib.Structs.VariantType as GLib.VariantType import qualified GI.GObject.Callbacks as GObject.Callbacks import qualified GI.GObject.Objects.Object as GObject.Object import qualified GI.GObject.Structs.Parameter as GObject.Parameter 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.ActionGroup as Gio.ActionGroup import {-# SOURCE #-} qualified GI.Gio.Interfaces.AppInfo as Gio.AppInfo import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncInitable as Gio.AsyncInitable import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult import {-# SOURCE #-} qualified GI.Gio.Interfaces.Drive as Gio.Drive 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.Interfaces.Initable as Gio.Initable import {-# SOURCE #-} qualified GI.Gio.Interfaces.Mount as Gio.Mount import {-# SOURCE #-} qualified GI.Gio.Interfaces.Seekable as Gio.Seekable import {-# SOURCE #-} qualified GI.Gio.Interfaces.Volume as Gio.Volume import {-# SOURCE #-} qualified GI.Gio.Objects.AppLaunchContext as Gio.AppLaunchContext import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable import {-# SOURCE #-} qualified GI.Gio.Objects.Credentials as Gio.Credentials import {-# SOURCE #-} qualified GI.Gio.Objects.DBusAuthObserver as Gio.DBusAuthObserver import {-# SOURCE #-} qualified GI.Gio.Objects.DBusConnection as Gio.DBusConnection import {-# SOURCE #-} qualified GI.Gio.Objects.DBusMessage as Gio.DBusMessage import {-# SOURCE #-} qualified GI.Gio.Objects.FileEnumerator as Gio.FileEnumerator import {-# SOURCE #-} qualified GI.Gio.Objects.FileIOStream as Gio.FileIOStream import {-# SOURCE #-} qualified GI.Gio.Objects.FileInfo as Gio.FileInfo import {-# SOURCE #-} qualified GI.Gio.Objects.FileInputStream as Gio.FileInputStream import {-# SOURCE #-} qualified GI.Gio.Objects.FileMonitor as Gio.FileMonitor import {-# SOURCE #-} qualified GI.Gio.Objects.FileOutputStream as Gio.FileOutputStream 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.MenuAttributeIter as Gio.MenuAttributeIter import {-# SOURCE #-} qualified GI.Gio.Objects.MenuLinkIter as Gio.MenuLinkIter import {-# SOURCE #-} qualified GI.Gio.Objects.MenuModel as Gio.MenuModel import {-# SOURCE #-} qualified GI.Gio.Objects.MountOperation as Gio.MountOperation 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.Objects.UnixFDList as Gio.UnixFDList import {-# SOURCE #-} qualified GI.Gio.Structs.DBusAnnotationInfo as Gio.DBusAnnotationInfo import {-# SOURCE #-} qualified GI.Gio.Structs.DBusArgInfo as Gio.DBusArgInfo import {-# SOURCE #-} qualified GI.Gio.Structs.DBusInterfaceInfo as Gio.DBusInterfaceInfo import {-# SOURCE #-} qualified GI.Gio.Structs.DBusMethodInfo as Gio.DBusMethodInfo import {-# SOURCE #-} qualified GI.Gio.Structs.DBusPropertyInfo as Gio.DBusPropertyInfo import {-# SOURCE #-} qualified GI.Gio.Structs.DBusSignalInfo as Gio.DBusSignalInfo import {-# SOURCE #-} qualified GI.Gio.Structs.DBusSubtreeVTable as Gio.DBusSubtreeVTable import {-# SOURCE #-} qualified GI.Gio.Structs.FileAttributeInfo as Gio.FileAttributeInfo import {-# SOURCE #-} qualified GI.Gio.Structs.FileAttributeInfoList as Gio.FileAttributeInfoList import {-# SOURCE #-} qualified GI.Gio.Structs.FileAttributeMatcher as Gio.FileAttributeMatcher import {-# SOURCE #-} qualified GI.Gio.Structs.IOModuleScope as Gio.IOModuleScope import {-# SOURCE #-} qualified GI.Gio.Structs.OutputVector as Gio.OutputVector 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 #else import qualified GI.GLib.Callbacks as GLib.Callbacks import qualified GI.GLib.Enums as GLib.Enums 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 #endif -- function unix_mounts_get -- Args: [ Arg -- { argCName = "time_read" -- , argType = TBasicType TUInt64 -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "guint64 to contain a timestamp, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Just -- (TGList -- (TInterface Name { namespace = "Gio" , name = "UnixMountEntry" })) -- throws : False -- Skip return : False foreign import ccall "g_unix_mounts_get" g_unix_mounts_get :: Ptr Word64 -> -- time_read : TBasicType TUInt64 IO (Ptr (GList (Ptr Gio.UnixMountEntry.UnixMountEntry))) -- | Gets a t'GI.GLib.Structs.List.List' of t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' containing the unix mounts. -- If /@timeRead@/ is set, it will be filled with the mount -- timestamp, allowing for checking if the mounts have changed -- with 'GI.Gio.Functions.unixMountsChangedSince'. unixMountsGet :: (B.CallStack.HasCallStack, MonadIO m) => m (([Gio.UnixMountEntry.UnixMountEntry], Word64)) -- ^ __Returns:__ -- a t'GI.GLib.Structs.List.List' of the UNIX mounts. unixMountsGet :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ([UnixMountEntry], Word64) unixMountsGet = IO ([UnixMountEntry], Word64) -> m ([UnixMountEntry], Word64) forall a. IO a -> m a 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 timeRead <- IO (Ptr Word64) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr Word64) result <- g_unix_mounts_get timeRead result' <- unpackGList result result'' <- mapM (wrapBoxed Gio.UnixMountEntry.UnixMountEntry) result' g_list_free result timeRead' <- peek timeRead freeMem timeRead return (result'', timeRead') -- function unix_mounts_changed_since -- Args: [ Arg -- { argCName = "time" -- , argType = TBasicType TUInt64 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "guint64 to contain a timestamp." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_unix_mounts_changed_since" g_unix_mounts_changed_since :: Word64 -> -- time : TBasicType TUInt64 IO CInt -- | Checks if the unix mounts have changed since a given unix time. unixMountsChangedSince :: (B.CallStack.HasCallStack, MonadIO m) => Word64 -- ^ /@time@/: guint64 to contain a timestamp. -> m Bool -- ^ __Returns:__ 'P.True' if the mounts have changed since /@time@/. unixMountsChangedSince :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word64 -> m Bool unixMountsChangedSince Word64 time = IO Bool -> m Bool forall a. IO a -> m a 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 result <- Word64 -> IO CInt g_unix_mounts_changed_since Word64 time let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result return result' -- function unix_mount_points_get -- Args: [ Arg -- { argCName = "time_read" -- , argType = TBasicType TUInt64 -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "guint64 to contain a timestamp." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Just -- (TGList -- (TInterface Name { namespace = "Gio" , name = "UnixMountPoint" })) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_points_get" g_unix_mount_points_get :: Ptr Word64 -> -- time_read : TBasicType TUInt64 IO (Ptr (GList (Ptr Gio.UnixMountPoint.UnixMountPoint))) -- | Gets a t'GI.GLib.Structs.List.List' of t'GI.Gio.Structs.UnixMountPoint.UnixMountPoint' containing the unix mount points. -- If /@timeRead@/ is set, it will be filled with the mount timestamp, -- allowing for checking if the mounts have changed with -- 'GI.Gio.Functions.unixMountPointsChangedSince'. unixMountPointsGet :: (B.CallStack.HasCallStack, MonadIO m) => m (([Gio.UnixMountPoint.UnixMountPoint], Word64)) -- ^ __Returns:__ -- a t'GI.GLib.Structs.List.List' of the UNIX mountpoints. unixMountPointsGet :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ([UnixMountPoint], Word64) unixMountPointsGet = IO ([UnixMountPoint], Word64) -> m ([UnixMountPoint], Word64) forall a. IO a -> m a 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 timeRead <- IO (Ptr Word64) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr Word64) result <- g_unix_mount_points_get timeRead result' <- unpackGList result result'' <- mapM (wrapBoxed Gio.UnixMountPoint.UnixMountPoint) result' g_list_free result timeRead' <- peek timeRead freeMem timeRead return (result'', timeRead') -- function unix_mount_points_changed_since -- Args: [ Arg -- { argCName = "time" -- , argType = TBasicType TUInt64 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "guint64 to contain a timestamp." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_points_changed_since" g_unix_mount_points_changed_since :: Word64 -> -- time : TBasicType TUInt64 IO CInt -- | Checks if the unix mount points have changed since a given unix time. unixMountPointsChangedSince :: (B.CallStack.HasCallStack, MonadIO m) => Word64 -- ^ /@time@/: guint64 to contain a timestamp. -> m Bool -- ^ __Returns:__ 'P.True' if the mount points have changed since /@time@/. unixMountPointsChangedSince :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word64 -> m Bool unixMountPointsChangedSince Word64 time = IO Bool -> m Bool forall a. IO a -> m a 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 result <- Word64 -> IO CInt g_unix_mount_points_changed_since Word64 time let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result return result' -- function unix_mount_is_system_internal -- Args: [ Arg -- { argCName = "mount_entry" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUnixMount." , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_is_system_internal" g_unix_mount_is_system_internal :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO CInt -- | Checks if a Unix mount is a system mount. This is the Boolean OR of -- 'GI.Gio.Functions.unixIsSystemFsType', 'GI.Gio.Functions.unixIsSystemDevicePath' and -- 'GI.Gio.Functions.unixIsMountPathSystemInternal' on /@mountEntry@/’s properties. -- -- The definition of what a ‘system’ mount entry is may change over time as new -- file system types and device paths are ignored. unixMountIsSystemInternal :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mountEntry@/: a @/GUnixMount/@. -> m Bool -- ^ __Returns:__ 'P.True' if the unix mount is for a system path. unixMountIsSystemInternal :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> m Bool unixMountIsSystemInternal UnixMountEntry mountEntry = IO Bool -> m Bool forall a. IO a -> m a 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 mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mountEntry result <- g_unix_mount_is_system_internal mountEntry' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result touchManagedPtr mountEntry return result' -- function unix_mount_is_readonly -- Args: [ Arg -- { argCName = "mount_entry" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUnixMount." , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_is_readonly" g_unix_mount_is_readonly :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO CInt -- | Checks if a unix mount is mounted read only. unixMountIsReadonly :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mountEntry@/: a @/GUnixMount/@. -> m Bool -- ^ __Returns:__ 'P.True' if /@mountEntry@/ is read only. unixMountIsReadonly :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> m Bool unixMountIsReadonly UnixMountEntry mountEntry = IO Bool -> m Bool forall a. IO a -> m a 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 mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mountEntry result <- g_unix_mount_is_readonly mountEntry' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result touchManagedPtr mountEntry return result' -- function unix_mount_guess_symbolic_icon -- Args: [ Arg -- { argCName = "mount_entry" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUnixMountEntry" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "Gio" , name = "Icon" }) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_guess_symbolic_icon" g_unix_mount_guess_symbolic_icon :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO (Ptr Gio.Icon.Icon) -- | Guesses the symbolic icon of a Unix mount. -- -- /Since: 2.34/ unixMountGuessSymbolicIcon :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' -> m Gio.Icon.Icon -- ^ __Returns:__ a t'GI.Gio.Interfaces.Icon.Icon' unixMountGuessSymbolicIcon :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> m Icon unixMountGuessSymbolicIcon UnixMountEntry mountEntry = IO Icon -> m Icon forall a. IO a -> m a 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 mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mountEntry result <- g_unix_mount_guess_symbolic_icon mountEntry' checkUnexpectedReturnNULL "unixMountGuessSymbolicIcon" result result' <- (wrapObject Gio.Icon.Icon) result touchManagedPtr mountEntry return result' -- function unix_mount_guess_should_display -- Args: [ Arg -- { argCName = "mount_entry" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUnixMountEntry" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_guess_should_display" g_unix_mount_guess_should_display :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO CInt -- | Guesses whether a Unix mount should be displayed in the UI. unixMountGuessShouldDisplay :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' -> m Bool -- ^ __Returns:__ 'P.True' if /@mountEntry@/ is deemed to be displayable. unixMountGuessShouldDisplay :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> m Bool unixMountGuessShouldDisplay UnixMountEntry mountEntry = IO Bool -> m Bool forall a. IO a -> m a 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 mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mountEntry result <- g_unix_mount_guess_should_display mountEntry' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result touchManagedPtr mountEntry return result' -- function unix_mount_guess_name -- Args: [ Arg -- { argCName = "mount_entry" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUnixMountEntry" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_guess_name" g_unix_mount_guess_name :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO CString -- | Guesses the name of a Unix mount. -- The result is a translated string. unixMountGuessName :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' -> m T.Text -- ^ __Returns:__ A newly allocated string that must -- be freed with 'GI.GLib.Functions.free' unixMountGuessName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> m Text unixMountGuessName UnixMountEntry mountEntry = IO Text -> m Text forall a. IO a -> m a 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 mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mountEntry result <- g_unix_mount_guess_name mountEntry' checkUnexpectedReturnNULL "unixMountGuessName" result result' <- cstringToText result freeMem result touchManagedPtr mountEntry return result' -- function unix_mount_guess_icon -- Args: [ Arg -- { argCName = "mount_entry" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUnixMountEntry" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "Gio" , name = "Icon" }) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_guess_icon" g_unix_mount_guess_icon :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO (Ptr Gio.Icon.Icon) -- | Guesses the icon of a Unix mount. unixMountGuessIcon :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' -> m Gio.Icon.Icon -- ^ __Returns:__ a t'GI.Gio.Interfaces.Icon.Icon' unixMountGuessIcon :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> m Icon unixMountGuessIcon UnixMountEntry mountEntry = IO Icon -> m Icon forall a. IO a -> m a 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 mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mountEntry result <- g_unix_mount_guess_icon mountEntry' checkUnexpectedReturnNULL "unixMountGuessIcon" result result' <- (wrapObject Gio.Icon.Icon) result touchManagedPtr mountEntry return result' -- function unix_mount_guess_can_eject -- Args: [ Arg -- { argCName = "mount_entry" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUnixMountEntry" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_guess_can_eject" g_unix_mount_guess_can_eject :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO CInt -- | Guesses whether a Unix mount can be ejected. unixMountGuessCanEject :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' -> m Bool -- ^ __Returns:__ 'P.True' if /@mountEntry@/ is deemed to be ejectable. unixMountGuessCanEject :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> m Bool unixMountGuessCanEject UnixMountEntry mountEntry = IO Bool -> m Bool forall a. IO a -> m a 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 mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mountEntry result <- g_unix_mount_guess_can_eject mountEntry' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result touchManagedPtr mountEntry return result' -- function unix_mount_get_root_path -- Args: [ Arg -- { argCName = "mount_entry" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUnixMountEntry." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_get_root_path" g_unix_mount_get_root_path :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO CString -- | Gets the root of the mount within the filesystem. This is useful e.g. for -- mounts created by bind operation, or btrfs subvolumes. -- -- For example, the root path is equal to \"\/\" for mount created by -- \"mount \/dev\/sda1 \/mnt\/foo\" and \"\/bar\" for -- \"mount --bind \/mnt\/foo\/bar \/mnt\/bar\". -- -- /Since: 2.60/ unixMountGetRootPath :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'. -> m (Maybe T.Text) -- ^ __Returns:__ a string containing the root, or 'P.Nothing' if not supported. unixMountGetRootPath :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> m (Maybe Text) unixMountGetRootPath UnixMountEntry mountEntry = IO (Maybe Text) -> m (Maybe Text) forall a. IO a -> m a 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 mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mountEntry result <- g_unix_mount_get_root_path mountEntry' maybeResult <- convertIfNonNull result $ \CString result' -> do result'' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result' return result'' touchManagedPtr mountEntry return maybeResult -- function unix_mount_get_options -- Args: [ Arg -- { argCName = "mount_entry" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUnixMountEntry." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_get_options" g_unix_mount_get_options :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO CString -- | Gets a comma-separated list of mount options for the unix mount. For example, -- @rw,relatime,seclabel,data=ordered@. -- -- This is similar to 'GI.Gio.Structs.UnixMountPoint.unixMountPointGetOptions', but it takes -- a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' as an argument. -- -- /Since: 2.58/ unixMountGetOptions :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'. -> m (Maybe T.Text) -- ^ __Returns:__ a string containing the options, or 'P.Nothing' if not -- available. unixMountGetOptions :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> m (Maybe Text) unixMountGetOptions UnixMountEntry mountEntry = IO (Maybe Text) -> m (Maybe Text) forall a. IO a -> m a 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 mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mountEntry result <- g_unix_mount_get_options mountEntry' maybeResult <- convertIfNonNull result $ \CString result' -> do result'' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result' return result'' touchManagedPtr mountEntry return maybeResult -- function unix_mount_get_mount_path -- Args: [ Arg -- { argCName = "mount_entry" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "input #GUnixMountEntry to get the mount path for." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TFileName) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_get_mount_path" g_unix_mount_get_mount_path :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO CString -- | Gets the mount path for a unix mount. unixMountGetMountPath :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mountEntry@/: input t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' to get the mount path for. -> m [Char] -- ^ __Returns:__ the mount path for /@mountEntry@/. unixMountGetMountPath :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> m String unixMountGetMountPath UnixMountEntry mountEntry = IO String -> m String forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO String -> m String) -> IO String -> m String forall a b. (a -> b) -> a -> b $ do mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mountEntry result <- g_unix_mount_get_mount_path mountEntry' checkUnexpectedReturnNULL "unixMountGetMountPath" result result' <- cstringToString result touchManagedPtr mountEntry return result' -- function unix_mount_get_fs_type -- Args: [ Arg -- { argCName = "mount_entry" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUnixMount." , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_get_fs_type" g_unix_mount_get_fs_type :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO CString -- | Gets the filesystem type for the unix mount. unixMountGetFsType :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mountEntry@/: a @/GUnixMount/@. -> m T.Text -- ^ __Returns:__ a string containing the file system type. unixMountGetFsType :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> m Text unixMountGetFsType UnixMountEntry mountEntry = IO Text -> m Text forall a. IO a -> m a 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 mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mountEntry result <- g_unix_mount_get_fs_type mountEntry' checkUnexpectedReturnNULL "unixMountGetFsType" result result' <- cstringToText result touchManagedPtr mountEntry return result' -- function unix_mount_get_device_path -- Args: [ Arg -- { argCName = "mount_entry" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUnixMount." , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TFileName) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_get_device_path" g_unix_mount_get_device_path :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO CString -- | Gets the device path for a unix mount. unixMountGetDevicePath :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mountEntry@/: a @/GUnixMount/@. -> m [Char] -- ^ __Returns:__ a string containing the device path. unixMountGetDevicePath :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> m String unixMountGetDevicePath UnixMountEntry mountEntry = IO String -> m String forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO String -> m String) -> IO String -> m String forall a b. (a -> b) -> a -> b $ do mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mountEntry result <- g_unix_mount_get_device_path mountEntry' checkUnexpectedReturnNULL "unixMountGetDevicePath" result result' <- cstringToString result touchManagedPtr mountEntry return result' -- function unix_mount_free -- Args: [ Arg -- { argCName = "mount_entry" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUnixMountEntry." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_free" g_unix_mount_free :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO () -- | Frees a unix mount. unixMountFree :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'. -> m () unixMountFree :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> m () unixMountFree UnixMountEntry mountEntry = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mountEntry g_unix_mount_free mountEntry' touchManagedPtr mountEntry return () -- function unix_mount_for -- Args: [ Arg -- { argCName = "file_path" -- , argType = TBasicType TFileName -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "file path on some unix mount." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "time_read" -- , argType = TBasicType TUInt64 -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "guint64 to contain a timestamp." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Just -- (TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_for" g_unix_mount_for :: CString -> -- file_path : TBasicType TFileName Ptr Word64 -> -- time_read : TBasicType TUInt64 IO (Ptr Gio.UnixMountEntry.UnixMountEntry) -- | Gets a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' for a given file path. If /@timeRead@/ -- is set, it will be filled with a unix timestamp for checking -- if the mounts have changed since with 'GI.Gio.Functions.unixMountsChangedSince'. -- -- If more mounts have the same mount path, the last matching mount -- is returned. -- -- This will return 'P.Nothing' if looking up the mount entry fails, if -- /@filePath@/ doesn’t exist or there is an I\/O error. -- -- /Since: 2.52/ unixMountFor :: (B.CallStack.HasCallStack, MonadIO m) => [Char] -- ^ /@filePath@/: file path on some unix mount. -> m ((Maybe Gio.UnixMountEntry.UnixMountEntry, Word64)) -- ^ __Returns:__ a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'. unixMountFor :: forall (m :: * -> *). (HasCallStack, MonadIO m) => String -> m (Maybe UnixMountEntry, Word64) unixMountFor String filePath = IO (Maybe UnixMountEntry, Word64) -> m (Maybe UnixMountEntry, Word64) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Maybe UnixMountEntry, Word64) -> m (Maybe UnixMountEntry, Word64)) -> IO (Maybe UnixMountEntry, Word64) -> m (Maybe UnixMountEntry, Word64) forall a b. (a -> b) -> a -> b $ do filePath' <- String -> IO CString stringToCString String filePath timeRead <- allocMem :: IO (Ptr Word64) result <- g_unix_mount_for filePath' timeRead maybeResult <- convertIfNonNull result $ \Ptr UnixMountEntry result' -> do 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' return result'' timeRead' <- peek timeRead freeMem filePath' freeMem timeRead return (maybeResult, timeRead') -- function unix_mount_copy -- Args: [ Arg -- { argCName = "mount_entry" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GUnixMountEntry." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just -- (TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_copy" g_unix_mount_copy :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount_entry : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO (Ptr Gio.UnixMountEntry.UnixMountEntry) -- | Makes a copy of /@mountEntry@/. -- -- /Since: 2.54/ unixMountCopy :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mountEntry@/: a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'. -> m Gio.UnixMountEntry.UnixMountEntry -- ^ __Returns:__ a new t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' unixMountCopy :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> m UnixMountEntry unixMountCopy UnixMountEntry mountEntry = IO UnixMountEntry -> m UnixMountEntry forall a. IO a -> m a 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 mountEntry' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mountEntry result <- g_unix_mount_copy mountEntry' checkUnexpectedReturnNULL "unixMountCopy" result result' <- (wrapBoxed Gio.UnixMountEntry.UnixMountEntry) result touchManagedPtr mountEntry return result' -- function unix_mount_compare -- Args: [ Arg -- { argCName = "mount1" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "first #GUnixMountEntry to compare." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "mount2" -- , argType = -- TInterface Name { namespace = "Gio" , name = "UnixMountEntry" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "second #GUnixMountEntry to compare." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TInt) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_compare" g_unix_mount_compare :: Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount1 : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) Ptr Gio.UnixMountEntry.UnixMountEntry -> -- mount2 : TInterface (Name {namespace = "Gio", name = "UnixMountEntry"}) IO Int32 -- | Compares two unix mounts. unixMountCompare :: (B.CallStack.HasCallStack, MonadIO m) => Gio.UnixMountEntry.UnixMountEntry -- ^ /@mount1@/: first t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' to compare. -> Gio.UnixMountEntry.UnixMountEntry -- ^ /@mount2@/: second t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' to compare. -> m Int32 -- ^ __Returns:__ 1, 0 or -1 if /@mount1@/ is greater than, equal to, -- or less than /@mount2@/, respectively. unixMountCompare :: forall (m :: * -> *). (HasCallStack, MonadIO m) => UnixMountEntry -> UnixMountEntry -> m Int32 unixMountCompare UnixMountEntry mount1 UnixMountEntry mount2 = IO Int32 -> m Int32 forall a. IO a -> m a 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 mount1' <- UnixMountEntry -> IO (Ptr UnixMountEntry) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr UnixMountEntry mount1 mount2' <- unsafeManagedPtrGetPtr mount2 result <- g_unix_mount_compare mount1' mount2' touchManagedPtr mount1 touchManagedPtr mount2 return result -- function unix_mount_at -- Args: [ Arg -- { argCName = "mount_path" -- , argType = TBasicType TFileName -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "path for a possible unix mount." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "time_read" -- , argType = TBasicType TUInt64 -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "guint64 to contain a timestamp." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Just -- (TInterface Name { namespace = "Gio" , name = "UnixMountEntry" }) -- throws : False -- Skip return : False foreign import ccall "g_unix_mount_at" g_unix_mount_at :: CString -> -- mount_path : TBasicType TFileName Ptr Word64 -> -- time_read : TBasicType TUInt64 IO (Ptr Gio.UnixMountEntry.UnixMountEntry) -- | Gets a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry' for a given mount path. If /@timeRead@/ -- is set, it will be filled with a unix timestamp for checking -- if the mounts have changed since with 'GI.Gio.Functions.unixMountsChangedSince'. -- -- If more mounts have the same mount path, the last matching mount -- is returned. -- -- This will return 'P.Nothing' if there is no mount point at /@mountPath@/. unixMountAt :: (B.CallStack.HasCallStack, MonadIO m) => [Char] -- ^ /@mountPath@/: path for a possible unix mount. -> m ((Maybe Gio.UnixMountEntry.UnixMountEntry, Word64)) -- ^ __Returns:__ a t'GI.Gio.Structs.UnixMountEntry.UnixMountEntry'. unixMountAt :: forall (m :: * -> *). (HasCallStack, MonadIO m) => String -> m (Maybe UnixMountEntry, Word64) unixMountAt String mountPath = IO (Maybe UnixMountEntry, Word64) -> m (Maybe UnixMountEntry, Word64) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Maybe UnixMountEntry, Word64) -> m (Maybe UnixMountEntry, Word64)) -> IO (Maybe UnixMountEntry, Word64) -> m (Maybe UnixMountEntry, Word64) forall a b. (a -> b) -> a -> b $ do mountPath' <- String -> IO CString stringToCString String mountPath timeRead <- allocMem :: IO (Ptr Word64) result <- g_unix_mount_at mountPath' timeRead maybeResult <- convertIfNonNull result $ \Ptr UnixMountEntry result' -> do 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' return result'' timeRead' <- peek timeRead freeMem mountPath' freeMem timeRead return (maybeResult, timeRead') -- function unix_is_system_fs_type -- Args: [ Arg -- { argCName = "fs_type" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a file system type, e.g. `procfs` or `tmpfs`" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_unix_is_system_fs_type" g_unix_is_system_fs_type :: CString -> -- fs_type : TBasicType TUTF8 IO CInt -- | Determines if /@fsType@/ is considered a type of file system which is only -- used in implementation of the OS. This is primarily used for hiding -- mounted volumes that are intended as APIs for programs to read, and system -- administrators at a shell; rather than something that should, for example, -- appear in a GUI. For example, the Linux @\/proc@ filesystem. -- -- The list of file system types considered ‘system’ ones may change over time. -- -- /Since: 2.56/ unixIsSystemFsType :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@fsType@/: a file system type, e.g. @procfs@ or @tmpfs@ -> m Bool -- ^ __Returns:__ 'P.True' if /@fsType@/ is considered an implementation detail of the OS. unixIsSystemFsType :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool unixIsSystemFsType Text fsType = IO Bool -> m Bool forall a. IO a -> m a 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 fsType' <- Text -> IO CString textToCString Text fsType result <- g_unix_is_system_fs_type fsType' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem fsType' return result' -- function unix_is_system_device_path -- Args: [ Arg -- { argCName = "device_path" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a device path, e.g. `/dev/loop0` or `nfsd`" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_unix_is_system_device_path" g_unix_is_system_device_path :: CString -> -- device_path : TBasicType TUTF8 IO CInt -- | Determines if /@devicePath@/ is considered a block device path which is only -- used in implementation of the OS. This is primarily used for hiding -- mounted volumes that are intended as APIs for programs to read, and system -- administrators at a shell; rather than something that should, for example, -- appear in a GUI. For example, the Linux @\/proc@ filesystem. -- -- The list of device paths considered ‘system’ ones may change over time. -- -- /Since: 2.56/ unixIsSystemDevicePath :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@devicePath@/: a device path, e.g. @\/dev\/loop0@ or @nfsd@ -> m Bool -- ^ __Returns:__ 'P.True' if /@devicePath@/ is considered an implementation detail of -- the OS. unixIsSystemDevicePath :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool unixIsSystemDevicePath Text devicePath = IO Bool -> m Bool forall a. IO a -> m a 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 devicePath' <- Text -> IO CString textToCString Text devicePath result <- g_unix_is_system_device_path devicePath' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem devicePath' return result' -- function unix_is_mount_path_system_internal -- Args: [ Arg -- { argCName = "mount_path" -- , argType = TBasicType TFileName -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a mount path, e.g. `/media/disk` or `/usr`" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_unix_is_mount_path_system_internal" g_unix_is_mount_path_system_internal :: CString -> -- mount_path : TBasicType TFileName IO CInt -- | Determines if /@mountPath@/ is considered an implementation of the -- OS. This is primarily used for hiding mountable and mounted volumes -- that only are used in the OS and has little to no relevance to the -- casual user. unixIsMountPathSystemInternal :: (B.CallStack.HasCallStack, MonadIO m) => [Char] -- ^ /@mountPath@/: a mount path, e.g. @\/media\/disk@ or @\/usr@ -> m Bool -- ^ __Returns:__ 'P.True' if /@mountPath@/ is considered an implementation detail -- of the OS. unixIsMountPathSystemInternal :: forall (m :: * -> *). (HasCallStack, MonadIO m) => String -> m Bool unixIsMountPathSystemInternal String mountPath = IO Bool -> m Bool forall a. IO a -> m a 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 mountPath' <- String -> IO CString stringToCString String mountPath result <- g_unix_is_mount_path_system_internal mountPath' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem mountPath' return result' -- function simple_async_report_gerror_in_idle -- Args: [ Arg -- { argCName = "object" -- , argType = -- TInterface Name { namespace = "GObject" , name = "Object" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "a #GObject, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "callback" -- , argType = -- TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "a #GAsyncReadyCallback." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeAsync -- , argClosure = 2 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "user_data" -- , argType = TBasicType TPtr -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "user data passed to @callback." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "error" -- , argType = TError -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the #GError to report" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_simple_async_report_gerror_in_idle" g_simple_async_report_gerror_in_idle :: Ptr GObject.Object.Object -> -- object : TInterface (Name {namespace = "GObject", name = "Object"}) FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}) Ptr () -> -- user_data : TBasicType TPtr Ptr GError -> -- error : TError IO () {-# DEPRECATED simpleAsyncReportGerrorInIdle ["(Since version 2.46)","Use 'GI.Gio.Objects.Task.taskReportError'."] #-} -- | Reports an error in an idle function. Similar to -- @/g_simple_async_report_error_in_idle()/@, but takes a t'GError' rather -- than building a new one. simpleAsyncReportGerrorInIdle :: (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a) => Maybe (a) -- ^ /@object@/: a t'GI.GObject.Objects.Object.Object', or 'P.Nothing' -> Maybe (Gio.Callbacks.AsyncReadyCallback) -- ^ /@callback@/: a t'GI.Gio.Callbacks.AsyncReadyCallback'. -> GError -- ^ /@error@/: the t'GError' to report -> m () simpleAsyncReportGerrorInIdle :: forall (m :: * -> *) a. (HasCallStack, MonadIO m, IsObject a) => Maybe a -> Maybe AsyncReadyCallback -> GError -> m () simpleAsyncReportGerrorInIdle Maybe a object Maybe AsyncReadyCallback callback GError error_ = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do maybeObject <- case Maybe a object of Maybe a Nothing -> Ptr Object -> IO (Ptr Object) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr Object forall a. Ptr a FP.nullPtr Just a jObject -> do jObject' <- a -> IO (Ptr Object) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a jObject return jObject' maybeCallback <- case callback of Maybe AsyncReadyCallback Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return FunPtr C_AsyncReadyCallback forall a. FunPtr a FP.nullFunPtr Just AsyncReadyCallback jCallback -> do ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback)) forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback)) jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback)) poke ptrcallback jCallback' return jCallback' error_' <- unsafeManagedPtrGetPtr error_ let userData = Ptr a forall a. Ptr a nullPtr g_simple_async_report_gerror_in_idle maybeObject maybeCallback userData error_' whenJust object touchManagedPtr touchManagedPtr error_ return () -- function resources_unregister -- Args: [ Arg -- { argCName = "resource" -- , argType = -- TInterface Name { namespace = "Gio" , name = "Resource" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A #GResource" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_resources_unregister" g_resources_unregister :: Ptr Gio.Resource.Resource -> -- resource : TInterface (Name {namespace = "Gio", name = "Resource"}) IO () -- | Unregisters the resource from the process-global set of resources. -- -- /Since: 2.32/ resourcesUnregister :: (B.CallStack.HasCallStack, MonadIO m) => Gio.Resource.Resource -- ^ /@resource@/: A t'GI.Gio.Structs.Resource.Resource' -> m () resourcesUnregister :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Resource -> m () resourcesUnregister Resource resource = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do resource' <- Resource -> IO (Ptr Resource) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Resource resource g_resources_unregister resource' touchManagedPtr resource return () -- function resources_register -- Args: [ Arg -- { argCName = "resource" -- , argType = -- TInterface Name { namespace = "Gio" , name = "Resource" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A #GResource" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_resources_register" g_resources_register :: Ptr Gio.Resource.Resource -> -- resource : TInterface (Name {namespace = "Gio", name = "Resource"}) IO () -- | Registers the resource with the process-global set of resources. -- Once a resource is registered the files in it can be accessed -- with the global resource lookup functions like 'GI.Gio.Functions.resourcesLookupData'. -- -- /Since: 2.32/ resourcesRegister :: (B.CallStack.HasCallStack, MonadIO m) => Gio.Resource.Resource -- ^ /@resource@/: A t'GI.Gio.Structs.Resource.Resource' -> m () resourcesRegister :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Resource -> m () resourcesRegister Resource resource = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do resource' <- Resource -> IO (Ptr Resource) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Resource resource g_resources_register resource' touchManagedPtr resource return () -- function resources_open_stream -- Args: [ Arg -- { argCName = "path" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A pathname inside the resource" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "lookup_flags" -- , argType = -- TInterface -- Name { namespace = "Gio" , name = "ResourceLookupFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A #GResourceLookupFlags" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "Gio" , name = "InputStream" }) -- throws : True -- Skip return : False foreign import ccall "g_resources_open_stream" g_resources_open_stream :: CString -> -- path : TBasicType TUTF8 CUInt -> -- lookup_flags : TInterface (Name {namespace = "Gio", name = "ResourceLookupFlags"}) Ptr (Ptr GError) -> -- error IO (Ptr Gio.InputStream.InputStream) -- | Looks for a file at the specified /@path@/ in the set of -- globally registered resources and returns a t'GI.Gio.Objects.InputStream.InputStream' -- that lets you read the data. -- -- /@lookupFlags@/ controls the behaviour of the lookup. -- -- /Since: 2.32/ resourcesOpenStream :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@path@/: A pathname inside the resource -> [Gio.Flags.ResourceLookupFlags] -- ^ /@lookupFlags@/: A t'GI.Gio.Flags.ResourceLookupFlags' -> m Gio.InputStream.InputStream -- ^ __Returns:__ t'GI.Gio.Objects.InputStream.InputStream' or 'P.Nothing' on error. -- Free the returned object with 'GI.GObject.Objects.Object.objectUnref' /(Can throw 'Data.GI.Base.GError.GError')/ resourcesOpenStream :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> [ResourceLookupFlags] -> m InputStream resourcesOpenStream Text path [ResourceLookupFlags] lookupFlags = IO InputStream -> m InputStream forall a. IO a -> m a 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 path' <- Text -> IO CString textToCString Text path let lookupFlags' = [ResourceLookupFlags] -> CUInt forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [ResourceLookupFlags] lookupFlags onException (do result <- propagateGError $ g_resources_open_stream path' lookupFlags' checkUnexpectedReturnNULL "resourcesOpenStream" result result' <- (wrapObject Gio.InputStream.InputStream) result freeMem path' return result' ) (do freeMem path' ) -- function resources_lookup_data -- Args: [ Arg -- { argCName = "path" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A pathname inside the resource" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "lookup_flags" -- , argType = -- TInterface -- Name { namespace = "Gio" , name = "ResourceLookupFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A #GResourceLookupFlags" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "Bytes" }) -- throws : True -- Skip return : False foreign import ccall "g_resources_lookup_data" g_resources_lookup_data :: CString -> -- path : TBasicType TUTF8 CUInt -> -- lookup_flags : TInterface (Name {namespace = "Gio", name = "ResourceLookupFlags"}) Ptr (Ptr GError) -> -- error IO (Ptr GLib.Bytes.Bytes) -- | Looks for a file at the specified /@path@/ in the set of -- globally registered resources and returns a t'GI.GLib.Structs.Bytes.Bytes' that -- lets you directly access the data in memory. -- -- The data is always followed by a zero byte, so you -- can safely use the data as a C string. However, that byte -- is not included in the size of the GBytes. -- -- For uncompressed resource files this is a pointer directly into -- the resource bundle, which is typically in some readonly data section -- in the program binary. For compressed files we allocate memory on -- the heap and automatically uncompress the data. -- -- /@lookupFlags@/ controls the behaviour of the lookup. -- -- /Since: 2.32/ resourcesLookupData :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@path@/: A pathname inside the resource -> [Gio.Flags.ResourceLookupFlags] -- ^ /@lookupFlags@/: A t'GI.Gio.Flags.ResourceLookupFlags' -> m GLib.Bytes.Bytes -- ^ __Returns:__ t'GI.GLib.Structs.Bytes.Bytes' or 'P.Nothing' on error. -- Free the returned object with 'GI.GLib.Structs.Bytes.bytesUnref' /(Can throw 'Data.GI.Base.GError.GError')/ resourcesLookupData :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> [ResourceLookupFlags] -> m Bytes resourcesLookupData Text path [ResourceLookupFlags] lookupFlags = IO Bytes -> m Bytes forall a. IO a -> m a 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 path' <- Text -> IO CString textToCString Text path let lookupFlags' = [ResourceLookupFlags] -> CUInt forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [ResourceLookupFlags] lookupFlags onException (do result <- propagateGError $ g_resources_lookup_data path' lookupFlags' checkUnexpectedReturnNULL "resourcesLookupData" result result' <- (wrapBoxed GLib.Bytes.Bytes) result freeMem path' return result' ) (do freeMem path' ) -- function resources_get_info -- Args: [ Arg -- { argCName = "path" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A pathname inside the resource" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "lookup_flags" -- , argType = -- TInterface -- Name { namespace = "Gio" , name = "ResourceLookupFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A #GResourceLookupFlags" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "size" -- , argType = TBasicType TSize -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "a location to place the length of the contents of the file,\n or %NULL if the length is not needed" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "flags" -- , argType = TBasicType TUInt32 -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "a location to place the #GResourceFlags about the file,\n or %NULL if the flags are not needed" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "g_resources_get_info" g_resources_get_info :: CString -> -- path : TBasicType TUTF8 CUInt -> -- lookup_flags : TInterface (Name {namespace = "Gio", name = "ResourceLookupFlags"}) Ptr FCT.CSize -> -- size : TBasicType TSize Ptr Word32 -> -- flags : TBasicType TUInt32 Ptr (Ptr GError) -> -- error IO CInt -- | Looks for a file at the specified /@path@/ in the set of -- globally registered resources and if found returns information about it. -- -- /@lookupFlags@/ controls the behaviour of the lookup. -- -- /Since: 2.32/ resourcesGetInfo :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@path@/: A pathname inside the resource -> [Gio.Flags.ResourceLookupFlags] -- ^ /@lookupFlags@/: A t'GI.Gio.Flags.ResourceLookupFlags' -> m ((FCT.CSize, Word32)) -- ^ /(Can throw 'Data.GI.Base.GError.GError')/ resourcesGetInfo :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> [ResourceLookupFlags] -> m (CSize, Word32) resourcesGetInfo Text path [ResourceLookupFlags] lookupFlags = IO (CSize, Word32) -> m (CSize, Word32) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (CSize, Word32) -> m (CSize, Word32)) -> IO (CSize, Word32) -> m (CSize, Word32) forall a b. (a -> b) -> a -> b $ do path' <- Text -> IO CString textToCString Text path let lookupFlags' = [ResourceLookupFlags] -> CUInt forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [ResourceLookupFlags] lookupFlags size <- allocMem :: IO (Ptr FCT.CSize) flags <- allocMem :: IO (Ptr Word32) onException (do _ <- propagateGError $ g_resources_get_info path' lookupFlags' size flags size' <- peek size flags' <- peek flags freeMem path' freeMem size freeMem flags return (size', flags') ) (do freeMem path' freeMem size freeMem flags ) -- function resources_enumerate_children -- Args: [ Arg -- { argCName = "path" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A pathname inside the resource" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "lookup_flags" -- , argType = -- TInterface -- Name { namespace = "Gio" , name = "ResourceLookupFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A #GResourceLookupFlags" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8)) -- throws : True -- Skip return : False foreign import ccall "g_resources_enumerate_children" g_resources_enumerate_children :: CString -> -- path : TBasicType TUTF8 CUInt -> -- lookup_flags : TInterface (Name {namespace = "Gio", name = "ResourceLookupFlags"}) Ptr (Ptr GError) -> -- error IO (Ptr CString) -- | Returns all the names of children at the specified /@path@/ in the set of -- globally registered resources. -- The return result is a 'P.Nothing' terminated list of strings which should -- be released with 'GI.GLib.Functions.strfreev'. -- -- /@lookupFlags@/ controls the behaviour of the lookup. -- -- /Since: 2.32/ resourcesEnumerateChildren :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@path@/: A pathname inside the resource -> [Gio.Flags.ResourceLookupFlags] -- ^ /@lookupFlags@/: A t'GI.Gio.Flags.ResourceLookupFlags' -> m [T.Text] -- ^ __Returns:__ an array of constant strings /(Can throw 'Data.GI.Base.GError.GError')/ resourcesEnumerateChildren :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> [ResourceLookupFlags] -> m [Text] resourcesEnumerateChildren Text path [ResourceLookupFlags] lookupFlags = IO [Text] -> m [Text] forall a. IO a -> m a 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 path' <- Text -> IO CString textToCString Text path let lookupFlags' = [ResourceLookupFlags] -> CUInt forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [ResourceLookupFlags] lookupFlags onException (do result <- propagateGError $ g_resources_enumerate_children path' lookupFlags' checkUnexpectedReturnNULL "resourcesEnumerateChildren" result result' <- unpackZeroTerminatedUTF8CArray result mapZeroTerminatedCArray freeMem result freeMem result freeMem path' return result' ) (do freeMem path' ) -- function pollable_stream_write_all -- Args: [ Arg -- { argCName = "stream" -- , argType = -- TInterface Name { namespace = "Gio" , name = "OutputStream" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GOutputStream." , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "buffer" -- , argType = TCArray False (-1) 2 (TBasicType TUInt8) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the buffer\n containing the data to write." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "count" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the number of bytes to write" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "blocking" -- , argType = TBasicType TBoolean -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "whether to do blocking I/O" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "bytes_written" -- , argType = TBasicType TSize -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "location to store the number of bytes that was\n written to the stream" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "cancellable" -- , argType = -- TInterface Name { namespace = "Gio" , name = "Cancellable" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "optional #GCancellable object, %NULL to ignore." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "count" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the number of bytes to write" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "g_pollable_stream_write_all" g_pollable_stream_write_all :: Ptr Gio.OutputStream.OutputStream -> -- stream : TInterface (Name {namespace = "Gio", name = "OutputStream"}) Ptr Word8 -> -- buffer : TCArray False (-1) 2 (TBasicType TUInt8) FCT.CSize -> -- count : TBasicType TSize CInt -> -- blocking : TBasicType TBoolean Ptr FCT.CSize -> -- bytes_written : TBasicType TSize Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) Ptr (Ptr GError) -> -- error IO CInt -- | Tries to write /@count@/ bytes to /@stream@/, as with -- 'GI.Gio.Objects.OutputStream.outputStreamWriteAll', but using 'GI.Gio.Functions.pollableStreamWrite' -- rather than 'GI.Gio.Objects.OutputStream.outputStreamWrite'. -- -- On a successful write of /@count@/ bytes, 'P.True' is returned, and -- /@bytesWritten@/ is set to /@count@/. -- -- If there is an error during the operation (including -- 'GI.Gio.Enums.IOErrorEnumWouldBlock' in the non-blocking case), 'P.False' is -- returned and /@error@/ is set to indicate the error status, -- /@bytesWritten@/ is updated to contain the number of bytes written -- into the stream before the error occurred. -- -- As with 'GI.Gio.Functions.pollableStreamWrite', if /@blocking@/ is 'P.False', then -- /@stream@/ must be a t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream' for which -- 'GI.Gio.Interfaces.PollableOutputStream.pollableOutputStreamCanPoll' returns 'P.True' or else the -- behavior is undefined. If /@blocking@/ is 'P.True', then /@stream@/ does not -- need to be a t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream'. -- -- /Since: 2.34/ pollableStreamWriteAll :: (B.CallStack.HasCallStack, MonadIO m, Gio.OutputStream.IsOutputStream a, Gio.Cancellable.IsCancellable b) => a -- ^ /@stream@/: a t'GI.Gio.Objects.OutputStream.OutputStream'. -> ByteString -- ^ /@buffer@/: the buffer -- containing the data to write. -> Bool -- ^ /@blocking@/: whether to do blocking I\/O -> Maybe (b) -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore. -> m (FCT.CSize) -- ^ /(Can throw 'Data.GI.Base.GError.GError')/ pollableStreamWriteAll :: forall (m :: * -> *) a b. (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> ByteString -> Bool -> Maybe b -> m CSize pollableStreamWriteAll a stream ByteString buffer Bool blocking Maybe b cancellable = IO CSize -> m CSize forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO CSize -> m CSize) -> IO CSize -> m CSize forall a b. (a -> b) -> a -> b $ do let count :: CSize count = Int -> CSize forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CSize) -> Int -> CSize forall a b. (a -> b) -> a -> b $ ByteString -> Int B.length ByteString buffer stream' <- a -> IO (Ptr OutputStream) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a stream buffer' <- packByteString buffer let blocking' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.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 P.fromEnum) Bool blocking bytesWritten <- allocMem :: IO (Ptr FCT.CSize) maybeCancellable <- case cancellable of Maybe b Nothing -> Ptr Cancellable -> IO (Ptr Cancellable) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr Cancellable forall a. Ptr a FP.nullPtr Just b jCancellable -> do jCancellable' <- b -> IO (Ptr Cancellable) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr b jCancellable return jCancellable' onException (do _ <- propagateGError $ g_pollable_stream_write_all stream' buffer' count blocking' bytesWritten maybeCancellable bytesWritten' <- peek bytesWritten touchManagedPtr stream whenJust cancellable touchManagedPtr freeMem buffer' freeMem bytesWritten return bytesWritten' ) (do freeMem buffer' freeMem bytesWritten ) -- function pollable_stream_write -- Args: [ Arg -- { argCName = "stream" -- , argType = -- TInterface Name { namespace = "Gio" , name = "OutputStream" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GOutputStream." , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "buffer" -- , argType = TCArray False (-1) 2 (TBasicType TUInt8) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the buffer\n containing the data to write." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "count" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the number of bytes to write" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "blocking" -- , argType = TBasicType TBoolean -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "whether to do blocking I/O" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "cancellable" -- , argType = -- TInterface Name { namespace = "Gio" , name = "Cancellable" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "optional #GCancellable object, %NULL to ignore." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "count" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the number of bytes to write" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TSSize) -- throws : True -- Skip return : False foreign import ccall "g_pollable_stream_write" g_pollable_stream_write :: Ptr Gio.OutputStream.OutputStream -> -- stream : TInterface (Name {namespace = "Gio", name = "OutputStream"}) Ptr Word8 -> -- buffer : TCArray False (-1) 2 (TBasicType TUInt8) FCT.CSize -> -- count : TBasicType TSize CInt -> -- blocking : TBasicType TBoolean Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) Ptr (Ptr GError) -> -- error IO DI.Int64 -- | Tries to write to /@stream@/, as with 'GI.Gio.Objects.OutputStream.outputStreamWrite' (if -- /@blocking@/ is 'P.True') or 'GI.Gio.Interfaces.PollableOutputStream.pollableOutputStreamWriteNonblocking' -- (if /@blocking@/ is 'P.False'). This can be used to more easily share -- code between blocking and non-blocking implementations of a method. -- -- If /@blocking@/ is 'P.False', then /@stream@/ must be a -- t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream' for which -- 'GI.Gio.Interfaces.PollableOutputStream.pollableOutputStreamCanPoll' returns 'P.True' or else the -- behavior is undefined. If /@blocking@/ is 'P.True', then /@stream@/ does not -- need to be a t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream'. -- -- /Since: 2.34/ pollableStreamWrite :: (B.CallStack.HasCallStack, MonadIO m, Gio.OutputStream.IsOutputStream a, Gio.Cancellable.IsCancellable b) => a -- ^ /@stream@/: a t'GI.Gio.Objects.OutputStream.OutputStream'. -> ByteString -- ^ /@buffer@/: the buffer -- containing the data to write. -> Bool -- ^ /@blocking@/: whether to do blocking I\/O -> Maybe (b) -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore. -> m DI.Int64 -- ^ __Returns:__ the number of bytes written, or -1 on error. /(Can throw 'Data.GI.Base.GError.GError')/ pollableStreamWrite :: forall (m :: * -> *) a b. (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> ByteString -> Bool -> Maybe b -> m Int64 pollableStreamWrite a stream ByteString buffer Bool blocking Maybe b cancellable = IO Int64 -> m Int64 forall a. IO a -> m a 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 :: CSize count = Int -> CSize forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CSize) -> Int -> CSize forall a b. (a -> b) -> a -> b $ ByteString -> Int B.length ByteString buffer stream' <- a -> IO (Ptr OutputStream) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a stream buffer' <- packByteString buffer let blocking' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.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 P.fromEnum) Bool blocking maybeCancellable <- case cancellable of Maybe b Nothing -> Ptr Cancellable -> IO (Ptr Cancellable) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr Cancellable forall a. Ptr a FP.nullPtr Just b jCancellable -> do jCancellable' <- b -> IO (Ptr Cancellable) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr b jCancellable return jCancellable' onException (do result <- propagateGError $ g_pollable_stream_write stream' buffer' count blocking' maybeCancellable touchManagedPtr stream whenJust cancellable touchManagedPtr freeMem buffer' return result ) (do freeMem buffer' ) -- function pollable_stream_read -- Args: [ Arg -- { argCName = "stream" -- , argType = -- TInterface Name { namespace = "Gio" , name = "InputStream" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GInputStream" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "buffer" -- , argType = TCArray False (-1) 2 (TBasicType TUInt8) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a buffer to\n read data into" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "count" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the number of bytes to read" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "blocking" -- , argType = TBasicType TBoolean -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "whether to do blocking I/O" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "cancellable" -- , argType = -- TInterface Name { namespace = "Gio" , name = "Cancellable" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "optional #GCancellable object, %NULL to ignore." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "count" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the number of bytes to read" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TSSize) -- throws : True -- Skip return : False foreign import ccall "g_pollable_stream_read" g_pollable_stream_read :: Ptr Gio.InputStream.InputStream -> -- stream : TInterface (Name {namespace = "Gio", name = "InputStream"}) Ptr Word8 -> -- buffer : TCArray False (-1) 2 (TBasicType TUInt8) FCT.CSize -> -- count : TBasicType TSize CInt -> -- blocking : TBasicType TBoolean Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) Ptr (Ptr GError) -> -- error IO DI.Int64 -- | Tries to read from /@stream@/, as with 'GI.Gio.Objects.InputStream.inputStreamRead' (if -- /@blocking@/ is 'P.True') or 'GI.Gio.Interfaces.PollableInputStream.pollableInputStreamReadNonblocking' -- (if /@blocking@/ is 'P.False'). This can be used to more easily share -- code between blocking and non-blocking implementations of a method. -- -- If /@blocking@/ is 'P.False', then /@stream@/ must be a -- t'GI.Gio.Interfaces.PollableInputStream.PollableInputStream' for which 'GI.Gio.Interfaces.PollableInputStream.pollableInputStreamCanPoll' -- returns 'P.True', or else the behavior is undefined. If /@blocking@/ is -- 'P.True', then /@stream@/ does not need to be a t'GI.Gio.Interfaces.PollableInputStream.PollableInputStream'. -- -- /Since: 2.34/ pollableStreamRead :: (B.CallStack.HasCallStack, MonadIO m, Gio.InputStream.IsInputStream a, Gio.Cancellable.IsCancellable b) => a -- ^ /@stream@/: a t'GI.Gio.Objects.InputStream.InputStream' -> ByteString -- ^ /@buffer@/: a buffer to -- read data into -> Bool -- ^ /@blocking@/: whether to do blocking I\/O -> Maybe (b) -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore. -> m DI.Int64 -- ^ __Returns:__ the number of bytes read, or -1 on error. /(Can throw 'Data.GI.Base.GError.GError')/ pollableStreamRead :: forall (m :: * -> *) a b. (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) => a -> ByteString -> Bool -> Maybe b -> m Int64 pollableStreamRead a stream ByteString buffer Bool blocking Maybe b cancellable = IO Int64 -> m Int64 forall a. IO a -> m a 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 :: CSize count = Int -> CSize forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CSize) -> Int -> CSize forall a b. (a -> b) -> a -> b $ ByteString -> Int B.length ByteString buffer stream' <- a -> IO (Ptr InputStream) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a stream buffer' <- packByteString buffer let blocking' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b P.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 P.fromEnum) Bool blocking maybeCancellable <- case cancellable of Maybe b Nothing -> Ptr Cancellable -> IO (Ptr Cancellable) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr Cancellable forall a. Ptr a FP.nullPtr Just b jCancellable -> do jCancellable' <- b -> IO (Ptr Cancellable) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr b jCancellable return jCancellable' onException (do result <- propagateGError $ g_pollable_stream_read stream' buffer' count blocking' maybeCancellable touchManagedPtr stream whenJust cancellable touchManagedPtr freeMem buffer' return result ) (do freeMem buffer' ) -- function pollable_source_new_full -- Args: [ Arg -- { argCName = "pollable_stream" -- , argType = -- TInterface Name { namespace = "GObject" , name = "Object" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the stream associated with the\n new source" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "child_source" -- , argType = -- TInterface Name { namespace = "GLib" , name = "Source" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "optional child source to attach" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "cancellable" -- , argType = -- TInterface Name { namespace = "Gio" , name = "Cancellable" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "optional #GCancellable to attach" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "Source" }) -- throws : False -- Skip return : False foreign import ccall "g_pollable_source_new_full" g_pollable_source_new_full :: Ptr GObject.Object.Object -> -- pollable_stream : TInterface (Name {namespace = "GObject", name = "Object"}) Ptr GLib.Source.Source -> -- child_source : TInterface (Name {namespace = "GLib", name = "Source"}) Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) IO (Ptr GLib.Source.Source) -- | Utility method for t'GI.Gio.Interfaces.PollableInputStream.PollableInputStream' and t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream' -- implementations. Creates a new t'GI.GLib.Structs.Source.Source', as with -- 'GI.Gio.Functions.pollableSourceNew', but also attaching /@childSource@/ (with a -- dummy callback), and /@cancellable@/, if they are non-'P.Nothing'. -- -- /Since: 2.34/ pollableSourceNewFull :: (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a, Gio.Cancellable.IsCancellable b) => a -- ^ /@pollableStream@/: the stream associated with the -- new source -> Maybe (GLib.Source.Source) -- ^ /@childSource@/: optional child source to attach -> Maybe (b) -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' to attach -> m GLib.Source.Source -- ^ __Returns:__ the new t'GI.GLib.Structs.Source.Source'. pollableSourceNewFull :: forall (m :: * -> *) a b. (HasCallStack, MonadIO m, IsObject a, IsCancellable b) => a -> Maybe Source -> Maybe b -> m Source pollableSourceNewFull a pollableStream Maybe Source childSource Maybe b cancellable = IO Source -> m Source forall a. IO a -> m a 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 pollableStream' <- a -> IO (Ptr Object) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a pollableStream maybeChildSource <- case childSource of Maybe Source Nothing -> Ptr Source -> IO (Ptr Source) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr Source forall a. Ptr a FP.nullPtr Just Source jChildSource -> do jChildSource' <- Source -> IO (Ptr Source) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Source jChildSource return jChildSource' maybeCancellable <- case cancellable of Maybe b Nothing -> Ptr Cancellable -> IO (Ptr Cancellable) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr Cancellable forall a. Ptr a FP.nullPtr Just b jCancellable -> do jCancellable' <- b -> IO (Ptr Cancellable) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr b jCancellable return jCancellable' result <- g_pollable_source_new_full pollableStream' maybeChildSource maybeCancellable checkUnexpectedReturnNULL "pollableSourceNewFull" result result' <- (wrapBoxed GLib.Source.Source) result touchManagedPtr pollableStream whenJust childSource touchManagedPtr whenJust cancellable touchManagedPtr return result' -- function pollable_source_new -- Args: [ Arg -- { argCName = "pollable_stream" -- , argType = -- TInterface Name { namespace = "GObject" , name = "Object" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the stream associated with the new source" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "Source" }) -- throws : False -- Skip return : False foreign import ccall "g_pollable_source_new" g_pollable_source_new :: Ptr GObject.Object.Object -> -- pollable_stream : TInterface (Name {namespace = "GObject", name = "Object"}) IO (Ptr GLib.Source.Source) -- | Utility method for t'GI.Gio.Interfaces.PollableInputStream.PollableInputStream' and t'GI.Gio.Interfaces.PollableOutputStream.PollableOutputStream' -- implementations. Creates a new t'GI.GLib.Structs.Source.Source' that expects a callback of -- type t'GI.Gio.Callbacks.PollableSourceFunc'. The new source does not actually do -- anything on its own; use 'GI.GLib.Structs.Source.sourceAddChildSource' to add other -- sources to it to cause it to trigger. -- -- /Since: 2.28/ pollableSourceNew :: (B.CallStack.HasCallStack, MonadIO m, GObject.Object.IsObject a) => a -- ^ /@pollableStream@/: the stream associated with the new source -> m GLib.Source.Source -- ^ __Returns:__ the new t'GI.GLib.Structs.Source.Source'. pollableSourceNew :: forall (m :: * -> *) a. (HasCallStack, MonadIO m, IsObject a) => a -> m Source pollableSourceNew a pollableStream = IO Source -> m Source forall a. IO a -> m a 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 pollableStream' <- a -> IO (Ptr Object) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a pollableStream result <- g_pollable_source_new pollableStream' checkUnexpectedReturnNULL "pollableSourceNew" result result' <- (wrapBoxed GLib.Source.Source) result touchManagedPtr pollableStream return result' -- function null_settings_backend_new -- Args: [] -- Lengths: [] -- returnType: Just -- (TInterface Name { namespace = "Gio" , name = "SettingsBackend" }) -- throws : False -- Skip return : False foreign import ccall "g_null_settings_backend_new" g_null_settings_backend_new :: IO (Ptr Gio.SettingsBackend.SettingsBackend) -- | Creates a readonly t'GI.Gio.Objects.SettingsBackend.SettingsBackend'. -- -- This backend does not allow changes to settings, so all settings -- will always have their default values. -- -- /Since: 2.28/ nullSettingsBackendNew :: (B.CallStack.HasCallStack, MonadIO m) => m Gio.SettingsBackend.SettingsBackend -- ^ __Returns:__ a newly created t'GI.Gio.Objects.SettingsBackend.SettingsBackend' nullSettingsBackendNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m SettingsBackend nullSettingsBackendNew = IO SettingsBackend -> m SettingsBackend forall a. IO a -> m a 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 result <- IO (Ptr SettingsBackend) g_null_settings_backend_new checkUnexpectedReturnNULL "nullSettingsBackendNew" result result' <- (wrapObject Gio.SettingsBackend.SettingsBackend) result return result' -- function networking_init -- Args: [] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_networking_init" g_networking_init :: IO () -- | Initializes the platform networking libraries (eg, on Windows, this -- calls @/WSAStartup()/@). GLib will call this itself if it is needed, so -- you only need to call it if you directly call system networking -- functions (without calling any GLib networking functions first). -- -- /Since: 2.36/ networkingInit :: (B.CallStack.HasCallStack, MonadIO m) => m () networkingInit :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m () networkingInit = IO () -> m () forall a. IO a -> m a 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 a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return () -- function memory_settings_backend_new -- Args: [] -- Lengths: [] -- returnType: Just -- (TInterface Name { namespace = "Gio" , name = "SettingsBackend" }) -- throws : False -- Skip return : False foreign import ccall "g_memory_settings_backend_new" g_memory_settings_backend_new :: IO (Ptr Gio.SettingsBackend.SettingsBackend) -- | Creates a memory-backed t'GI.Gio.Objects.SettingsBackend.SettingsBackend'. -- -- This backend allows changes to settings, but does not write them -- to any backing storage, so the next time you run your application, -- the memory backend will start out with the default values again. -- -- /Since: 2.28/ memorySettingsBackendNew :: (B.CallStack.HasCallStack, MonadIO m) => m Gio.SettingsBackend.SettingsBackend -- ^ __Returns:__ a newly created t'GI.Gio.Objects.SettingsBackend.SettingsBackend' memorySettingsBackendNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m SettingsBackend memorySettingsBackendNew = IO SettingsBackend -> m SettingsBackend forall a. IO a -> m a 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 result <- IO (Ptr SettingsBackend) g_memory_settings_backend_new checkUnexpectedReturnNULL "memorySettingsBackendNew" result result' <- (wrapObject Gio.SettingsBackend.SettingsBackend) result return result' -- function keyfile_settings_backend_new -- Args: [ Arg -- { argCName = "filename" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the filename of the keyfile" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "root_path" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the path under which all settings keys appear" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "root_group" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the group name corresponding to\n @root_path, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just -- (TInterface Name { namespace = "Gio" , name = "SettingsBackend" }) -- throws : False -- Skip return : False foreign import ccall "g_keyfile_settings_backend_new" g_keyfile_settings_backend_new :: CString -> -- filename : TBasicType TUTF8 CString -> -- root_path : TBasicType TUTF8 CString -> -- root_group : TBasicType TUTF8 IO (Ptr Gio.SettingsBackend.SettingsBackend) -- | Creates a keyfile-backed t'GI.Gio.Objects.SettingsBackend.SettingsBackend'. -- -- The filename of the keyfile to use is given by /@filename@/. -- -- All settings read to or written from the backend must fall under the -- path given in /@rootPath@/ (which must start and end with a slash and -- not contain two consecutive slashes). /@rootPath@/ may be \"\/\". -- -- If /@rootGroup@/ is non-'P.Nothing' then it specifies the name of the keyfile -- group used for keys that are written directly below /@rootPath@/. For -- example, if /@rootPath@/ is \"\/apps\/example\/\" and /@rootGroup@/ is -- \"toplevel\", then settings the key \"\/apps\/example\/enabled\" to a value -- of 'P.True' will cause the following to appear in the keyfile: -- -- > -- > [toplevel] -- > enabled=true -- -- -- If /@rootGroup@/ is 'P.Nothing' then it is not permitted to store keys -- directly below the /@rootPath@/. -- -- For keys not stored directly below /@rootPath@/ (ie: in a sub-path), -- the name of the subpath (with the final slash stripped) is used as -- the name of the keyfile group. To continue the example, if -- \"\/apps\/example\/profiles\/default\/font-size\" were set to -- 12 then the following would appear in the keyfile: -- -- > -- > [profiles/default] -- > font-size=12 -- -- -- The backend will refuse writes (and return writability as being -- 'P.False') for keys outside of /@rootPath@/ and, in the event that -- /@rootGroup@/ is 'P.Nothing', also for keys directly under /@rootPath@/. -- Writes will also be refused if the backend detects that it has the -- inability to rewrite the keyfile (ie: the containing directory is not -- writable). -- -- There is no checking done for your key namespace clashing with the -- syntax of the key file format. For example, if you have \'[\' or \']\' -- characters in your path names or \'=\' in your key names you may be in -- trouble. -- -- The backend reads default values from a keyfile called @defaults@ in -- the directory specified by the @/GKeyfileSettingsBackend:defaults-dir/@ property, -- and a list of locked keys from a text file with the name @locks@ in -- the same location. keyfileSettingsBackendNew :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@filename@/: the filename of the keyfile -> T.Text -- ^ /@rootPath@/: the path under which all settings keys appear -> Maybe (T.Text) -- ^ /@rootGroup@/: the group name corresponding to -- /@rootPath@/, or 'P.Nothing' -> m Gio.SettingsBackend.SettingsBackend -- ^ __Returns:__ a keyfile-backed t'GI.Gio.Objects.SettingsBackend.SettingsBackend' keyfileSettingsBackendNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Text -> Maybe Text -> m SettingsBackend keyfileSettingsBackendNew Text filename Text rootPath Maybe Text rootGroup = IO SettingsBackend -> m SettingsBackend forall a. IO a -> m a 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 filename' <- Text -> IO CString textToCString Text filename rootPath' <- textToCString rootPath maybeRootGroup <- case rootGroup of Maybe Text Nothing -> CString -> IO CString forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return CString forall a. Ptr a FP.nullPtr Just Text jRootGroup -> do jRootGroup' <- Text -> IO CString textToCString Text jRootGroup return jRootGroup' result <- g_keyfile_settings_backend_new filename' rootPath' maybeRootGroup checkUnexpectedReturnNULL "keyfileSettingsBackendNew" result result' <- (wrapObject Gio.SettingsBackend.SettingsBackend) result freeMem filename' freeMem rootPath' freeMem maybeRootGroup return result' -- function io_scheduler_push_job -- Args: [ Arg -- { argCName = "job_func" -- , argType = -- TInterface Name { namespace = "Gio" , name = "IOSchedulerJobFunc" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GIOSchedulerJobFunc." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeNotified -- , argClosure = 1 -- , argDestroy = 2 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "user_data" -- , argType = TBasicType TPtr -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "data to pass to @job_func" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "notify" -- , argType = -- TInterface Name { namespace = "GLib" , name = "DestroyNotify" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "a #GDestroyNotify for @user_data, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeAsync -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "io_priority" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "the [I/O priority][io-priority]\nof the request." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "cancellable" -- , argType = -- TInterface Name { namespace = "Gio" , name = "Cancellable" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "optional #GCancellable object, %NULL to ignore." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_io_scheduler_push_job" g_io_scheduler_push_job :: FunPtr Gio.Callbacks.C_IOSchedulerJobFunc -> -- job_func : TInterface (Name {namespace = "Gio", name = "IOSchedulerJobFunc"}) Ptr () -> -- user_data : TBasicType TPtr FunPtr GLib.Callbacks.C_DestroyNotify -> -- notify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"}) Int32 -> -- io_priority : TBasicType TInt Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) IO () {-# DEPRECATED ioSchedulerPushJob ["(Since version 2.36)","use t'GI.GLib.Structs.ThreadPool.ThreadPool' or 'GI.Gio.Objects.Task.taskRunInThread'"] #-} -- | Schedules the I\/O job to run in another thread. -- -- /@notify@/ will be called on /@userData@/ after /@jobFunc@/ has returned, -- regardless whether the job was cancelled or has run to completion. -- -- If /@cancellable@/ is not 'P.Nothing', it can be used to cancel the I\/O job -- by calling 'GI.Gio.Objects.Cancellable.cancellableCancel' or by calling -- 'GI.Gio.Functions.ioSchedulerCancelAllJobs'. ioSchedulerPushJob :: (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) => Gio.Callbacks.IOSchedulerJobFunc -- ^ /@jobFunc@/: a t'GI.Gio.Callbacks.IOSchedulerJobFunc'. -> Int32 -- ^ /@ioPriority@/: the [I\/O priority][io-priority] -- of the request. -> Maybe (a) -- ^ /@cancellable@/: optional t'GI.Gio.Objects.Cancellable.Cancellable' object, 'P.Nothing' to ignore. -> m () ioSchedulerPushJob :: forall (m :: * -> *) a. (HasCallStack, MonadIO m, IsCancellable a) => IOSchedulerJobFunc -> Int32 -> Maybe a -> m () ioSchedulerPushJob IOSchedulerJobFunc jobFunc Int32 ioPriority Maybe a cancellable = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do jobFunc' <- C_IOSchedulerJobFunc -> IO (FunPtr C_IOSchedulerJobFunc) Gio.Callbacks.mk_IOSchedulerJobFunc (Maybe (Ptr (FunPtr C_IOSchedulerJobFunc)) -> IOSchedulerJobFunc -> C_IOSchedulerJobFunc Gio.Callbacks.wrap_IOSchedulerJobFunc Maybe (Ptr (FunPtr C_IOSchedulerJobFunc)) forall a. Maybe a Nothing IOSchedulerJobFunc jobFunc) maybeCancellable <- case cancellable of Maybe a Nothing -> Ptr Cancellable -> IO (Ptr Cancellable) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr Cancellable forall a. Ptr a FP.nullPtr Just a jCancellable -> do jCancellable' <- a -> IO (Ptr Cancellable) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a jCancellable return jCancellable' let userData = FunPtr C_IOSchedulerJobFunc -> Ptr () forall a b. FunPtr a -> Ptr b castFunPtrToPtr FunPtr C_IOSchedulerJobFunc jobFunc' let notify = FunPtr (Ptr a -> IO ()) forall a. FunPtr (Ptr a -> IO ()) SP.safeFreeFunPtrPtr g_io_scheduler_push_job jobFunc' userData notify ioPriority maybeCancellable whenJust cancellable touchManagedPtr return () -- function io_scheduler_cancel_all_jobs -- Args: [] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_io_scheduler_cancel_all_jobs" g_io_scheduler_cancel_all_jobs :: IO () {-# DEPRECATED ioSchedulerCancelAllJobs ["(Since version 2.36)","You should never call this function, since you don\\'t","know how other libraries in your program might be making use of","gioscheduler."] #-} -- | Cancels all cancellable I\/O jobs. -- -- A job is cancellable if a t'GI.Gio.Objects.Cancellable.Cancellable' was passed into -- 'GI.Gio.Functions.ioSchedulerPushJob'. ioSchedulerCancelAllJobs :: (B.CallStack.HasCallStack, MonadIO m) => m () ioSchedulerCancelAllJobs :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m () ioSchedulerCancelAllJobs = IO () -> m () forall a. IO a -> m a 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 a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return () -- function io_modules_scan_all_in_directory_with_scope -- Args: [ Arg -- { argCName = "dirname" -- , argType = TBasicType TFileName -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "pathname for a directory containing modules\n to scan." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "scope" -- , argType = -- TInterface Name { namespace = "Gio" , name = "IOModuleScope" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a scope to use when scanning the modules" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_io_modules_scan_all_in_directory_with_scope" g_io_modules_scan_all_in_directory_with_scope :: CString -> -- dirname : TBasicType TFileName Ptr Gio.IOModuleScope.IOModuleScope -> -- scope : TInterface (Name {namespace = "Gio", name = "IOModuleScope"}) IO () -- | Scans all the modules in the specified directory, ensuring that -- any extension point implemented by a module is registered. -- -- This may not actually load and initialize all the types in each -- module, some modules may be lazily loaded and initialized when -- an extension point it implements is used with e.g. -- 'GI.Gio.Structs.IOExtensionPoint.iOExtensionPointGetExtensions' or -- 'GI.Gio.Structs.IOExtensionPoint.iOExtensionPointGetExtensionByName'. -- -- If you need to guarantee that all types are loaded in all the modules, -- use @/g_io_modules_load_all_in_directory()/@. -- -- /Since: 2.30/ ioModulesScanAllInDirectoryWithScope :: (B.CallStack.HasCallStack, MonadIO m) => [Char] -- ^ /@dirname@/: pathname for a directory containing modules -- to scan. -> Gio.IOModuleScope.IOModuleScope -- ^ /@scope@/: a scope to use when scanning the modules -> m () ioModulesScanAllInDirectoryWithScope :: forall (m :: * -> *). (HasCallStack, MonadIO m) => String -> IOModuleScope -> m () ioModulesScanAllInDirectoryWithScope String dirname IOModuleScope scope = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do dirname' <- String -> IO CString stringToCString String dirname scope' <- unsafeManagedPtrGetPtr scope g_io_modules_scan_all_in_directory_with_scope dirname' scope' touchManagedPtr scope freeMem dirname' return () -- function io_modules_scan_all_in_directory -- Args: [ Arg -- { argCName = "dirname" -- , argType = TBasicType TFileName -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "pathname for a directory containing modules\n to scan." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_io_modules_scan_all_in_directory" g_io_modules_scan_all_in_directory :: CString -> -- dirname : TBasicType TFileName IO () -- | Scans all the modules in the specified directory, ensuring that -- any extension point implemented by a module is registered. -- -- This may not actually load and initialize all the types in each -- module, some modules may be lazily loaded and initialized when -- an extension point it implements is used with e.g. -- 'GI.Gio.Structs.IOExtensionPoint.iOExtensionPointGetExtensions' or -- 'GI.Gio.Structs.IOExtensionPoint.iOExtensionPointGetExtensionByName'. -- -- If you need to guarantee that all types are loaded in all the modules, -- use @/g_io_modules_load_all_in_directory()/@. -- -- /Since: 2.24/ ioModulesScanAllInDirectory :: (B.CallStack.HasCallStack, MonadIO m) => [Char] -- ^ /@dirname@/: pathname for a directory containing modules -- to scan. -> m () ioModulesScanAllInDirectory :: forall (m :: * -> *). (HasCallStack, MonadIO m) => String -> m () ioModulesScanAllInDirectory String dirname = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do dirname' <- String -> IO CString stringToCString String dirname g_io_modules_scan_all_in_directory dirname' freeMem dirname' return () -- function io_error_quark -- Args: [] -- Lengths: [] -- returnType: Just (TBasicType TUInt32) -- throws : False -- Skip return : False foreign import ccall "g_io_error_quark" g_io_error_quark :: IO Word32 -- | Gets the GIO Error Quark. ioErrorQuark :: (B.CallStack.HasCallStack, MonadIO m) => m Word32 -- ^ __Returns:__ a @/GQuark/@. ioErrorQuark :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word32 ioErrorQuark = IO Word32 -> m Word32 forall a. IO a -> m a 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 result <- IO Word32 g_io_error_quark return result -- function io_error_from_file_error -- Args: [ Arg -- { argCName = "file_error" -- , argType = -- TInterface Name { namespace = "GLib" , name = "FileError" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GFileError." , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "Gio" , name = "IOErrorEnum" }) -- throws : False -- Skip return : False foreign import ccall "g_io_error_from_file_error" g_io_error_from_file_error :: CUInt -> -- file_error : TInterface (Name {namespace = "GLib", name = "FileError"}) IO CUInt -- | Converts t'GI.GLib.Enums.FileError' error codes into GIO error codes. -- -- /Since: 2.74/ ioErrorFromFileError :: (B.CallStack.HasCallStack, MonadIO m) => GLib.Enums.FileError -- ^ /@fileError@/: a t'GI.GLib.Enums.FileError'. -> m Gio.Enums.IOErrorEnum -- ^ __Returns:__ t'GI.Gio.Enums.IOErrorEnum' value for the given t'GI.GLib.Enums.FileError' error value. ioErrorFromFileError :: forall (m :: * -> *). (HasCallStack, MonadIO m) => FileError -> m IOErrorEnum ioErrorFromFileError FileError fileError = IO IOErrorEnum -> m IOErrorEnum forall a. IO a -> m a 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 let fileError' :: CUInt fileError' = (Int -> CUInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CUInt) -> (FileError -> Int) -> FileError -> CUInt forall b c a. (b -> c) -> (a -> b) -> a -> c . FileError -> Int forall a. Enum a => a -> Int fromEnum) FileError fileError result <- CUInt -> IO CUInt g_io_error_from_file_error CUInt fileError' let 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 return result' -- function io_error_from_errno -- Args: [ Arg -- { argCName = "err_no" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "Error number as defined in errno.h." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "Gio" , name = "IOErrorEnum" }) -- throws : False -- Skip return : False foreign import ccall "g_io_error_from_errno" g_io_error_from_errno :: Int32 -> -- err_no : TBasicType TInt IO CUInt -- | Converts @errno.h@ error codes into GIO error codes. -- -- The fallback value 'GI.Gio.Enums.IOErrorEnumFailed' is returned for error codes not -- currently handled (but note that future GLib releases may return a more -- specific value instead). -- -- As @errno@ is global and may be modified by intermediate function -- calls, you should save its value immediately after the call returns, -- and use the saved value instead of @errno@: -- -- -- -- === /C code/ -- > -- > int saved_errno; -- > -- > ret = read (blah); -- > saved_errno = errno; -- > -- > g_io_error_from_errno (saved_errno); ioErrorFromErrno :: (B.CallStack.HasCallStack, MonadIO m) => Int32 -- ^ /@errNo@/: Error number as defined in errno.h. -> m Gio.Enums.IOErrorEnum -- ^ __Returns:__ t'GI.Gio.Enums.IOErrorEnum' value for the given @errno.h@ error number ioErrorFromErrno :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> m IOErrorEnum ioErrorFromErrno Int32 errNo = IO IOErrorEnum -> m IOErrorEnum forall a. IO a -> m a 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 result <- Int32 -> IO CUInt g_io_error_from_errno Int32 errNo let 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 return result' -- function dbus_unescape_object_path -- Args: [ Arg -- { argCName = "s" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the string to unescape" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TCArray True (-1) (-1) (TBasicType TUInt8)) -- throws : False -- Skip return : False foreign import ccall "g_dbus_unescape_object_path" g_dbus_unescape_object_path :: CString -> -- s : TBasicType TUTF8 IO (Ptr Word8) -- | Unescapes an string that was previously escaped with -- 'GI.Gio.Functions.dbusEscapeObjectPath'. If the string is in a format that could -- not have been returned by 'GI.Gio.Functions.dbusEscapeObjectPath', this function -- returns 'P.Nothing'. -- -- Encoding alphanumeric characters which do not need to be -- encoded is not allowed (e.g @_63@ is not valid, the string -- should contain @c@ instead). -- -- /Since: 2.68/ dbusUnescapeObjectPath :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@s@/: the string to unescape -> m (Maybe ByteString) -- ^ __Returns:__ an -- unescaped version of /@s@/, or 'P.Nothing' if /@s@/ is not a string returned -- from 'GI.Gio.Functions.dbusEscapeObjectPath'. Free with 'GI.GLib.Functions.free'. dbusUnescapeObjectPath :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m (Maybe ByteString) dbusUnescapeObjectPath Text s = IO (Maybe ByteString) -> m (Maybe ByteString) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Maybe ByteString) -> m (Maybe ByteString)) -> IO (Maybe ByteString) -> m (Maybe ByteString) forall a b. (a -> b) -> a -> b $ do s' <- Text -> IO CString textToCString Text s result <- g_dbus_unescape_object_path s' maybeResult <- convertIfNonNull result $ \Ptr Word8 result' -> do result'' <- Ptr Word8 -> IO ByteString unpackZeroTerminatedByteString Ptr Word8 result' return result'' freeMem s' return maybeResult -- function dbus_is_unique_name -- Args: [ Arg -- { argCName = "string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The string to check." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_dbus_is_unique_name" g_dbus_is_unique_name :: CString -> -- string : TBasicType TUTF8 IO CInt -- | Checks if /@string@/ is a valid D-Bus unique bus name. -- -- /Since: 2.26/ dbusIsUniqueName :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@string@/: The string to check. -> m Bool -- ^ __Returns:__ 'P.True' if valid, 'P.False' otherwise. dbusIsUniqueName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool dbusIsUniqueName Text string = IO Bool -> m Bool forall a. IO a -> m a 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 string' <- Text -> IO CString textToCString Text string result <- g_dbus_is_unique_name string' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem string' return result' -- function dbus_is_supported_address -- Args: [ Arg -- { argCName = "string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A string." , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "g_dbus_is_supported_address" g_dbus_is_supported_address :: CString -> -- string : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO CInt -- | Like 'GI.Gio.Functions.dbusIsAddress' but also checks if the library supports the -- transports in /@string@/ and that key\/value pairs for each transport -- are valid. See the specification of the -- <https://dbus.freedesktop.org/doc/dbus-specification.html#addresses D-Bus address format>. -- -- /Since: 2.26/ dbusIsSupportedAddress :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@string@/: A string. -> m () -- ^ /(Can throw 'Data.GI.Base.GError.GError')/ dbusIsSupportedAddress :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m () dbusIsSupportedAddress Text string = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do string' <- Text -> IO CString textToCString Text string onException (do _ <- propagateGError $ g_dbus_is_supported_address string' freeMem string' return () ) (do freeMem string' ) -- function dbus_is_name -- Args: [ Arg -- { argCName = "string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The string to check." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_dbus_is_name" g_dbus_is_name :: CString -> -- string : TBasicType TUTF8 IO CInt -- | Checks if /@string@/ is a valid D-Bus bus name (either unique or well-known). -- -- /Since: 2.26/ dbusIsName :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@string@/: The string to check. -> m Bool -- ^ __Returns:__ 'P.True' if valid, 'P.False' otherwise. dbusIsName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool dbusIsName Text string = IO Bool -> m Bool forall a. IO a -> m a 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 string' <- Text -> IO CString textToCString Text string result <- g_dbus_is_name string' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem string' return result' -- function dbus_is_member_name -- Args: [ Arg -- { argCName = "string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The string to check." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_dbus_is_member_name" g_dbus_is_member_name :: CString -> -- string : TBasicType TUTF8 IO CInt -- | Checks if /@string@/ is a valid D-Bus member (e.g. signal or method) name. -- -- /Since: 2.26/ dbusIsMemberName :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@string@/: The string to check. -> m Bool -- ^ __Returns:__ 'P.True' if valid, 'P.False' otherwise. dbusIsMemberName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool dbusIsMemberName Text string = IO Bool -> m Bool forall a. IO a -> m a 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 string' <- Text -> IO CString textToCString Text string result <- g_dbus_is_member_name string' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem string' return result' -- function dbus_is_interface_name -- Args: [ Arg -- { argCName = "string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The string to check." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_dbus_is_interface_name" g_dbus_is_interface_name :: CString -> -- string : TBasicType TUTF8 IO CInt -- | Checks if /@string@/ is a valid D-Bus interface name. -- -- /Since: 2.26/ dbusIsInterfaceName :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@string@/: The string to check. -> m Bool -- ^ __Returns:__ 'P.True' if valid, 'P.False' otherwise. dbusIsInterfaceName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool dbusIsInterfaceName Text string = IO Bool -> m Bool forall a. IO a -> m a 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 string' <- Text -> IO CString textToCString Text string result <- g_dbus_is_interface_name string' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem string' return result' -- function dbus_is_guid -- Args: [ Arg -- { argCName = "string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The string to check." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_dbus_is_guid" g_dbus_is_guid :: CString -> -- string : TBasicType TUTF8 IO CInt -- | Checks if /@string@/ is a D-Bus GUID. -- -- See the documentation for 'GI.Gio.Functions.dbusGenerateGuid' for more information about -- the format of a GUID. -- -- /Since: 2.26/ dbusIsGuid :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@string@/: The string to check. -> m Bool -- ^ __Returns:__ 'P.True' if /@string@/ is a GUID, 'P.False' otherwise. dbusIsGuid :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool dbusIsGuid Text string = IO Bool -> m Bool forall a. IO a -> m a 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 string' <- Text -> IO CString textToCString Text string result <- g_dbus_is_guid string' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem string' return result' -- function dbus_is_error_name -- Args: [ Arg -- { argCName = "string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The string to check." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_dbus_is_error_name" g_dbus_is_error_name :: CString -> -- string : TBasicType TUTF8 IO CInt -- | Check whether /@string@/ is a valid D-Bus error name. -- -- This function returns the same result as 'GI.Gio.Functions.dbusIsInterfaceName', -- because D-Bus error names are defined to have exactly the -- same syntax as interface names. -- -- /Since: 2.70/ dbusIsErrorName :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@string@/: The string to check. -> m Bool -- ^ __Returns:__ 'P.True' if valid, 'P.False' otherwise. dbusIsErrorName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool dbusIsErrorName Text string = IO Bool -> m Bool forall a. IO a -> m a 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 string' <- Text -> IO CString textToCString Text string result <- g_dbus_is_error_name string' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem string' return result' -- function dbus_is_address -- Args: [ Arg -- { argCName = "string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A string." , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_dbus_is_address" g_dbus_is_address :: CString -> -- string : TBasicType TUTF8 IO CInt -- | Checks if /@string@/ is a -- <https://dbus.freedesktop.org/doc/dbus-specification.html#addresses D-Bus address>. -- -- This doesn\'t check if /@string@/ is actually supported by t'GI.Gio.Objects.DBusServer.DBusServer' -- or t'GI.Gio.Objects.DBusConnection.DBusConnection' - use 'GI.Gio.Functions.dbusIsSupportedAddress' to do more -- checks. -- -- /Since: 2.26/ dbusIsAddress :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@string@/: A string. -> m Bool -- ^ __Returns:__ 'P.True' if /@string@/ is a valid D-Bus address, 'P.False' otherwise. dbusIsAddress :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool dbusIsAddress Text string = IO Bool -> m Bool forall a. IO a -> m a 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 string' <- Text -> IO CString textToCString Text string result <- g_dbus_is_address string' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem string' return result' -- function dbus_gvariant_to_gvalue -- Args: [ Arg -- { argCName = "value" -- , argType = TVariant -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A #GVariant." , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "out_gvalue" -- , argType = TGValue -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "Return location pointing to a zero-filled (uninitialized) #GValue." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = True -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_dbus_gvariant_to_gvalue" g_dbus_gvariant_to_gvalue :: Ptr GVariant -> -- value : TVariant Ptr GValue -> -- out_gvalue : TGValue IO () -- | Converts a t'GVariant' to a t'GI.GObject.Structs.Value.Value'. If /@value@/ is floating, it is consumed. -- -- The rules specified in the 'GI.Gio.Functions.dbusGvalueToGvariant' function are -- used - this function is essentially its reverse form. So, a t'GVariant' -- containing any basic or string array type will be converted to a t'GI.GObject.Structs.Value.Value' -- containing a basic value or string array. Any other t'GVariant' (handle, -- variant, tuple, dict entry) will be converted to a t'GI.GObject.Structs.Value.Value' containing that -- t'GVariant'. -- -- The conversion never fails - a valid t'GI.GObject.Structs.Value.Value' is always returned in -- /@outGvalue@/. -- -- /Since: 2.30/ dbusGvariantToGvalue :: (B.CallStack.HasCallStack, MonadIO m) => GVariant -- ^ /@value@/: A t'GVariant'. -> m (GValue) dbusGvariantToGvalue :: forall (m :: * -> *). (HasCallStack, MonadIO m) => GVariant -> m GValue dbusGvariantToGvalue GVariant value = IO GValue -> m GValue forall a. IO a -> m a 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 value' <- GVariant -> IO (Ptr GVariant) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr GVariant value outGvalue <- SP.callocBytes 24 :: IO (Ptr GValue) g_dbus_gvariant_to_gvalue value' outGvalue outGvalue' <- B.GValue.wrapGValuePtr outGvalue touchManagedPtr value return outGvalue' -- function dbus_gvalue_to_gvariant -- Args: [ Arg -- { argCName = "gvalue" -- , argType = TGValue -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A #GValue to convert to a #GVariant" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "type" -- , argType = -- TInterface Name { namespace = "GLib" , name = "VariantType" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A #GVariantType" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just TVariant -- throws : False -- Skip return : False foreign import ccall "g_dbus_gvalue_to_gvariant" g_dbus_gvalue_to_gvariant :: Ptr GValue -> -- gvalue : TGValue Ptr GLib.VariantType.VariantType -> -- type : TInterface (Name {namespace = "GLib", name = "VariantType"}) IO (Ptr GVariant) -- | Converts a t'GI.GObject.Structs.Value.Value' to a t'GVariant' of the type indicated by the /@type@/ -- parameter. -- -- The conversion is using the following rules: -- -- * @G_TYPE_STRING@: \'s\', \'o\', \'g\' or \'ay\' -- * @G_TYPE_STRV@: \'as\', \'ao\' or \'aay\' -- * @G_TYPE_BOOLEAN@: \'b\' -- * @G_TYPE_UCHAR@: \'y\' -- * @G_TYPE_INT@: \'i\', \'n\' -- * @G_TYPE_UINT@: \'u\', \'q\' -- * @G_TYPE_INT64@: \'x\' -- * @G_TYPE_UINT64@: \'t\' -- * @G_TYPE_DOUBLE@: \'d\' -- * @G_TYPE_VARIANT@: Any t'GI.GLib.Structs.VariantType.VariantType' -- -- -- This can fail if e.g. /@gvalue@/ is of type @/G_TYPE_STRING/@ and /@type@/ -- is \'i\', i.e. @/G_VARIANT_TYPE_INT32/@. It will also fail for any t'GType' -- (including e.g. @/G_TYPE_OBJECT/@ and @/G_TYPE_BOXED/@ derived-types) not -- in the table above. -- -- Note that if /@gvalue@/ is of type @/G_TYPE_VARIANT/@ and its value is -- 'P.Nothing', the empty t'GVariant' instance (never 'P.Nothing') for /@type@/ is -- returned (e.g. 0 for scalar types, the empty string for string types, -- \'\/\' for object path types, the empty array for any array type and so on). -- -- See the 'GI.Gio.Functions.dbusGvariantToGvalue' function for how to convert a -- t'GVariant' to a t'GI.GObject.Structs.Value.Value'. -- -- /Since: 2.30/ dbusGvalueToGvariant :: (B.CallStack.HasCallStack, MonadIO m) => GValue -- ^ /@gvalue@/: A t'GI.GObject.Structs.Value.Value' to convert to a t'GVariant' -> GLib.VariantType.VariantType -- ^ /@type@/: A t'GI.GLib.Structs.VariantType.VariantType' -> m GVariant -- ^ __Returns:__ A t'GVariant' (never floating) of -- t'GI.GLib.Structs.VariantType.VariantType' /@type@/ holding the data from /@gvalue@/ or an empty t'GVariant' -- in case of failure. Free with 'GI.GLib.Structs.Variant.variantUnref'. dbusGvalueToGvariant :: forall (m :: * -> *). (HasCallStack, MonadIO m) => GValue -> VariantType -> m GVariant dbusGvalueToGvariant GValue gvalue VariantType type_ = IO GVariant -> m GVariant forall a. IO a -> m a 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 gvalue' <- GValue -> IO (Ptr GValue) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr GValue gvalue type_' <- unsafeManagedPtrGetPtr type_ result <- g_dbus_gvalue_to_gvariant gvalue' type_' checkUnexpectedReturnNULL "dbusGvalueToGvariant" result result' <- B.GVariant.wrapGVariantPtr result touchManagedPtr gvalue touchManagedPtr type_ return result' -- function dbus_generate_guid -- Args: [] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_dbus_generate_guid" g_dbus_generate_guid :: IO CString -- | Generate a D-Bus GUID that can be used with -- e.g. 'GI.Gio.Objects.DBusConnection.dBusConnectionNew'. -- -- See the -- <https://dbus.freedesktop.org/doc/dbus-specification.html#uuids D-Bus specification> -- regarding what strings are valid D-Bus GUIDs. The specification refers to -- these as ‘UUIDs’ whereas GLib (for historical reasons) refers to them as -- ‘GUIDs’. The terms are interchangeable. -- -- Note that D-Bus GUIDs do not follow -- <https://datatracker.ietf.org/doc/html/rfc4122 RFC 4122>. -- -- /Since: 2.26/ dbusGenerateGuid :: (B.CallStack.HasCallStack, MonadIO m) => m T.Text -- ^ __Returns:__ A valid D-Bus GUID. Free with 'GI.GLib.Functions.free'. dbusGenerateGuid :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Text dbusGenerateGuid = IO Text -> m Text forall a. IO a -> m a 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 result <- IO CString g_dbus_generate_guid checkUnexpectedReturnNULL "dbusGenerateGuid" result result' <- cstringToText result freeMem result return result' -- function dbus_escape_object_path_bytestring -- Args: [ Arg -- { argCName = "bytes" -- , argType = TCArray True (-1) (-1) (TBasicType TUInt8) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the string of bytes to escape" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_dbus_escape_object_path_bytestring" g_dbus_escape_object_path_bytestring :: Ptr Word8 -> -- bytes : TCArray True (-1) (-1) (TBasicType TUInt8) IO CString -- | Escapes /@bytes@/ for use in a D-Bus object path component. -- /@bytes@/ is an array of zero or more nonzero bytes in an -- unspecified encoding, followed by a single zero byte. -- -- The escaping method consists of replacing all non-alphanumeric -- characters (see @/g_ascii_isalnum()/@) with their hexadecimal value -- preceded by an underscore (@_@). For example: -- @foo.bar.baz@ will become @foo_2ebar_2ebaz@. -- -- This method is appropriate to use when the input is nearly -- a valid object path component but is not when your input -- is far from being a valid object path component. -- Other escaping algorithms are also valid to use with -- D-Bus object paths. -- -- This can be reversed with 'GI.Gio.Functions.dbusUnescapeObjectPath'. -- -- /Since: 2.68/ dbusEscapeObjectPathBytestring :: (B.CallStack.HasCallStack, MonadIO m) => ByteString -- ^ /@bytes@/: the string of bytes to escape -> m T.Text -- ^ __Returns:__ an escaped version of /@bytes@/. Free with 'GI.GLib.Functions.free'. dbusEscapeObjectPathBytestring :: forall (m :: * -> *). (HasCallStack, MonadIO m) => ByteString -> m Text dbusEscapeObjectPathBytestring ByteString bytes = IO Text -> m Text forall a. IO a -> m a 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 bytes' <- ByteString -> IO (Ptr Word8) packZeroTerminatedByteString ByteString bytes result <- g_dbus_escape_object_path_bytestring bytes' checkUnexpectedReturnNULL "dbusEscapeObjectPathBytestring" result result' <- cstringToText result freeMem result freeMem bytes' return result' -- function dbus_escape_object_path -- Args: [ Arg -- { argCName = "s" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the string to escape" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_dbus_escape_object_path" g_dbus_escape_object_path :: CString -> -- s : TBasicType TUTF8 IO CString -- | This is a language binding friendly version of 'GI.Gio.Functions.dbusEscapeObjectPathBytestring'. -- -- /Since: 2.68/ dbusEscapeObjectPath :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@s@/: the string to escape -> m T.Text -- ^ __Returns:__ an escaped version of /@s@/. Free with 'GI.GLib.Functions.free'. dbusEscapeObjectPath :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text dbusEscapeObjectPath Text s = IO Text -> m Text forall a. IO a -> m a 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 s' <- Text -> IO CString textToCString Text s result <- g_dbus_escape_object_path s' checkUnexpectedReturnNULL "dbusEscapeObjectPath" result result' <- cstringToText result freeMem result freeMem s' return result' -- function dbus_address_get_stream_sync -- Args: [ Arg -- { argCName = "address" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A valid D-Bus address." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "out_guid" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "%NULL or return location to store the GUID extracted from @address, if any." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- , Arg -- { argCName = "cancellable" -- , argType = -- TInterface Name { namespace = "Gio" , name = "Cancellable" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "A #GCancellable or %NULL." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "Gio" , name = "IOStream" }) -- throws : True -- Skip return : False foreign import ccall "g_dbus_address_get_stream_sync" g_dbus_address_get_stream_sync :: CString -> -- address : TBasicType TUTF8 Ptr CString -> -- out_guid : TBasicType TUTF8 Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) Ptr (Ptr GError) -> -- error IO (Ptr Gio.IOStream.IOStream) -- | Synchronously connects to an endpoint specified by /@address@/ and -- sets up the connection so it is in a state to run the client-side -- of the D-Bus authentication conversation. /@address@/ must be in the -- <https://dbus.freedesktop.org/doc/dbus-specification.html#addresses D-Bus address format>. -- -- A server is not required to set a GUID, so /@outGuid@/ may be set to 'P.Nothing' -- even on success. -- -- This is a synchronous failable function. See -- 'GI.Gio.Functions.dbusAddressGetStream' for the asynchronous version. -- -- /Since: 2.26/ dbusAddressGetStreamSync :: (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) => T.Text -- ^ /@address@/: A valid D-Bus address. -> Maybe (a) -- ^ /@cancellable@/: A t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing'. -> m ((Gio.IOStream.IOStream, Maybe T.Text)) -- ^ __Returns:__ A t'GI.Gio.Objects.IOStream.IOStream' or 'P.Nothing' if /@error@/ is set. /(Can throw 'Data.GI.Base.GError.GError')/ dbusAddressGetStreamSync :: forall (m :: * -> *) a. (HasCallStack, MonadIO m, IsCancellable a) => Text -> Maybe a -> m (IOStream, Maybe Text) dbusAddressGetStreamSync Text address Maybe a cancellable = IO (IOStream, Maybe Text) -> m (IOStream, Maybe Text) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (IOStream, Maybe Text) -> m (IOStream, Maybe Text)) -> IO (IOStream, Maybe Text) -> m (IOStream, Maybe Text) forall a b. (a -> b) -> a -> b $ do address' <- Text -> IO CString textToCString Text address outGuid <- callocMem :: IO (Ptr CString) maybeCancellable <- case cancellable of Maybe a Nothing -> Ptr Cancellable -> IO (Ptr Cancellable) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr Cancellable forall a. Ptr a FP.nullPtr Just a jCancellable -> do jCancellable' <- a -> IO (Ptr Cancellable) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a jCancellable return jCancellable' onException (do result <- propagateGError $ g_dbus_address_get_stream_sync address' outGuid maybeCancellable checkUnexpectedReturnNULL "dbusAddressGetStreamSync" result result' <- (wrapObject Gio.IOStream.IOStream) result outGuid' <- peek outGuid maybeOutGuid' <- convertIfNonNull outGuid' $ \CString outGuid'' -> do outGuid''' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString outGuid'' return outGuid''' freeMem outGuid' whenJust cancellable touchManagedPtr freeMem address' freeMem outGuid return (result', maybeOutGuid') ) (do freeMem address' freeMem outGuid ) -- function dbus_address_get_stream_finish -- Args: [ Arg -- { argCName = "res" -- , argType = -- TInterface Name { namespace = "Gio" , name = "AsyncResult" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "A #GAsyncResult obtained from the GAsyncReadyCallback passed to g_dbus_address_get_stream()." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "out_guid" -- , argType = TBasicType TUTF8 -- , direction = DirectionOut -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "%NULL or return location to store the GUID extracted from @address, if any." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "Gio" , name = "IOStream" }) -- throws : True -- Skip return : False foreign import ccall "g_dbus_address_get_stream_finish" g_dbus_address_get_stream_finish :: Ptr Gio.AsyncResult.AsyncResult -> -- res : TInterface (Name {namespace = "Gio", name = "AsyncResult"}) Ptr CString -> -- out_guid : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO (Ptr Gio.IOStream.IOStream) -- | Finishes an operation started with 'GI.Gio.Functions.dbusAddressGetStream'. -- -- A server is not required to set a GUID, so /@outGuid@/ may be set to 'P.Nothing' -- even on success. -- -- /Since: 2.26/ dbusAddressGetStreamFinish :: (B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) => a -- ^ /@res@/: A t'GI.Gio.Interfaces.AsyncResult.AsyncResult' obtained from the GAsyncReadyCallback passed to 'GI.Gio.Functions.dbusAddressGetStream'. -> m ((Gio.IOStream.IOStream, Maybe T.Text)) -- ^ __Returns:__ A t'GI.Gio.Objects.IOStream.IOStream' or 'P.Nothing' if /@error@/ is set. /(Can throw 'Data.GI.Base.GError.GError')/ dbusAddressGetStreamFinish :: forall (m :: * -> *) a. (HasCallStack, MonadIO m, IsAsyncResult a) => a -> m (IOStream, Maybe Text) dbusAddressGetStreamFinish a res = IO (IOStream, Maybe Text) -> m (IOStream, Maybe Text) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (IOStream, Maybe Text) -> m (IOStream, Maybe Text)) -> IO (IOStream, Maybe Text) -> m (IOStream, Maybe Text) forall a b. (a -> b) -> a -> b $ do res' <- a -> IO (Ptr AsyncResult) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a res outGuid <- callocMem :: IO (Ptr CString) onException (do result <- propagateGError $ g_dbus_address_get_stream_finish res' outGuid checkUnexpectedReturnNULL "dbusAddressGetStreamFinish" result result' <- (wrapObject Gio.IOStream.IOStream) result outGuid' <- peek outGuid maybeOutGuid' <- convertIfNonNull outGuid' $ \CString outGuid'' -> do outGuid''' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString outGuid'' return outGuid''' freeMem outGuid' touchManagedPtr res freeMem outGuid return (result', maybeOutGuid') ) (do freeMem outGuid ) -- function dbus_address_get_stream -- Args: [ Arg -- { argCName = "address" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A valid D-Bus address." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "cancellable" -- , argType = -- TInterface Name { namespace = "Gio" , name = "Cancellable" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "A #GCancellable or %NULL." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "callback" -- , argType = -- TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "A #GAsyncReadyCallback to call when the request is satisfied." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeAsync -- , argClosure = 3 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "user_data" -- , argType = TBasicType TPtr -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "Data to pass to @callback." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_dbus_address_get_stream" g_dbus_address_get_stream :: CString -> -- address : TBasicType TUTF8 Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}) Ptr () -> -- user_data : TBasicType TPtr IO () -- | Asynchronously connects to an endpoint specified by /@address@/ and -- sets up the connection so it is in a state to run the client-side -- of the D-Bus authentication conversation. /@address@/ must be in the -- <https://dbus.freedesktop.org/doc/dbus-specification.html#addresses D-Bus address format>. -- -- When the operation is finished, /@callback@/ will be invoked. You can -- then call 'GI.Gio.Functions.dbusAddressGetStreamFinish' to get the result of -- the operation. -- -- This is an asynchronous failable function. See -- 'GI.Gio.Functions.dbusAddressGetStreamSync' for the synchronous version. -- -- /Since: 2.26/ dbusAddressGetStream :: (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) => T.Text -- ^ /@address@/: A valid D-Bus address. -> Maybe (a) -- ^ /@cancellable@/: A t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing'. -> Maybe (Gio.Callbacks.AsyncReadyCallback) -- ^ /@callback@/: A t'GI.Gio.Callbacks.AsyncReadyCallback' to call when the request is satisfied. -> m () dbusAddressGetStream :: forall (m :: * -> *) a. (HasCallStack, MonadIO m, IsCancellable a) => Text -> Maybe a -> Maybe AsyncReadyCallback -> m () dbusAddressGetStream Text address Maybe a cancellable Maybe AsyncReadyCallback callback = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do address' <- Text -> IO CString textToCString Text address maybeCancellable <- case cancellable of Maybe a Nothing -> Ptr Cancellable -> IO (Ptr Cancellable) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr Cancellable forall a. Ptr a FP.nullPtr Just a jCancellable -> do jCancellable' <- a -> IO (Ptr Cancellable) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a jCancellable return jCancellable' maybeCallback <- case callback of Maybe AsyncReadyCallback Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return FunPtr C_AsyncReadyCallback forall a. FunPtr a FP.nullFunPtr Just AsyncReadyCallback jCallback -> do ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback)) forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback)) jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback)) poke ptrcallback jCallback' return jCallback' let userData = Ptr a forall a. Ptr a nullPtr g_dbus_address_get_stream address' maybeCancellable maybeCallback userData whenJust cancellable touchManagedPtr freeMem address' return () -- function dbus_address_get_for_bus_sync -- Args: [ Arg -- { argCName = "bus_type" -- , argType = -- TInterface Name { namespace = "Gio" , name = "BusType" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GBusType" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "cancellable" -- , argType = -- TInterface Name { namespace = "Gio" , name = "Cancellable" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "a #GCancellable or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : True -- Skip return : False foreign import ccall "g_dbus_address_get_for_bus_sync" g_dbus_address_get_for_bus_sync :: CInt -> -- bus_type : TInterface (Name {namespace = "Gio", name = "BusType"}) Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) Ptr (Ptr GError) -> -- error IO CString -- | Synchronously looks up the D-Bus address for the well-known message -- bus instance specified by /@busType@/. This may involve using various -- platform specific mechanisms. -- -- The returned address will be in the -- <https://dbus.freedesktop.org/doc/dbus-specification.html#addresses D-Bus address format>. -- -- /Since: 2.26/ dbusAddressGetForBusSync :: (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) => Gio.Enums.BusType -- ^ /@busType@/: a t'GI.Gio.Enums.BusType' -> Maybe (a) -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing' -> m T.Text -- ^ __Returns:__ a valid D-Bus address string for /@busType@/ or -- 'P.Nothing' if /@error@/ is set /(Can throw 'Data.GI.Base.GError.GError')/ dbusAddressGetForBusSync :: forall (m :: * -> *) a. (HasCallStack, MonadIO m, IsCancellable a) => BusType -> Maybe a -> m Text dbusAddressGetForBusSync BusType busType Maybe a cancellable = IO Text -> m Text forall a. IO a -> m a 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 maybeCancellable <- case Maybe a cancellable of Maybe a Nothing -> Ptr Cancellable -> IO (Ptr Cancellable) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr Cancellable forall a. Ptr a FP.nullPtr Just a jCancellable -> do jCancellable' <- a -> IO (Ptr Cancellable) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a jCancellable return jCancellable' onException (do result <- propagateGError $ g_dbus_address_get_for_bus_sync busType' maybeCancellable checkUnexpectedReturnNULL "dbusAddressGetForBusSync" result result' <- cstringToText result freeMem result whenJust cancellable touchManagedPtr return result' ) (do return () ) -- function dbus_address_escape_value -- Args: [ Arg -- { argCName = "string" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "an unescaped string to be included in a D-Bus address\n as the value in a key-value pair" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_dbus_address_escape_value" g_dbus_address_escape_value :: CString -> -- string : TBasicType TUTF8 IO CString -- | Escape /@string@/ so it can appear in a D-Bus address as the value -- part of a key-value pair. -- -- For instance, if /@string@/ is @\/run\/bus-for-:0@, -- this function would return @\/run\/bus-for-%3A0@, -- which could be used in a D-Bus address like -- @unix:nonce-tcp:host=127.0.0.1,port=42,noncefile=\/run\/bus-for-%3A0@. -- -- /Since: 2.36/ dbusAddressEscapeValue :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@string@/: an unescaped string to be included in a D-Bus address -- as the value in a key-value pair -> m T.Text -- ^ __Returns:__ a copy of /@string@/ with all -- non-optionally-escaped bytes escaped dbusAddressEscapeValue :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text dbusAddressEscapeValue Text string = IO Text -> m Text forall a. IO a -> m a 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 string' <- Text -> IO CString textToCString Text string result <- g_dbus_address_escape_value string' checkUnexpectedReturnNULL "dbusAddressEscapeValue" result result' <- cstringToText result freeMem result freeMem string' return result' -- function content_types_get_registered -- Args: [] -- Lengths: [] -- returnType: Just (TGList (TBasicType TUTF8)) -- throws : False -- Skip return : False foreign import ccall "g_content_types_get_registered" g_content_types_get_registered :: IO (Ptr (GList CString)) -- | Gets a list of strings containing all the registered content types -- known to the system. The list and its data should be freed using -- @g_list_free_full (list, g_free)@. contentTypesGetRegistered :: (B.CallStack.HasCallStack, MonadIO m) => m [T.Text] -- ^ __Returns:__ list of the registered -- content types contentTypesGetRegistered :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m [Text] contentTypesGetRegistered = IO [Text] -> m [Text] forall a. IO a -> m a 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 result <- IO (Ptr (GList CString)) g_content_types_get_registered result' <- unpackGList result result'' <- mapM cstringToText result' mapGList freeMem result g_list_free result return result'' -- function content_type_set_mime_dirs -- Args: [ Arg -- { argCName = "dirs" -- , argType = TCArray True (-1) (-1) (TBasicType TUTF8) -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "%NULL-terminated list of\n directories to load MIME data from, including any `mime/` subdirectory,\n and with the first directory to try listed first" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_content_type_set_mime_dirs" g_content_type_set_mime_dirs :: Ptr CString -> -- dirs : TCArray True (-1) (-1) (TBasicType TUTF8) IO () -- | Set the list of directories used by GIO to load the MIME database. -- If /@dirs@/ is 'P.Nothing', the directories used are the default: -- -- - the @mime@ subdirectory of the directory in @$XDG_DATA_HOME@ -- - the @mime@ subdirectory of every directory in @$XDG_DATA_DIRS@ -- -- This function is intended to be used when writing tests that depend on -- information stored in the MIME database, in order to control the data. -- -- Typically, in case your tests use 'GI.GLib.Constants.TEST_OPTION_ISOLATE_DIRS', but they -- depend on the system’s MIME database, you should call this function -- with /@dirs@/ set to 'P.Nothing' before calling @/g_test_init()/@, for instance: -- -- -- === /C code/ -- > -- > // Load MIME data from the system -- > g_content_type_set_mime_dirs (NULL); -- > // Isolate the environment -- > g_test_init (&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL); -- > -- > … -- > -- > return g_test_run (); -- -- -- /Since: 2.60/ contentTypeSetMimeDirs :: (B.CallStack.HasCallStack, MonadIO m) => Maybe ([T.Text]) -- ^ /@dirs@/: 'P.Nothing'-terminated list of -- directories to load MIME data from, including any @mime\/@ subdirectory, -- and with the first directory to try listed first -> m () contentTypeSetMimeDirs :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Maybe [Text] -> m () contentTypeSetMimeDirs Maybe [Text] dirs = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do maybeDirs <- case Maybe [Text] dirs of Maybe [Text] Nothing -> Ptr CString -> IO (Ptr CString) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr CString forall a. Ptr a FP.nullPtr Just [Text] jDirs -> do jDirs' <- [Text] -> IO (Ptr CString) packZeroTerminatedUTF8CArray [Text] jDirs return jDirs' g_content_type_set_mime_dirs maybeDirs mapZeroTerminatedCArray freeMem maybeDirs freeMem maybeDirs return () -- function content_type_is_unknown -- Args: [ Arg -- { argCName = "type" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a content type string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_content_type_is_unknown" g_content_type_is_unknown :: CString -> -- type : TBasicType TUTF8 IO CInt -- | Checks if the content type is the generic \"unknown\" type. -- On UNIX this is the \"application\/octet-stream\" mimetype, -- while on win32 it is \"*\" and on OSX it is a dynamic type -- or octet-stream. contentTypeIsUnknown :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@type@/: a content type string -> m Bool -- ^ __Returns:__ 'P.True' if the type is the unknown type. contentTypeIsUnknown :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool contentTypeIsUnknown Text type_ = IO Bool -> m Bool forall a. IO a -> m a 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 type_' <- Text -> IO CString textToCString Text type_ result <- g_content_type_is_unknown type_' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem type_' return result' -- function content_type_is_mime_type -- Args: [ Arg -- { argCName = "type" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a content type string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "mime_type" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a mime type string" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_content_type_is_mime_type" g_content_type_is_mime_type :: CString -> -- type : TBasicType TUTF8 CString -> -- mime_type : TBasicType TUTF8 IO CInt -- | Determines if /@type@/ is a subset of /@mimeType@/. -- Convenience wrapper around 'GI.Gio.Functions.contentTypeIsA'. -- -- /Since: 2.52/ contentTypeIsMimeType :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@type@/: a content type string -> T.Text -- ^ /@mimeType@/: a mime type string -> m Bool -- ^ __Returns:__ 'P.True' if /@type@/ is a kind of /@mimeType@/, -- 'P.False' otherwise. contentTypeIsMimeType :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Text -> m Bool contentTypeIsMimeType Text type_ Text mimeType = IO Bool -> m Bool forall a. IO a -> m a 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 type_' <- Text -> IO CString textToCString Text type_ mimeType' <- textToCString mimeType result <- g_content_type_is_mime_type type_' mimeType' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem type_' freeMem mimeType' return result' -- function content_type_is_a -- Args: [ Arg -- { argCName = "type" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a content type string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "supertype" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a content type string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_content_type_is_a" g_content_type_is_a :: CString -> -- type : TBasicType TUTF8 CString -> -- supertype : TBasicType TUTF8 IO CInt -- | Determines if /@type@/ is a subset of /@supertype@/. contentTypeIsA :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@type@/: a content type string -> T.Text -- ^ /@supertype@/: a content type string -> m Bool -- ^ __Returns:__ 'P.True' if /@type@/ is a kind of /@supertype@/, -- 'P.False' otherwise. contentTypeIsA :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Text -> m Bool contentTypeIsA Text type_ Text supertype = IO Bool -> m Bool forall a. IO a -> m a 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 type_' <- Text -> IO CString textToCString Text type_ supertype' <- textToCString supertype result <- g_content_type_is_a type_' supertype' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem type_' freeMem supertype' return result' -- function content_type_guess_for_tree -- Args: [ Arg -- { argCName = "root" -- , argType = TInterface Name { namespace = "Gio" , name = "File" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the root of the tree to guess a type for" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8)) -- throws : False -- Skip return : False foreign import ccall "g_content_type_guess_for_tree" g_content_type_guess_for_tree :: Ptr Gio.File.File -> -- root : TInterface (Name {namespace = "Gio", name = "File"}) IO (Ptr CString) -- | Tries to guess the type of the tree with root /@root@/, by -- looking at the files it contains. The result is an array -- of content types, with the best guess coming first. -- -- The types returned all have the form x-content\/foo, e.g. -- x-content\/audio-cdda (for audio CDs) or x-content\/image-dcf -- (for a camera memory card). See the -- <http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec shared-mime-info> -- specification for more on x-content types. -- -- This function is useful in the implementation of -- 'GI.Gio.Interfaces.Mount.mountGuessContentType'. -- -- /Since: 2.18/ contentTypeGuessForTree :: (B.CallStack.HasCallStack, MonadIO m, Gio.File.IsFile a) => a -- ^ /@root@/: the root of the tree to guess a type for -> m [T.Text] -- ^ __Returns:__ an 'P.Nothing'-terminated -- array of zero or more content types. Free with 'GI.GLib.Functions.strfreev' contentTypeGuessForTree :: forall (m :: * -> *) a. (HasCallStack, MonadIO m, IsFile a) => a -> m [Text] contentTypeGuessForTree a root = IO [Text] -> m [Text] forall a. IO a -> m a 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 root' <- a -> IO (Ptr File) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a root result <- g_content_type_guess_for_tree root' checkUnexpectedReturnNULL "contentTypeGuessForTree" result result' <- unpackZeroTerminatedUTF8CArray result mapZeroTerminatedCArray freeMem result freeMem result touchManagedPtr root return result' -- function content_type_guess -- Args: [ Arg -- { argCName = "filename" -- , argType = TBasicType TFileName -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "a path, or %NULL" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "data" -- , argType = TCArray False (-1) 2 (TBasicType TUInt8) -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "a stream of data, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "data_size" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the size of @data" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "result_uncertain" -- , argType = TBasicType TBoolean -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "return location for the certainty\n of the result, or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [ Arg -- { argCName = "data_size" -- , argType = TBasicType TSize -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the size of @data" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_content_type_guess" g_content_type_guess :: CString -> -- filename : TBasicType TFileName Ptr Word8 -> -- data : TCArray False (-1) 2 (TBasicType TUInt8) FCT.CSize -> -- data_size : TBasicType TSize Ptr CInt -> -- result_uncertain : TBasicType TBoolean IO CString -- | Guesses the content type based on example data. If the function is -- uncertain, /@resultUncertain@/ will be set to 'P.True'. Either /@filename@/ -- or /@data@/ may be 'P.Nothing', in which case the guess will be based solely -- on the other argument. contentTypeGuess :: (B.CallStack.HasCallStack, MonadIO m) => Maybe ([Char]) -- ^ /@filename@/: a path, or 'P.Nothing' -> Maybe (ByteString) -- ^ /@data@/: a stream of data, or 'P.Nothing' -> m ((T.Text, Bool)) -- ^ __Returns:__ a string indicating a guessed content type for the -- given data. Free with 'GI.GLib.Functions.free' contentTypeGuess :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Maybe String -> Maybe ByteString -> m (Text, Bool) contentTypeGuess Maybe String filename Maybe ByteString data_ = IO (Text, Bool) -> m (Text, Bool) forall a. IO a -> m a 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 :: CSize dataSize = case Maybe ByteString data_ of Maybe ByteString Nothing -> CSize 0 Just ByteString jData_ -> Int -> CSize forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CSize) -> Int -> CSize forall a b. (a -> b) -> a -> b $ ByteString -> Int B.length ByteString jData_ maybeFilename <- case Maybe String filename of Maybe String Nothing -> CString -> IO CString forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return CString forall a. Ptr a FP.nullPtr Just String jFilename -> do jFilename' <- String -> IO CString stringToCString String jFilename return jFilename' maybeData_ <- case data_ of Maybe ByteString Nothing -> Ptr Word8 -> IO (Ptr Word8) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr Word8 forall a. Ptr a FP.nullPtr Just ByteString jData_ -> do jData_' <- ByteString -> IO (Ptr Word8) packByteString ByteString jData_ return jData_' resultUncertain <- allocMem :: IO (Ptr CInt) result <- g_content_type_guess maybeFilename maybeData_ dataSize resultUncertain checkUnexpectedReturnNULL "contentTypeGuess" result result' <- cstringToText result freeMem result resultUncertain' <- peek resultUncertain let resultUncertain'' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt resultUncertain' freeMem maybeFilename freeMem maybeData_ freeMem resultUncertain return (result', resultUncertain'') -- function content_type_get_symbolic_icon -- Args: [ Arg -- { argCName = "type" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a content type string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "Gio" , name = "Icon" }) -- throws : False -- Skip return : False foreign import ccall "g_content_type_get_symbolic_icon" g_content_type_get_symbolic_icon :: CString -> -- type : TBasicType TUTF8 IO (Ptr Gio.Icon.Icon) -- | Gets the symbolic icon for a content type. -- -- /Since: 2.34/ contentTypeGetSymbolicIcon :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@type@/: a content type string -> m Gio.Icon.Icon -- ^ __Returns:__ symbolic t'GI.Gio.Interfaces.Icon.Icon' corresponding to the content type. -- Free the returned object with 'GI.GObject.Objects.Object.objectUnref' contentTypeGetSymbolicIcon :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Icon contentTypeGetSymbolicIcon Text type_ = IO Icon -> m Icon forall a. IO a -> m a 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 type_' <- Text -> IO CString textToCString Text type_ result <- g_content_type_get_symbolic_icon type_' checkUnexpectedReturnNULL "contentTypeGetSymbolicIcon" result result' <- (wrapObject Gio.Icon.Icon) result freeMem type_' return result' -- function content_type_get_mime_type -- Args: [ Arg -- { argCName = "type" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a content type string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_content_type_get_mime_type" g_content_type_get_mime_type :: CString -> -- type : TBasicType TUTF8 IO CString -- | Gets the mime type for the content type, if one is registered. contentTypeGetMimeType :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@type@/: a content type string -> m (Maybe T.Text) -- ^ __Returns:__ the registered mime type for the -- given /@type@/, or 'P.Nothing' if unknown; free with 'GI.GLib.Functions.free'. contentTypeGetMimeType :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m (Maybe Text) contentTypeGetMimeType Text type_ = IO (Maybe Text) -> m (Maybe Text) forall a. IO a -> m a 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 type_' <- Text -> IO CString textToCString Text type_ result <- g_content_type_get_mime_type type_' maybeResult <- convertIfNonNull result $ \CString result' -> do result'' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result' freeMem result' return result'' freeMem type_' return maybeResult -- function content_type_get_mime_dirs -- Args: [] -- Lengths: [] -- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8)) -- throws : False -- Skip return : False foreign import ccall "g_content_type_get_mime_dirs" g_content_type_get_mime_dirs :: IO (Ptr CString) -- | Get the list of directories which MIME data is loaded from. See -- 'GI.Gio.Functions.contentTypeSetMimeDirs' for details. -- -- /Since: 2.60/ contentTypeGetMimeDirs :: (B.CallStack.HasCallStack, MonadIO m) => m [T.Text] -- ^ __Returns:__ 'P.Nothing'-terminated list of -- directories to load MIME data from, including any @mime\/@ subdirectory, -- and with the first directory to try listed first contentTypeGetMimeDirs :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m [Text] contentTypeGetMimeDirs = IO [Text] -> m [Text] forall a. IO a -> m a 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 result <- IO (Ptr CString) g_content_type_get_mime_dirs checkUnexpectedReturnNULL "contentTypeGetMimeDirs" result result' <- unpackZeroTerminatedUTF8CArray result return result' -- function content_type_get_icon -- Args: [ Arg -- { argCName = "type" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a content type string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "Gio" , name = "Icon" }) -- throws : False -- Skip return : False foreign import ccall "g_content_type_get_icon" g_content_type_get_icon :: CString -> -- type : TBasicType TUTF8 IO (Ptr Gio.Icon.Icon) -- | Gets the icon for a content type. contentTypeGetIcon :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@type@/: a content type string -> m Gio.Icon.Icon -- ^ __Returns:__ t'GI.Gio.Interfaces.Icon.Icon' corresponding to the content type. Free the returned -- object with 'GI.GObject.Objects.Object.objectUnref' contentTypeGetIcon :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Icon contentTypeGetIcon Text type_ = IO Icon -> m Icon forall a. IO a -> m a 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 type_' <- Text -> IO CString textToCString Text type_ result <- g_content_type_get_icon type_' checkUnexpectedReturnNULL "contentTypeGetIcon" result result' <- (wrapObject Gio.Icon.Icon) result freeMem type_' return result' -- function content_type_get_generic_icon_name -- Args: [ Arg -- { argCName = "type" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a content type string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_content_type_get_generic_icon_name" g_content_type_get_generic_icon_name :: CString -> -- type : TBasicType TUTF8 IO CString -- | Gets the generic icon name for a content type. -- -- See the -- <http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec shared-mime-info> -- specification for more on the generic icon name. -- -- /Since: 2.34/ contentTypeGetGenericIconName :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@type@/: a content type string -> m (Maybe T.Text) -- ^ __Returns:__ the registered generic icon name for the given /@type@/, -- or 'P.Nothing' if unknown. Free with 'GI.GLib.Functions.free' contentTypeGetGenericIconName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m (Maybe Text) contentTypeGetGenericIconName Text type_ = IO (Maybe Text) -> m (Maybe Text) forall a. IO a -> m a 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 type_' <- Text -> IO CString textToCString Text type_ result <- g_content_type_get_generic_icon_name type_' maybeResult <- convertIfNonNull result $ \CString result' -> do result'' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result' freeMem result' return result'' freeMem type_' return maybeResult -- function content_type_get_description -- Args: [ Arg -- { argCName = "type" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a content type string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_content_type_get_description" g_content_type_get_description :: CString -> -- type : TBasicType TUTF8 IO CString -- | Gets the human readable description of the content type. contentTypeGetDescription :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@type@/: a content type string -> m T.Text -- ^ __Returns:__ a short description of the content type /@type@/. Free the -- returned string with 'GI.GLib.Functions.free' contentTypeGetDescription :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text contentTypeGetDescription Text type_ = IO Text -> m Text forall a. IO a -> m a 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 type_' <- Text -> IO CString textToCString Text type_ result <- g_content_type_get_description type_' checkUnexpectedReturnNULL "contentTypeGetDescription" result result' <- cstringToText result freeMem result freeMem type_' return result' -- function content_type_from_mime_type -- Args: [ Arg -- { argCName = "mime_type" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a mime type string" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_content_type_from_mime_type" g_content_type_from_mime_type :: CString -> -- mime_type : TBasicType TUTF8 IO CString -- | Tries to find a content type based on the mime type name. -- -- /Since: 2.18/ contentTypeFromMimeType :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@mimeType@/: a mime type string -> m (Maybe T.Text) -- ^ __Returns:__ Newly allocated string with content type or -- 'P.Nothing'. Free with 'GI.GLib.Functions.free' contentTypeFromMimeType :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m (Maybe Text) contentTypeFromMimeType Text mimeType = IO (Maybe Text) -> m (Maybe Text) forall a. IO a -> m a 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 mimeType' <- Text -> IO CString textToCString Text mimeType result <- g_content_type_from_mime_type mimeType' maybeResult <- convertIfNonNull result $ \CString result' -> do result'' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result' freeMem result' return result'' freeMem mimeType' return maybeResult -- function content_type_equals -- Args: [ Arg -- { argCName = "type1" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a content type string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "type2" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a content type string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_content_type_equals" g_content_type_equals :: CString -> -- type1 : TBasicType TUTF8 CString -> -- type2 : TBasicType TUTF8 IO CInt -- | Compares two content types for equality. contentTypeEquals :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@type1@/: a content type string -> T.Text -- ^ /@type2@/: a content type string -> m Bool -- ^ __Returns:__ 'P.True' if the two strings are identical or equivalent, -- 'P.False' otherwise. contentTypeEquals :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> Text -> m Bool contentTypeEquals Text type1 Text type2 = IO Bool -> m Bool forall a. IO a -> m a 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 type1' <- Text -> IO CString textToCString Text type1 type2' <- textToCString type2 result <- g_content_type_equals type1' type2' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem type1' freeMem type2' return result' -- function content_type_can_be_executable -- Args: [ Arg -- { argCName = "type" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a content type string" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_content_type_can_be_executable" g_content_type_can_be_executable :: CString -> -- type : TBasicType TUTF8 IO CInt -- | Checks if a content type can be executable. Note that for instance -- things like text files can be executables (i.e. scripts and batch files). contentTypeCanBeExecutable :: (B.CallStack.HasCallStack, MonadIO m) => T.Text -- ^ /@type@/: a content type string -> m Bool -- ^ __Returns:__ 'P.True' if the file type corresponds to a type that -- can be executable, 'P.False' otherwise. contentTypeCanBeExecutable :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Bool contentTypeCanBeExecutable Text type_ = IO Bool -> m Bool forall a. IO a -> m a 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 type_' <- Text -> IO CString textToCString Text type_ result <- g_content_type_can_be_executable type_' let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result freeMem type_' return result' -- function bus_watch_name_on_connection -- Args: [ Arg -- { argCName = "connection" -- , argType = -- TInterface Name { namespace = "Gio" , name = "DBusConnection" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "A #GDBusConnection." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "name" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The name (well-known or unique) to watch." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "flags" -- , argType = -- TInterface -- Name { namespace = "Gio" , name = "BusNameWatcherFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "Flags from the #GBusNameWatcherFlags enumeration." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "name_appeared_closure" -- , argType = TGClosure Nothing -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "#GClosure to invoke when @name is known\nto exist or %NULL." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "name_vanished_closure" -- , argType = TGClosure Nothing -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "#GClosure to invoke when @name is known\nto not exist or %NULL." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "g_bus_watch_name_on_connection_with_closures" g_bus_watch_name_on_connection_with_closures :: Ptr Gio.DBusConnection.DBusConnection -> -- connection : TInterface (Name {namespace = "Gio", name = "DBusConnection"}) CString -> -- name : TBasicType TUTF8 CUInt -> -- flags : TInterface (Name {namespace = "Gio", name = "BusNameWatcherFlags"}) Ptr (GClosure ()) -> -- name_appeared_closure : TGClosure Nothing Ptr (GClosure ()) -> -- name_vanished_closure : TGClosure Nothing IO Word32 -- | Version of @/g_bus_watch_name_on_connection()/@ using closures instead of callbacks for -- easier binding in other languages. -- -- /Since: 2.26/ busWatchNameOnConnection :: (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) => a -- ^ /@connection@/: A t'GI.Gio.Objects.DBusConnection.DBusConnection'. -> T.Text -- ^ /@name@/: The name (well-known or unique) to watch. -> [Gio.Flags.BusNameWatcherFlags] -- ^ /@flags@/: Flags from the t'GI.Gio.Flags.BusNameWatcherFlags' enumeration. -> Maybe (GClosure b) -- ^ /@nameAppearedClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is known -- to exist or 'P.Nothing'. -> Maybe (GClosure c) -- ^ /@nameVanishedClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is known -- to not exist or 'P.Nothing'. -> m Word32 -- ^ __Returns:__ An identifier (never 0) that can be used with -- 'GI.Gio.Functions.busUnwatchName' to stop watching the name. busWatchNameOnConnection :: forall (m :: * -> *) a b c. (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Text -> [BusNameWatcherFlags] -> Maybe (GClosure b) -> Maybe (GClosure c) -> m Word32 busWatchNameOnConnection a connection Text name [BusNameWatcherFlags] flags Maybe (GClosure b) nameAppearedClosure Maybe (GClosure c) nameVanishedClosure = IO Word32 -> m Word32 forall a. IO a -> m a 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 connection' <- a -> IO (Ptr DBusConnection) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a connection name' <- textToCString name let flags' = [BusNameWatcherFlags] -> CUInt forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [BusNameWatcherFlags] flags maybeNameAppearedClosure <- case nameAppearedClosure of Maybe (GClosure b) Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ())) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr (GClosure ()) forall a. Ptr a FP.nullPtr Just GClosure b jNameAppearedClosure -> do jNameAppearedClosure' <- GClosure b -> IO (Ptr (GClosure ())) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr GClosure b jNameAppearedClosure return jNameAppearedClosure' maybeNameVanishedClosure <- case nameVanishedClosure of Maybe (GClosure c) Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ())) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr (GClosure ()) forall a. Ptr a FP.nullPtr Just GClosure c jNameVanishedClosure -> do jNameVanishedClosure' <- GClosure c -> IO (Ptr (GClosure ())) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr GClosure c jNameVanishedClosure return jNameVanishedClosure' result <- g_bus_watch_name_on_connection_with_closures connection' name' flags' maybeNameAppearedClosure maybeNameVanishedClosure touchManagedPtr connection whenJust nameAppearedClosure touchManagedPtr whenJust nameVanishedClosure touchManagedPtr freeMem name' return result -- function bus_watch_name -- Args: [ Arg -- { argCName = "bus_type" -- , argType = -- TInterface Name { namespace = "Gio" , name = "BusType" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The type of bus to watch a name on." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "name" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The name (well-known or unique) to watch." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "flags" -- , argType = -- TInterface -- Name { namespace = "Gio" , name = "BusNameWatcherFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "Flags from the #GBusNameWatcherFlags enumeration." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "name_appeared_closure" -- , argType = TGClosure Nothing -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "#GClosure to invoke when @name is known\nto exist or %NULL." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "name_vanished_closure" -- , argType = TGClosure Nothing -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "#GClosure to invoke when @name is known\nto not exist or %NULL." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "g_bus_watch_name_with_closures" g_bus_watch_name_with_closures :: CInt -> -- bus_type : TInterface (Name {namespace = "Gio", name = "BusType"}) CString -> -- name : TBasicType TUTF8 CUInt -> -- flags : TInterface (Name {namespace = "Gio", name = "BusNameWatcherFlags"}) Ptr (GClosure ()) -> -- name_appeared_closure : TGClosure Nothing Ptr (GClosure ()) -> -- name_vanished_closure : TGClosure Nothing IO Word32 -- | Version of @/g_bus_watch_name()/@ using closures instead of callbacks for -- easier binding in other languages. -- -- /Since: 2.26/ busWatchName :: (B.CallStack.HasCallStack, MonadIO m) => Gio.Enums.BusType -- ^ /@busType@/: The type of bus to watch a name on. -> T.Text -- ^ /@name@/: The name (well-known or unique) to watch. -> [Gio.Flags.BusNameWatcherFlags] -- ^ /@flags@/: Flags from the t'GI.Gio.Flags.BusNameWatcherFlags' enumeration. -> Maybe (GClosure a) -- ^ /@nameAppearedClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is known -- to exist or 'P.Nothing'. -> Maybe (GClosure b) -- ^ /@nameVanishedClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is known -- to not exist or 'P.Nothing'. -> m Word32 -- ^ __Returns:__ An identifier (never 0) that can be used with -- 'GI.Gio.Functions.busUnwatchName' to stop watching the name. busWatchName :: forall (m :: * -> *) a b. (HasCallStack, MonadIO m) => BusType -> Text -> [BusNameWatcherFlags] -> Maybe (GClosure a) -> Maybe (GClosure b) -> m Word32 busWatchName BusType busType Text name [BusNameWatcherFlags] flags Maybe (GClosure a) nameAppearedClosure Maybe (GClosure b) nameVanishedClosure = IO Word32 -> m Word32 forall a. IO a -> m a 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 name' <- Text -> IO CString textToCString Text name let flags' = [BusNameWatcherFlags] -> CUInt forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [BusNameWatcherFlags] flags maybeNameAppearedClosure <- case nameAppearedClosure of Maybe (GClosure a) Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ())) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr (GClosure ()) forall a. Ptr a FP.nullPtr Just GClosure a jNameAppearedClosure -> do jNameAppearedClosure' <- GClosure a -> IO (Ptr (GClosure ())) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr GClosure a jNameAppearedClosure return jNameAppearedClosure' maybeNameVanishedClosure <- case nameVanishedClosure of Maybe (GClosure b) Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ())) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr (GClosure ()) forall a. Ptr a FP.nullPtr Just GClosure b jNameVanishedClosure -> do jNameVanishedClosure' <- GClosure b -> IO (Ptr (GClosure ())) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr GClosure b jNameVanishedClosure return jNameVanishedClosure' result <- g_bus_watch_name_with_closures busType' name' flags' maybeNameAppearedClosure maybeNameVanishedClosure whenJust nameAppearedClosure touchManagedPtr whenJust nameVanishedClosure touchManagedPtr freeMem name' return result -- function bus_unwatch_name -- Args: [ Arg -- { argCName = "watcher_id" -- , argType = TBasicType TUInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "An identifier obtained from g_bus_watch_name()" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_bus_unwatch_name" g_bus_unwatch_name :: Word32 -> -- watcher_id : TBasicType TUInt IO () -- | Stops watching a name. -- -- Note that there may still be D-Bus traffic to process (relating to watching -- and unwatching the name) in the current thread-default t'GI.GLib.Structs.MainContext.MainContext' after -- this function has returned. You should continue to iterate the t'GI.GLib.Structs.MainContext.MainContext' -- until the t'GI.GLib.Callbacks.DestroyNotify' function passed to @/g_bus_watch_name()/@ is called, in -- order to avoid memory leaks through callbacks queued on the t'GI.GLib.Structs.MainContext.MainContext' -- after it’s stopped being iterated. -- -- /Since: 2.26/ busUnwatchName :: (B.CallStack.HasCallStack, MonadIO m) => Word32 -- ^ /@watcherId@/: An identifier obtained from @/g_bus_watch_name()/@ -> m () busUnwatchName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word32 -> m () busUnwatchName Word32 watcherId = IO () -> m () forall a. IO a -> m a 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 a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return () -- function bus_unown_name -- Args: [ Arg -- { argCName = "owner_id" -- , argType = TBasicType TUInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "an identifier obtained from g_bus_own_name()" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_bus_unown_name" g_bus_unown_name :: Word32 -> -- owner_id : TBasicType TUInt IO () -- | Stops owning a name. -- -- Note that there may still be D-Bus traffic to process (relating to owning -- and unowning the name) in the current thread-default t'GI.GLib.Structs.MainContext.MainContext' after -- this function has returned. You should continue to iterate the t'GI.GLib.Structs.MainContext.MainContext' -- until the t'GI.GLib.Callbacks.DestroyNotify' function passed to @/g_bus_own_name()/@ is called, in -- order to avoid memory leaks through callbacks queued on the t'GI.GLib.Structs.MainContext.MainContext' -- after it’s stopped being iterated. -- -- /Since: 2.26/ busUnownName :: (B.CallStack.HasCallStack, MonadIO m) => Word32 -- ^ /@ownerId@/: an identifier obtained from @/g_bus_own_name()/@ -> m () busUnownName :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word32 -> m () busUnownName Word32 ownerId = IO () -> m () forall a. IO a -> m a 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 a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return () -- function bus_own_name_on_connection -- Args: [ Arg -- { argCName = "connection" -- , argType = -- TInterface Name { namespace = "Gio" , name = "DBusConnection" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GDBusConnection" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "name" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the well-known name to own" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "Gio" , name = "BusNameOwnerFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "a set of flags from the #GBusNameOwnerFlags enumeration" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "name_acquired_closure" -- , argType = TGClosure Nothing -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "#GClosure to invoke when @name is\n acquired or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "name_lost_closure" -- , argType = TGClosure Nothing -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "#GClosure to invoke when @name is lost\n or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "g_bus_own_name_on_connection_with_closures" g_bus_own_name_on_connection_with_closures :: Ptr Gio.DBusConnection.DBusConnection -> -- connection : TInterface (Name {namespace = "Gio", name = "DBusConnection"}) CString -> -- name : TBasicType TUTF8 CUInt -> -- flags : TInterface (Name {namespace = "Gio", name = "BusNameOwnerFlags"}) Ptr (GClosure ()) -> -- name_acquired_closure : TGClosure Nothing Ptr (GClosure ()) -> -- name_lost_closure : TGClosure Nothing IO Word32 -- | Version of @/g_bus_own_name_on_connection()/@ using closures instead of -- callbacks for easier binding in other languages. -- -- /Since: 2.26/ busOwnNameOnConnection :: (B.CallStack.HasCallStack, MonadIO m, Gio.DBusConnection.IsDBusConnection a) => a -- ^ /@connection@/: a t'GI.Gio.Objects.DBusConnection.DBusConnection' -> T.Text -- ^ /@name@/: the well-known name to own -> [Gio.Flags.BusNameOwnerFlags] -- ^ /@flags@/: a set of flags from the t'GI.Gio.Flags.BusNameOwnerFlags' enumeration -> Maybe (GClosure b) -- ^ /@nameAcquiredClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is -- acquired or 'P.Nothing' -> Maybe (GClosure c) -- ^ /@nameLostClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is lost -- or 'P.Nothing' -> m Word32 -- ^ __Returns:__ an identifier (never 0) that can be used with -- 'GI.Gio.Functions.busUnownName' to stop owning the name. busOwnNameOnConnection :: forall (m :: * -> *) a b c. (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Text -> [BusNameOwnerFlags] -> Maybe (GClosure b) -> Maybe (GClosure c) -> m Word32 busOwnNameOnConnection a connection Text name [BusNameOwnerFlags] flags Maybe (GClosure b) nameAcquiredClosure Maybe (GClosure c) nameLostClosure = IO Word32 -> m Word32 forall a. IO a -> m a 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 connection' <- a -> IO (Ptr DBusConnection) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a connection name' <- textToCString name let flags' = [BusNameOwnerFlags] -> CUInt forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [BusNameOwnerFlags] flags maybeNameAcquiredClosure <- case nameAcquiredClosure of Maybe (GClosure b) Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ())) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr (GClosure ()) forall a. Ptr a FP.nullPtr Just GClosure b jNameAcquiredClosure -> do jNameAcquiredClosure' <- GClosure b -> IO (Ptr (GClosure ())) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr GClosure b jNameAcquiredClosure return jNameAcquiredClosure' maybeNameLostClosure <- case nameLostClosure of Maybe (GClosure c) Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ())) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr (GClosure ()) forall a. Ptr a FP.nullPtr Just GClosure c jNameLostClosure -> do jNameLostClosure' <- GClosure c -> IO (Ptr (GClosure ())) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr GClosure c jNameLostClosure return jNameLostClosure' result <- g_bus_own_name_on_connection_with_closures connection' name' flags' maybeNameAcquiredClosure maybeNameLostClosure touchManagedPtr connection whenJust nameAcquiredClosure touchManagedPtr whenJust nameLostClosure touchManagedPtr freeMem name' return result -- function bus_own_name -- Args: [ Arg -- { argCName = "bus_type" -- , argType = -- TInterface Name { namespace = "Gio" , name = "BusType" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the type of bus to own a name on" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "name" -- , argType = TBasicType TUTF8 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the well-known name to own" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "flags" -- , argType = -- TInterface Name { namespace = "Gio" , name = "BusNameOwnerFlags" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "a set of flags from the #GBusNameOwnerFlags enumeration" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "bus_acquired_closure" -- , argType = TGClosure Nothing -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "#GClosure to invoke when connected to\n the bus of type @bus_type or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "name_acquired_closure" -- , argType = TGClosure Nothing -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "#GClosure to invoke when @name is\n acquired or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "name_lost_closure" -- , argType = TGClosure Nothing -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "#GClosure to invoke when @name is lost or\n %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "g_bus_own_name_with_closures" g_bus_own_name_with_closures :: CInt -> -- bus_type : TInterface (Name {namespace = "Gio", name = "BusType"}) CString -> -- name : TBasicType TUTF8 CUInt -> -- flags : TInterface (Name {namespace = "Gio", name = "BusNameOwnerFlags"}) Ptr (GClosure ()) -> -- bus_acquired_closure : TGClosure Nothing Ptr (GClosure ()) -> -- name_acquired_closure : TGClosure Nothing Ptr (GClosure ()) -> -- name_lost_closure : TGClosure Nothing IO Word32 -- | Version of @/g_bus_own_name()/@ using closures instead of callbacks for -- easier binding in other languages. -- -- /Since: 2.26/ busOwnName :: (B.CallStack.HasCallStack, MonadIO m) => Gio.Enums.BusType -- ^ /@busType@/: the type of bus to own a name on -> T.Text -- ^ /@name@/: the well-known name to own -> [Gio.Flags.BusNameOwnerFlags] -- ^ /@flags@/: a set of flags from the t'GI.Gio.Flags.BusNameOwnerFlags' enumeration -> Maybe (GClosure a) -- ^ /@busAcquiredClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when connected to -- the bus of type /@busType@/ or 'P.Nothing' -> Maybe (GClosure b) -- ^ /@nameAcquiredClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is -- acquired or 'P.Nothing' -> Maybe (GClosure c) -- ^ /@nameLostClosure@/: t'GI.GObject.Structs.Closure.Closure' to invoke when /@name@/ is lost or -- 'P.Nothing' -> m Word32 -- ^ __Returns:__ an identifier (never 0) that can be used with -- 'GI.Gio.Functions.busUnownName' to stop owning the name. busOwnName :: forall (m :: * -> *) a b c. (HasCallStack, MonadIO m) => BusType -> Text -> [BusNameOwnerFlags] -> Maybe (GClosure a) -> Maybe (GClosure b) -> Maybe (GClosure c) -> m Word32 busOwnName BusType busType Text name [BusNameOwnerFlags] flags Maybe (GClosure a) busAcquiredClosure Maybe (GClosure b) nameAcquiredClosure Maybe (GClosure c) nameLostClosure = IO Word32 -> m Word32 forall a. IO a -> m a 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 name' <- Text -> IO CString textToCString Text name let flags' = [BusNameOwnerFlags] -> CUInt forall b a. (Num b, IsGFlag a) => [a] -> b gflagsToWord [BusNameOwnerFlags] flags maybeBusAcquiredClosure <- case busAcquiredClosure of Maybe (GClosure a) Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ())) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr (GClosure ()) forall a. Ptr a FP.nullPtr Just GClosure a jBusAcquiredClosure -> do jBusAcquiredClosure' <- GClosure a -> IO (Ptr (GClosure ())) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr GClosure a jBusAcquiredClosure return jBusAcquiredClosure' maybeNameAcquiredClosure <- case nameAcquiredClosure of Maybe (GClosure b) Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ())) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr (GClosure ()) forall a. Ptr a FP.nullPtr Just GClosure b jNameAcquiredClosure -> do jNameAcquiredClosure' <- GClosure b -> IO (Ptr (GClosure ())) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr GClosure b jNameAcquiredClosure return jNameAcquiredClosure' maybeNameLostClosure <- case nameLostClosure of Maybe (GClosure c) Nothing -> Ptr (GClosure ()) -> IO (Ptr (GClosure ())) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr (GClosure ()) forall a. Ptr a FP.nullPtr Just GClosure c jNameLostClosure -> do jNameLostClosure' <- GClosure c -> IO (Ptr (GClosure ())) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr GClosure c jNameLostClosure return jNameLostClosure' result <- g_bus_own_name_with_closures busType' name' flags' maybeBusAcquiredClosure maybeNameAcquiredClosure maybeNameLostClosure whenJust busAcquiredClosure touchManagedPtr whenJust nameAcquiredClosure touchManagedPtr whenJust nameLostClosure touchManagedPtr freeMem name' return result -- function bus_get_sync -- Args: [ Arg -- { argCName = "bus_type" -- , argType = -- TInterface Name { namespace = "Gio" , name = "BusType" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GBusType" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "cancellable" -- , argType = -- TInterface Name { namespace = "Gio" , name = "Cancellable" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "a #GCancellable or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just -- (TInterface Name { namespace = "Gio" , name = "DBusConnection" }) -- throws : True -- Skip return : False foreign import ccall "g_bus_get_sync" g_bus_get_sync :: CInt -> -- bus_type : TInterface (Name {namespace = "Gio", name = "BusType"}) Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) Ptr (Ptr GError) -> -- error IO (Ptr Gio.DBusConnection.DBusConnection) -- | Synchronously connects to the message bus specified by /@busType@/. -- Note that the returned object may shared with other callers, -- e.g. if two separate parts of a process calls this function with -- the same /@busType@/, they will share the same object. -- -- This is a synchronous failable function. See 'GI.Gio.Functions.busGet' and -- 'GI.Gio.Functions.busGetFinish' for the asynchronous version. -- -- The returned object is a singleton, that is, shared with other -- callers of 'GI.Gio.Functions.busGet' and 'GI.Gio.Functions.busGetSync' for /@busType@/. In the -- event that you need a private message bus connection, use -- 'GI.Gio.Functions.dbusAddressGetForBusSync' and -- 'GI.Gio.Objects.DBusConnection.dBusConnectionNewForAddress' with -- G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT and -- G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flags. -- -- Note that the returned t'GI.Gio.Objects.DBusConnection.DBusConnection' object will (usually) have -- the [DBusConnection:exitOnClose]("GI.Gio.Objects.DBusConnection#g:attr:exitOnClose") property set to 'P.True'. -- -- /Since: 2.26/ busGetSync :: (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) => Gio.Enums.BusType -- ^ /@busType@/: a t'GI.Gio.Enums.BusType' -> Maybe (a) -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing' -> m Gio.DBusConnection.DBusConnection -- ^ __Returns:__ a t'GI.Gio.Objects.DBusConnection.DBusConnection' or 'P.Nothing' if /@error@/ is set. -- Free with 'GI.GObject.Objects.Object.objectUnref'. /(Can throw 'Data.GI.Base.GError.GError')/ busGetSync :: forall (m :: * -> *) a. (HasCallStack, MonadIO m, IsCancellable a) => BusType -> Maybe a -> m DBusConnection busGetSync BusType busType Maybe a cancellable = IO DBusConnection -> m DBusConnection forall a. IO a -> m a 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 maybeCancellable <- case Maybe a cancellable of Maybe a Nothing -> Ptr Cancellable -> IO (Ptr Cancellable) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr Cancellable forall a. Ptr a FP.nullPtr Just a jCancellable -> do jCancellable' <- a -> IO (Ptr Cancellable) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a jCancellable return jCancellable' onException (do result <- propagateGError $ g_bus_get_sync busType' maybeCancellable checkUnexpectedReturnNULL "busGetSync" result result' <- (wrapObject Gio.DBusConnection.DBusConnection) result whenJust cancellable touchManagedPtr return result' ) (do return () ) -- function bus_get_finish -- Args: [ Arg -- { argCName = "res" -- , argType = -- TInterface Name { namespace = "Gio" , name = "AsyncResult" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "a #GAsyncResult obtained from the #GAsyncReadyCallback passed\n to g_bus_get()" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just -- (TInterface Name { namespace = "Gio" , name = "DBusConnection" }) -- throws : True -- Skip return : False foreign import ccall "g_bus_get_finish" g_bus_get_finish :: Ptr Gio.AsyncResult.AsyncResult -> -- res : TInterface (Name {namespace = "Gio", name = "AsyncResult"}) Ptr (Ptr GError) -> -- error IO (Ptr Gio.DBusConnection.DBusConnection) -- | Finishes an operation started with 'GI.Gio.Functions.busGet'. -- -- The returned object is a singleton, that is, shared with other -- callers of 'GI.Gio.Functions.busGet' and 'GI.Gio.Functions.busGetSync' for /@busType@/. In the -- event that you need a private message bus connection, use -- 'GI.Gio.Functions.dbusAddressGetForBusSync' and -- 'GI.Gio.Objects.DBusConnection.dBusConnectionNewForAddress' with -- G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT and -- G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flags. -- -- Note that the returned t'GI.Gio.Objects.DBusConnection.DBusConnection' object will (usually) have -- the [DBusConnection:exitOnClose]("GI.Gio.Objects.DBusConnection#g:attr:exitOnClose") property set to 'P.True'. -- -- /Since: 2.26/ busGetFinish :: (B.CallStack.HasCallStack, MonadIO m, Gio.AsyncResult.IsAsyncResult a) => a -- ^ /@res@/: a t'GI.Gio.Interfaces.AsyncResult.AsyncResult' obtained from the t'GI.Gio.Callbacks.AsyncReadyCallback' passed -- to 'GI.Gio.Functions.busGet' -> m Gio.DBusConnection.DBusConnection -- ^ __Returns:__ a t'GI.Gio.Objects.DBusConnection.DBusConnection' or 'P.Nothing' if /@error@/ is set. -- Free with 'GI.GObject.Objects.Object.objectUnref'. /(Can throw 'Data.GI.Base.GError.GError')/ busGetFinish :: forall (m :: * -> *) a. (HasCallStack, MonadIO m, IsAsyncResult a) => a -> m DBusConnection busGetFinish a res = IO DBusConnection -> m DBusConnection forall a. IO a -> m a 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 res' <- a -> IO (Ptr AsyncResult) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a res onException (do result <- propagateGError $ g_bus_get_finish res' checkUnexpectedReturnNULL "busGetFinish" result result' <- (wrapObject Gio.DBusConnection.DBusConnection) result touchManagedPtr res return result' ) (do return () ) -- function bus_get -- Args: [ Arg -- { argCName = "bus_type" -- , argType = -- TInterface Name { namespace = "Gio" , name = "BusType" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GBusType" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "cancellable" -- , argType = -- TInterface Name { namespace = "Gio" , name = "Cancellable" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "a #GCancellable or %NULL" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "callback" -- , argType = -- TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" } -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just "a #GAsyncReadyCallback to call when the request is satisfied" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeAsync -- , argClosure = 3 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "user_data" -- , argType = TBasicType TPtr -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "the data to pass to @callback" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_bus_get" g_bus_get :: CInt -> -- bus_type : TInterface (Name {namespace = "Gio", name = "BusType"}) Ptr Gio.Cancellable.Cancellable -> -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"}) FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"}) Ptr () -> -- user_data : TBasicType TPtr IO () -- | Asynchronously connects to the message bus specified by /@busType@/. -- -- When the operation is finished, /@callback@/ will be invoked. You can -- then call 'GI.Gio.Functions.busGetFinish' to get the result of the operation. -- -- This is an asynchronous failable function. See 'GI.Gio.Functions.busGetSync' for -- the synchronous version. -- -- /Since: 2.26/ busGet :: (B.CallStack.HasCallStack, MonadIO m, Gio.Cancellable.IsCancellable a) => Gio.Enums.BusType -- ^ /@busType@/: a t'GI.Gio.Enums.BusType' -> Maybe (a) -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable' or 'P.Nothing' -> Maybe (Gio.Callbacks.AsyncReadyCallback) -- ^ /@callback@/: a t'GI.Gio.Callbacks.AsyncReadyCallback' to call when the request is satisfied -> m () busGet :: forall (m :: * -> *) a. (HasCallStack, MonadIO m, IsCancellable a) => BusType -> Maybe a -> Maybe AsyncReadyCallback -> m () busGet BusType busType Maybe a cancellable Maybe AsyncReadyCallback callback = IO () -> m () forall a. IO a -> m a 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 maybeCancellable <- case Maybe a cancellable of Maybe a Nothing -> Ptr Cancellable -> IO (Ptr Cancellable) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr Cancellable forall a. Ptr a FP.nullPtr Just a jCancellable -> do jCancellable' <- a -> IO (Ptr Cancellable) forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b) unsafeManagedPtrCastPtr a jCancellable return jCancellable' maybeCallback <- case callback of Maybe AsyncReadyCallback Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return FunPtr C_AsyncReadyCallback forall a. FunPtr a FP.nullFunPtr Just AsyncReadyCallback jCallback -> do ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback)) forall a. Storable a => IO (Ptr a) callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback)) jCallback' <- Gio.Callbacks.mk_AsyncReadyCallback (Gio.Callbacks.wrap_AsyncReadyCallback (Just ptrcallback) (Gio.Callbacks.drop_closures_AsyncReadyCallback jCallback)) poke ptrcallback jCallback' return jCallback' let userData = Ptr a forall a. Ptr a nullPtr g_bus_get busType' maybeCancellable maybeCallback userData whenJust cancellable touchManagedPtr return ()