Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
- Methods
- busGet
- busGetFinish
- busGetSync
- busOwnName
- busOwnNameOnConnection
- busUnownName
- busUnwatchName
- busWatchName
- busWatchNameOnConnection
- contentTypeCanBeExecutable
- contentTypeEquals
- contentTypeFromMimeType
- contentTypeGetDescription
- contentTypeGetGenericIconName
- contentTypeGetIcon
- contentTypeGetMimeDirs
- contentTypeGetMimeType
- contentTypeGetSymbolicIcon
- contentTypeGuess
- contentTypeGuessForTree
- contentTypeIsA
- contentTypeIsMimeType
- contentTypeIsUnknown
- contentTypeSetMimeDirs
- contentTypesGetRegistered
- dbusAddressEscapeValue
- dbusAddressGetForBusSync
- dbusAddressGetStream
- dbusAddressGetStreamFinish
- dbusAddressGetStreamSync
- dbusGenerateGuid
- dbusGvalueToGvariant
- dbusGvariantToGvalue
- dbusIsAddress
- dbusIsGuid
- dbusIsInterfaceName
- dbusIsMemberName
- dbusIsName
- dbusIsSupportedAddress
- dbusIsUniqueName
- ioErrorFromErrno
- ioErrorQuark
- ioModulesScanAllInDirectory
- ioModulesScanAllInDirectoryWithScope
- ioSchedulerCancelAllJobs
- ioSchedulerPushJob
- keyfileSettingsBackendNew
- memorySettingsBackendNew
- networkingInit
- nullSettingsBackendNew
- pollableSourceNew
- pollableSourceNewFull
- pollableStreamRead
- pollableStreamWrite
- pollableStreamWriteAll
- resourcesEnumerateChildren
- resourcesGetInfo
- resourcesLookupData
- resourcesOpenStream
- resourcesRegister
- resourcesUnregister
- simpleAsyncReportGerrorInIdle
- unixIsMountPathSystemInternal
- unixIsSystemDevicePath
- unixIsSystemFsType
- unixMountAt
- unixMountCompare
- unixMountCopy
- unixMountFor
- unixMountFree
- unixMountGetDevicePath
- unixMountGetFsType
- unixMountGetMountPath
- unixMountGetOptions
- unixMountGetRootPath
- unixMountGuessCanEject
- unixMountGuessIcon
- unixMountGuessName
- unixMountGuessShouldDisplay
- unixMountGuessSymbolicIcon
- unixMountIsReadonly
- unixMountIsSystemInternal
- unixMountPointsChangedSince
- unixMountPointsGet
- unixMountsChangedSince
- unixMountsGet
Synopsis
- busGet :: (HasCallStack, MonadIO m, IsCancellable a) => BusType -> Maybe a -> Maybe AsyncReadyCallback -> m ()
- busGetFinish :: (HasCallStack, MonadIO m, IsAsyncResult a) => a -> m DBusConnection
- busGetSync :: (HasCallStack, MonadIO m, IsCancellable a) => BusType -> Maybe a -> m DBusConnection
- busOwnName :: (HasCallStack, MonadIO m) => BusType -> Text -> [BusNameOwnerFlags] -> Maybe (GClosure a) -> Maybe (GClosure b) -> Maybe (GClosure c) -> m Word32
- busOwnNameOnConnection :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Text -> [BusNameOwnerFlags] -> Maybe (GClosure b) -> Maybe (GClosure c) -> m Word32
- busUnownName :: (HasCallStack, MonadIO m) => Word32 -> m ()
- busUnwatchName :: (HasCallStack, MonadIO m) => Word32 -> m ()
- busWatchName :: (HasCallStack, MonadIO m) => BusType -> Text -> [BusNameWatcherFlags] -> Maybe (GClosure a) -> Maybe (GClosure b) -> m Word32
- busWatchNameOnConnection :: (HasCallStack, MonadIO m, IsDBusConnection a) => a -> Text -> [BusNameWatcherFlags] -> Maybe (GClosure b) -> Maybe (GClosure c) -> m Word32
- contentTypeCanBeExecutable :: (HasCallStack, MonadIO m) => Text -> m Bool
- contentTypeEquals :: (HasCallStack, MonadIO m) => Text -> Text -> m Bool
- contentTypeFromMimeType :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- contentTypeGetDescription :: (HasCallStack, MonadIO m) => Text -> m Text
- contentTypeGetGenericIconName :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- contentTypeGetIcon :: (HasCallStack, MonadIO m) => Text -> m Icon
- contentTypeGetMimeDirs :: (HasCallStack, MonadIO m) => m [Text]
- contentTypeGetMimeType :: (HasCallStack, MonadIO m) => Text -> m (Maybe Text)
- contentTypeGetSymbolicIcon :: (HasCallStack, MonadIO m) => Text -> m Icon
- contentTypeGuess :: (HasCallStack, MonadIO m) => Maybe Text -> Maybe ByteString -> m (Text, Bool)
- contentTypeGuessForTree :: (HasCallStack, MonadIO m, IsFile a) => a -> m [Text]
- contentTypeIsA :: (HasCallStack, MonadIO m) => Text -> Text -> m Bool
- contentTypeIsMimeType :: (HasCallStack, MonadIO m) => Text -> Text -> m Bool
- contentTypeIsUnknown :: (HasCallStack, MonadIO m) => Text -> m Bool
- contentTypeSetMimeDirs :: (HasCallStack, MonadIO m) => Maybe [Text] -> m ()
- contentTypesGetRegistered :: (HasCallStack, MonadIO m) => m [Text]
- dbusAddressEscapeValue :: (HasCallStack, MonadIO m) => Text -> m Text
- dbusAddressGetForBusSync :: (HasCallStack, MonadIO m, IsCancellable a) => BusType -> Maybe a -> m Text
- dbusAddressGetStream :: (HasCallStack, MonadIO m, IsCancellable a) => Text -> Maybe a -> Maybe AsyncReadyCallback -> m ()
- dbusAddressGetStreamFinish :: (HasCallStack, MonadIO m, IsAsyncResult a) => a -> m (IOStream, Text)
- dbusAddressGetStreamSync :: (HasCallStack, MonadIO m, IsCancellable a) => Text -> Maybe a -> m (IOStream, Text)
- dbusGenerateGuid :: (HasCallStack, MonadIO m) => m Text
- dbusGvalueToGvariant :: (HasCallStack, MonadIO m) => GValue -> VariantType -> m GVariant
- dbusGvariantToGvalue :: (HasCallStack, MonadIO m) => GVariant -> m GValue
- dbusIsAddress :: (HasCallStack, MonadIO m) => Text -> m Bool
- dbusIsGuid :: (HasCallStack, MonadIO m) => Text -> m Bool
- dbusIsInterfaceName :: (HasCallStack, MonadIO m) => Text -> m Bool
- dbusIsMemberName :: (HasCallStack, MonadIO m) => Text -> m Bool
- dbusIsName :: (HasCallStack, MonadIO m) => Text -> m Bool
- dbusIsSupportedAddress :: (HasCallStack, MonadIO m) => Text -> m ()
- dbusIsUniqueName :: (HasCallStack, MonadIO m) => Text -> m Bool
- ioErrorFromErrno :: (HasCallStack, MonadIO m) => Int32 -> m IOErrorEnum
- ioErrorQuark :: (HasCallStack, MonadIO m) => m Word32
- ioModulesScanAllInDirectory :: (HasCallStack, MonadIO m) => [Char] -> m ()
- ioModulesScanAllInDirectoryWithScope :: (HasCallStack, MonadIO m) => [Char] -> IOModuleScope -> m ()
- ioSchedulerCancelAllJobs :: (HasCallStack, MonadIO m) => m ()
- ioSchedulerPushJob :: (HasCallStack, MonadIO m, IsCancellable a) => IOSchedulerJobFunc -> Int32 -> Maybe a -> m ()
- keyfileSettingsBackendNew :: (HasCallStack, MonadIO m) => Text -> Text -> Maybe Text -> m SettingsBackend
- memorySettingsBackendNew :: (HasCallStack, MonadIO m) => m SettingsBackend
- networkingInit :: (HasCallStack, MonadIO m) => m ()
- nullSettingsBackendNew :: (HasCallStack, MonadIO m) => m SettingsBackend
- pollableSourceNew :: (HasCallStack, MonadIO m, IsObject a) => a -> m Source
- pollableSourceNewFull :: (HasCallStack, MonadIO m, IsObject a, IsCancellable b) => a -> Maybe Source -> Maybe b -> m Source
- pollableStreamRead :: (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) => a -> ByteString -> Bool -> Maybe b -> m Int64
- pollableStreamWrite :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> ByteString -> Bool -> Maybe b -> m Int64
- pollableStreamWriteAll :: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) => a -> ByteString -> Bool -> Maybe b -> m Word64
- resourcesEnumerateChildren :: (HasCallStack, MonadIO m) => Text -> [ResourceLookupFlags] -> m [Text]
- resourcesGetInfo :: (HasCallStack, MonadIO m) => Text -> [ResourceLookupFlags] -> m (Word64, Word32)
- resourcesLookupData :: (HasCallStack, MonadIO m) => Text -> [ResourceLookupFlags] -> m Bytes
- resourcesOpenStream :: (HasCallStack, MonadIO m) => Text -> [ResourceLookupFlags] -> m InputStream
- resourcesRegister :: (HasCallStack, MonadIO m) => Resource -> m ()
- resourcesUnregister :: (HasCallStack, MonadIO m) => Resource -> m ()
- simpleAsyncReportGerrorInIdle :: (HasCallStack, MonadIO m, IsObject a) => Maybe a -> Maybe AsyncReadyCallback -> GError -> m ()
- unixIsMountPathSystemInternal :: (HasCallStack, MonadIO m) => [Char] -> m Bool
- unixIsSystemDevicePath :: (HasCallStack, MonadIO m) => Text -> m Bool
- unixIsSystemFsType :: (HasCallStack, MonadIO m) => Text -> m Bool
- unixMountAt :: (HasCallStack, MonadIO m) => [Char] -> m (UnixMountEntry, Word64)
- unixMountCompare :: (HasCallStack, MonadIO m) => UnixMountEntry -> UnixMountEntry -> m Int32
- unixMountCopy :: (HasCallStack, MonadIO m) => UnixMountEntry -> m UnixMountEntry
- unixMountFor :: (HasCallStack, MonadIO m) => [Char] -> m (UnixMountEntry, Word64)
- unixMountFree :: (HasCallStack, MonadIO m) => UnixMountEntry -> m ()
- unixMountGetDevicePath :: (HasCallStack, MonadIO m) => UnixMountEntry -> m [Char]
- unixMountGetFsType :: (HasCallStack, MonadIO m) => UnixMountEntry -> m Text
- unixMountGetMountPath :: (HasCallStack, MonadIO m) => UnixMountEntry -> m [Char]
- unixMountGetOptions :: (HasCallStack, MonadIO m) => UnixMountEntry -> m (Maybe Text)
- unixMountGetRootPath :: (HasCallStack, MonadIO m) => UnixMountEntry -> m (Maybe Text)
- unixMountGuessCanEject :: (HasCallStack, MonadIO m) => UnixMountEntry -> m Bool
- unixMountGuessIcon :: (HasCallStack, MonadIO m) => UnixMountEntry -> m Icon
- unixMountGuessName :: (HasCallStack, MonadIO m) => UnixMountEntry -> m Text
- unixMountGuessShouldDisplay :: (HasCallStack, MonadIO m) => UnixMountEntry -> m Bool
- unixMountGuessSymbolicIcon :: (HasCallStack, MonadIO m) => UnixMountEntry -> m Icon
- unixMountIsReadonly :: (HasCallStack, MonadIO m) => UnixMountEntry -> m Bool
- unixMountIsSystemInternal :: (HasCallStack, MonadIO m) => UnixMountEntry -> m Bool
- unixMountPointsChangedSince :: (HasCallStack, MonadIO m) => Word64 -> m Bool
- unixMountPointsGet :: (HasCallStack, MonadIO m) => m ([UnixMountPoint], Word64)
- unixMountsChangedSince :: (HasCallStack, MonadIO m) => Word64 -> m Bool
- unixMountsGet :: (HasCallStack, MonadIO m) => m ([UnixMountEntry], Word64)
Methods
busGet
:: (HasCallStack, MonadIO m, IsCancellable a) | |
=> BusType |
|
-> Maybe a |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Asynchronously connects to the message bus specified by busType
.
When the operation is finished, callback
will be invoked. You can
then call busGetFinish
to get the result of the operation.
This is an asynchronous failable function. See busGetSync
for
the synchronous version.
Since: 2.26
busGetFinish
:: (HasCallStack, MonadIO m, IsAsyncResult a) | |
=> a |
|
-> m DBusConnection | Returns: a |
Finishes an operation started with busGet
.
The returned object is a singleton, that is, shared with other
callers of busGet
and busGetSync
for busType
. In the
event that you need a private message bus connection, use
dbusAddressGetForBusSync
and
dBusConnectionNewForAddress
.
Note that the returned DBusConnection
object will (usually) have
the DBusConnection
:exit-on-close
property set to True
.
Since: 2.26
busGetSync
:: (HasCallStack, MonadIO m, IsCancellable a) | |
=> BusType |
|
-> Maybe a |
|
-> m DBusConnection | Returns: a |
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 busGet
and
busGetFinish
for the asynchronous version.
The returned object is a singleton, that is, shared with other
callers of busGet
and busGetSync
for busType
. In the
event that you need a private message bus connection, use
dbusAddressGetForBusSync
and
dBusConnectionNewForAddress
.
Note that the returned DBusConnection
object will (usually) have
the DBusConnection
:exit-on-close
property set to True
.
Since: 2.26
busOwnName
:: (HasCallStack, MonadIO m) | |
=> BusType |
|
-> Text |
|
-> [BusNameOwnerFlags] |
|
-> Maybe (GClosure a) |
|
-> Maybe (GClosure b) |
|
-> Maybe (GClosure c) |
|
-> m Word32 | Returns: an identifier (never 0) that can be used with
|
Version of g_bus_own_name()
using closures instead of callbacks for
easier binding in other languages.
Since: 2.26
busOwnNameOnConnection
busOwnNameOnConnection Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> Text |
|
-> [BusNameOwnerFlags] |
|
-> Maybe (GClosure b) |
|
-> Maybe (GClosure c) |
|
-> m Word32 | Returns: an identifier (never 0) that can be used with
|
Version of g_bus_own_name_on_connection()
using closures instead of
callbacks for easier binding in other languages.
Since: 2.26
busUnownName
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> m () |
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 MainContext
after
this function has returned. You should continue to iterate the MainContext
until the DestroyNotify
function passed to g_bus_own_name()
is called, in
order to avoid memory leaks through callbacks queued on the MainContext
after it’s stopped being iterated.
Since: 2.26
busUnwatchName
:: (HasCallStack, MonadIO m) | |
=> Word32 |
|
-> m () |
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 MainContext
after
this function has returned. You should continue to iterate the MainContext
until the DestroyNotify
function passed to g_bus_watch_name()
is called, in
order to avoid memory leaks through callbacks queued on the MainContext
after it’s stopped being iterated.
Since: 2.26
busWatchName
:: (HasCallStack, MonadIO m) | |
=> BusType |
|
-> Text |
|
-> [BusNameWatcherFlags] |
|
-> Maybe (GClosure a) |
|
-> Maybe (GClosure b) |
|
-> m Word32 | Returns: An identifier (never 0) that can be used with
|
Version of g_bus_watch_name()
using closures instead of callbacks for
easier binding in other languages.
Since: 2.26
busWatchNameOnConnection
busWatchNameOnConnection Source #
:: (HasCallStack, MonadIO m, IsDBusConnection a) | |
=> a |
|
-> Text |
|
-> [BusNameWatcherFlags] |
|
-> Maybe (GClosure b) |
|
-> Maybe (GClosure c) |
|
-> m Word32 | Returns: An identifier (never 0) that can be used with
|
Version of g_bus_watch_name_on_connection()
using closures instead of callbacks for
easier binding in other languages.
Since: 2.26
contentTypeCanBeExecutable
contentTypeCanBeExecutable Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Bool | Returns: |
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).
contentTypeEquals
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Text |
|
-> m Bool | Returns: |
Compares two content types for equality.
contentTypeFromMimeType
contentTypeFromMimeType Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: Newly allocated string with content type or
|
Tries to find a content type based on the mime type name.
Since: 2.18
contentTypeGetDescription
contentTypeGetDescription Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Text | Returns: a short description of the content type |
Gets the human readable description of the content type.
contentTypeGetGenericIconName
contentTypeGetGenericIconName Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: the registered generic icon name for the given |
Gets the generic icon name for a content type.
See the shared-mime-info specification for more on the generic icon name.
Since: 2.34
contentTypeGetIcon
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Icon | Returns: |
Gets the icon for a content type.
contentTypeGetMimeDirs
contentTypeGetMimeDirs Source #
:: (HasCallStack, MonadIO m) | |
=> m [Text] | Returns: |
Get the list of directories which MIME data is loaded from. See
contentTypeSetMimeDirs
for details.
Since: 2.60
contentTypeGetMimeType
contentTypeGetMimeType Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe Text) | Returns: the registered mime type for the
given |
Gets the mime type for the content type, if one is registered.
contentTypeGetSymbolicIcon
contentTypeGetSymbolicIcon Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Icon | Returns: symbolic |
Gets the symbolic icon for a content type.
Since: 2.34
contentTypeGuess
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> Maybe ByteString |
|
-> m (Text, Bool) | Returns: a string indicating a guessed content type for the
given data. Free with |
Guesses the content type based on example data. If the function is
uncertain, resultUncertain
will be set to True
. Either filename
or data
may be Nothing
, in which case the guess will be based solely
on the other argument.
contentTypeGuessForTree
contentTypeGuessForTree Source #
:: (HasCallStack, MonadIO m, IsFile a) | |
=> a |
|
-> m [Text] | Returns: an |
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 shared-mime-info specification for more on x-content types.
This function is useful in the implementation of
mountGuessContentType
.
Since: 2.18
contentTypeIsA
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Text |
|
-> m Bool | Returns: |
Determines if type
is a subset of supertype
.
contentTypeIsMimeType
contentTypeIsMimeType Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Text |
|
-> m Bool | Returns: |
Determines if type
is a subset of mimeType
.
Convenience wrapper around contentTypeIsA
.
Since: 2.52
contentTypeIsUnknown
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Bool | Returns: |
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.
contentTypeSetMimeDirs
contentTypeSetMimeDirs Source #
:: (HasCallStack, MonadIO m) | |
=> Maybe [Text] |
|
-> m () |
Set the list of directories used by GIO to load the MIME database.
If dirs
is 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 TEST_OPTION_ISOLATE_DIRS
, but they
depend on the system’s MIME database, you should call this function
with dirs
set to 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
contentTypesGetRegistered
contentTypesGetRegistered Source #
:: (HasCallStack, MonadIO m) | |
=> m [Text] | Returns: list of the registered content types |
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)
.
dbusAddressEscapeValue
dbusAddressEscapeValue Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Text | Returns: a copy of |
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
dbusAddressGetForBusSync
dbusAddressGetForBusSync Source #
:: (HasCallStack, MonadIO m, IsCancellable a) | |
=> BusType |
|
-> Maybe a |
|
-> m Text | Returns: a valid D-Bus address string for |
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 D-Bus address format.
Since: 2.26
dbusAddressGetStream
:: (HasCallStack, MonadIO m, IsCancellable a) | |
=> Text |
|
-> Maybe a |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
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
D-Bus address format.
When the operation is finished, callback
will be invoked. You can
then call dbusAddressGetStreamFinish
to get the result of
the operation.
This is an asynchronous failable function. See
dbusAddressGetStreamSync
for the synchronous version.
Since: 2.26
dbusAddressGetStreamFinish
dbusAddressGetStreamFinish Source #
:: (HasCallStack, MonadIO m, IsAsyncResult a) | |
=> a |
|
-> m (IOStream, Text) | Returns: A |
Finishes an operation started with dbusAddressGetStream
.
Since: 2.26
dbusAddressGetStreamSync
dbusAddressGetStreamSync Source #
:: (HasCallStack, MonadIO m, IsCancellable a) | |
=> Text |
|
-> Maybe a |
|
-> m (IOStream, Text) | Returns: A |
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
D-Bus address format.
This is a synchronous failable function. See
dbusAddressGetStream
for the asynchronous version.
Since: 2.26
dbusGenerateGuid
:: (HasCallStack, MonadIO m) | |
=> m Text | Returns: A valid D-Bus GUID. Free with |
Generate a D-Bus GUID that can be used with
e.g. dBusConnectionNew
.
See the D-Bus specification regarding what strings are valid D-Bus GUID (for example, D-Bus GUIDs are not RFC-4122 compliant).
Since: 2.26
dbusGvalueToGvariant
:: (HasCallStack, MonadIO m) | |
=> GValue | |
-> VariantType |
|
-> m GVariant | Returns: A |
Converts a Value
to a 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
: AnyVariantType
This can fail if e.g. gvalue
is of type G_TYPE_STRING
and type
is ['i'][G-VARIANT-TYPE-INT32:CAPS]. It will also fail for any 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
Nothing
, the empty GVariant
instance (never 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 dbusGvariantToGvalue
function for how to convert a
GVariant
to a Value
.
Since: 2.30
dbusGvariantToGvalue
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m GValue |
Converts a GVariant
to a Value
. If value
is floating, it is consumed.
The rules specified in the dbusGvalueToGvariant
function are
used - this function is essentially its reverse form. So, a GVariant
containing any basic or string array type will be converted to a Value
containing a basic value or string array. Any other GVariant
(handle,
variant, tuple, dict entry) will be converted to a Value
containing that
GVariant
.
The conversion never fails - a valid Value
is always returned in
outGvalue
.
Since: 2.30
dbusIsAddress
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Bool | Returns: |
Checks if string
is a
D-Bus address.
This doesn't check if string
is actually supported by DBusServer
or DBusConnection
- use dbusIsSupportedAddress
to do more
checks.
Since: 2.26
dbusIsGuid
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Bool | Returns: |
Checks if string
is a D-Bus GUID.
See the D-Bus specification regarding what strings are valid D-Bus GUID (for example, D-Bus GUIDs are not RFC-4122 compliant).
Since: 2.26
dbusIsInterfaceName
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Bool | Returns: |
Checks if string
is a valid D-Bus interface name.
Since: 2.26
dbusIsMemberName
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Bool | Returns: |
Checks if string
is a valid D-Bus member (e.g. signal or method) name.
Since: 2.26
dbusIsName
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Bool | Returns: |
Checks if string
is a valid D-Bus bus name (either unique or well-known).
Since: 2.26
dbusIsSupportedAddress
dbusIsSupportedAddress Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m () | (Can throw |
Like 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
D-Bus address format.
Since: 2.26
dbusIsUniqueName
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Bool | Returns: |
Checks if string
is a valid D-Bus unique bus name.
Since: 2.26
ioErrorFromErrno
:: (HasCallStack, MonadIO m) | |
=> Int32 |
|
-> m IOErrorEnum | Returns: |
Converts errno.h error codes into GIO error codes. The fallback
value IOErrorEnumFailed
is returned for error codes not currently
handled (but note that future GLib releases may return a more
specific value instead).
As errno
is global and may be modified by intermediate function
calls, you should save its value as soon as the call which sets it
ioErrorQuark
:: (HasCallStack, MonadIO m) | |
=> m Word32 | Returns: a |
Gets the GIO Error Quark.
ioModulesScanAllInDirectory
ioModulesScanAllInDirectory Source #
:: (HasCallStack, MonadIO m) | |
=> [Char] |
|
-> m () |
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 implementes is used with e.g.
iOExtensionPointGetExtensions
or
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
ioModulesScanAllInDirectoryWithScope
ioModulesScanAllInDirectoryWithScope Source #
:: (HasCallStack, MonadIO m) | |
=> [Char] |
|
-> IOModuleScope |
|
-> m () |
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 implementes is used with e.g.
iOExtensionPointGetExtensions
or
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
ioSchedulerCancelAllJobs
ioSchedulerCancelAllJobs :: (HasCallStack, MonadIO m) => m () Source #
Deprecated: You should never call this function, since you don'tknow how other libraries in your program might be making use ofgioscheduler.
Cancels all cancellable I/O jobs.
A job is cancellable if a Cancellable
was passed into
ioSchedulerPushJob
.
ioSchedulerPushJob
:: (HasCallStack, MonadIO m, IsCancellable a) | |
=> IOSchedulerJobFunc |
|
-> Int32 |
|
-> Maybe a |
|
-> m () |
Deprecated: use ThreadPool
or 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 Nothing
, it can be used to cancel the I/O job
by calling cancellableCancel
or by calling
ioSchedulerCancelAllJobs
.
keyfileSettingsBackendNew
keyfileSettingsBackendNew Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Text |
|
-> Maybe Text |
|
-> m SettingsBackend | Returns: a keyfile-backed |
Creates a keyfile-backed 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-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 True
will cause the following to appear in the keyfile:
[toplevel] enabled=true
If rootGroup
is 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
False
) for keys outside of rootPath
and, in the event that
rootGroup
is 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.
memorySettingsBackendNew
memorySettingsBackendNew Source #
:: (HasCallStack, MonadIO m) | |
=> m SettingsBackend | Returns: a newly created |
Creates a memory-backed 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
networkingInit
networkingInit :: (HasCallStack, MonadIO m) => m () Source #
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
nullSettingsBackendNew
nullSettingsBackendNew Source #
:: (HasCallStack, MonadIO m) | |
=> m SettingsBackend | Returns: a newly created |
Creates a readonly SettingsBackend
.
This backend does not allow changes to settings, so all settings will always have their default values.
Since: 2.28
pollableSourceNew
:: (HasCallStack, MonadIO m, IsObject a) | |
=> a |
|
-> m Source | Returns: the new |
Utility method for PollableInputStream
and PollableOutputStream
implementations. Creates a new Source
that expects a callback of
type PollableSourceFunc
. The new source does not actually do
anything on its own; use sourceAddChildSource
to add other
sources to it to cause it to trigger.
Since: 2.28
pollableSourceNewFull
pollableSourceNewFull Source #
:: (HasCallStack, MonadIO m, IsObject a, IsCancellable b) | |
=> a |
|
-> Maybe Source |
|
-> Maybe b |
|
-> m Source | Returns: the new |
Utility method for PollableInputStream
and PollableOutputStream
implementations. Creates a new Source
, as with
pollableSourceNew
, but also attaching childSource
(with a
dummy callback), and cancellable
, if they are non-Nothing
.
Since: 2.34
pollableStreamRead
:: (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) | |
=> a |
|
-> ByteString |
|
-> Bool |
|
-> Maybe b |
|
-> m Int64 | Returns: the number of bytes read, or -1 on error. (Can throw |
Tries to read from stream
, as with inputStreamRead
(if
blocking
is True
) or pollableInputStreamReadNonblocking
(if blocking
is False
). This can be used to more easily share
code between blocking and non-blocking implementations of a method.
If blocking
is False
, then stream
must be a
PollableInputStream
for which pollableInputStreamCanPoll
returns True
, or else the behavior is undefined. If blocking
is
True
, then stream
does not need to be a PollableInputStream
.
Since: 2.34
pollableStreamWrite
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> ByteString |
|
-> Bool |
|
-> Maybe b |
|
-> m Int64 | Returns: the number of bytes written, or -1 on error. (Can throw |
Tries to write to stream
, as with outputStreamWrite
(if
blocking
is True
) or pollableOutputStreamWriteNonblocking
(if blocking
is False
). This can be used to more easily share
code between blocking and non-blocking implementations of a method.
If blocking
is False
, then stream
must be a
PollableOutputStream
for which
pollableOutputStreamCanPoll
returns True
or else the
behavior is undefined. If blocking
is True
, then stream
does not
need to be a PollableOutputStream
.
Since: 2.34
pollableStreamWriteAll
pollableStreamWriteAll Source #
:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) | |
=> a |
|
-> ByteString |
|
-> Bool |
|
-> Maybe b |
|
-> m Word64 | (Can throw |
Tries to write count
bytes to stream
, as with
outputStreamWriteAll
, but using pollableStreamWrite
rather than outputStreamWrite
.
On a successful write of count
bytes, True
is returned, and
bytesWritten
is set to count
.
If there is an error during the operation (including
IOErrorEnumWouldBlock
in the non-blocking case), 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 pollableStreamWrite
, if blocking
is False
, then
stream
must be a PollableOutputStream
for which
pollableOutputStreamCanPoll
returns True
or else the
behavior is undefined. If blocking
is True
, then stream
does not
need to be a PollableOutputStream
.
Since: 2.34
resourcesEnumerateChildren
resourcesEnumerateChildren Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> [ResourceLookupFlags] |
|
-> m [Text] | Returns: an array of constant strings (Can throw |
resourcesGetInfo
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> [ResourceLookupFlags] |
|
-> m (Word64, Word32) | (Can throw |
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
resourcesLookupData
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> [ResourceLookupFlags] |
|
-> m Bytes | Returns: |
Looks for a file at the specified path
in the set of
globally registered resources and returns a 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
resourcesOpenStream
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> [ResourceLookupFlags] |
|
-> m InputStream | Returns: |
Looks for a file at the specified path
in the set of
globally registered resources and returns a InputStream
that lets you read the data.
lookupFlags
controls the behaviour of the lookup.
Since: 2.32
resourcesRegister
:: (HasCallStack, MonadIO m) | |
=> Resource |
|
-> m () |
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 resourcesLookupData
.
Since: 2.32
resourcesUnregister
:: (HasCallStack, MonadIO m) | |
=> Resource |
|
-> m () |
Unregisters the resource from the process-global set of resources.
Since: 2.32
simpleAsyncReportGerrorInIdle
simpleAsyncReportGerrorInIdle Source #
:: (HasCallStack, MonadIO m, IsObject a) | |
=> Maybe a | |
-> Maybe AsyncReadyCallback |
|
-> GError |
|
-> m () |
Deprecated: (Since version 2.46)Use taskReportError
.
Reports an error in an idle function. Similar to
g_simple_async_report_error_in_idle()
, but takes a GError
rather
than building a new one.
unixIsMountPathSystemInternal
unixIsMountPathSystemInternal Source #
:: (HasCallStack, MonadIO m) | |
=> [Char] |
|
-> m Bool | Returns: |
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.
unixIsSystemDevicePath
unixIsSystemDevicePath Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Bool | Returns: |
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
unixIsSystemFsType
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Bool | Returns: |
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
unixMountAt
:: (HasCallStack, MonadIO m) | |
=> [Char] |
|
-> m (UnixMountEntry, Word64) | Returns: a |
Gets a 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 unixMountsChangedSince
.
If more mounts have the same mount path, the last matching mount is returned.
unixMountCompare
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> UnixMountEntry |
|
-> m Int32 | Returns: 1, 0 or -1 if |
Compares two unix mounts.
unixMountCopy
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> m UnixMountEntry | Returns: a new |
Makes a copy of mountEntry
.
Since: 2.54
unixMountFor
:: (HasCallStack, MonadIO m) | |
=> [Char] |
|
-> m (UnixMountEntry, Word64) | Returns: a |
Gets a 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 unixMountsChangedSince
.
If more mounts have the same mount path, the last matching mount is returned.
Since: 2.52
unixMountFree
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> m () |
Frees a unix mount.
unixMountGetDevicePath
unixMountGetDevicePath Source #
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> m [Char] | Returns: a string containing the device path. |
Gets the device path for a unix mount.
unixMountGetFsType
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> m Text | Returns: a string containing the file system type. |
Gets the filesystem type for the unix mount.
unixMountGetMountPath
unixMountGetMountPath Source #
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> m [Char] | Returns: the mount path for |
Gets the mount path for a unix mount.
unixMountGetOptions
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> m (Maybe Text) | Returns: a string containing the options, or |
Gets a comma-separated list of mount options for the unix mount. For example,
rw,relatime,seclabel,data=ordered
.
This is similar to unixMountPointGetOptions
, but it takes
a UnixMountEntry
as an argument.
Since: 2.58
unixMountGetRootPath
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> m (Maybe Text) | Returns: a string containing the root, or |
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
unixMountGuessCanEject
unixMountGuessCanEject Source #
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> m Bool | Returns: |
Guesses whether a Unix mount can be ejected.
unixMountGuessIcon
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> m Icon | Returns: a |
Guesses the icon of a Unix mount.
unixMountGuessName
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> m Text | Returns: A newly allocated string that must
be freed with |
Guesses the name of a Unix mount. The result is a translated string.
unixMountGuessShouldDisplay
unixMountGuessShouldDisplay Source #
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> m Bool | Returns: |
Guesses whether a Unix mount should be displayed in the UI.
unixMountGuessSymbolicIcon
unixMountGuessSymbolicIcon Source #
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> m Icon | Returns: a |
Guesses the symbolic icon of a Unix mount.
Since: 2.34
unixMountIsReadonly
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> m Bool | Returns: |
Checks if a unix mount is mounted read only.
unixMountIsSystemInternal
unixMountIsSystemInternal Source #
:: (HasCallStack, MonadIO m) | |
=> UnixMountEntry |
|
-> m Bool | Returns: |
Checks if a Unix mount is a system mount. This is the Boolean OR of
unixIsSystemFsType
, unixIsSystemDevicePath
and
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.
unixMountPointsChangedSince
unixMountPointsChangedSince Source #
:: (HasCallStack, MonadIO m) | |
=> Word64 |
|
-> m Bool | Returns: |
Checks if the unix mount points have changed since a given unix time.
unixMountPointsGet
:: (HasCallStack, MonadIO m) | |
=> m ([UnixMountPoint], Word64) | Returns:
a |
Gets a List
of 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
unixMountPointsChangedSince
.
unixMountsChangedSince
unixMountsChangedSince Source #
:: (HasCallStack, MonadIO m) | |
=> Word64 |
|
-> m Bool | Returns: |
Checks if the unix mounts have changed since a given unix time.
unixMountsGet
:: (HasCallStack, MonadIO m) | |
=> m ([UnixMountEntry], Word64) | Returns:
a |
Gets a List
of 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 unixMountsChangedSince
.