gi-gio-2.0.18: Gio bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gio.Functions

Contents

Description

 
Synopsis

Methods

busGet

busGet Source #

Arguments

:: (HasCallStack, MonadIO m, IsCancellable a) 
=> BusType

busType: a BusType

-> Maybe a

cancellable: a Cancellable or Nothing

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback to call when the request is satisfied

-> 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 a asynchronous failable function. See busGetSync for the synchronous version.

Since: 2.26

busGetFinish

busGetFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsAsyncResult a) 
=> a

res: a AsyncResult obtained from the AsyncReadyCallback passed to busGet

-> m DBusConnection

Returns: a DBusConnection or Nothing if error is set. Free with objectUnref. (Can throw GError)

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

busGetSync Source #

Arguments

:: (HasCallStack, MonadIO m, IsCancellable a) 
=> BusType

busType: a BusType

-> Maybe a

cancellable: a Cancellable or Nothing

-> m DBusConnection

Returns: a DBusConnection or Nothing if error is set. Free with objectUnref. (Can throw GError)

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

busOwnName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BusType

busType: the type of bus to own a name on

-> Text

name: the well-known name to own

-> [BusNameOwnerFlags]

flags: a set of flags from the BusNameOwnerFlags enumeration

-> Maybe Closure

busAcquiredClosure: Closure to invoke when connected to the bus of type busType or Nothing

-> Maybe Closure

nameAcquiredClosure: Closure to invoke when name is acquired or Nothing

-> Maybe Closure

nameLostClosure: Closure to invoke when name is lost or Nothing

-> m Word32

Returns: an identifier (never 0) that an be used with busUnownName to stop owning the name.

Version of g_bus_own_name() using closures instead of callbacks for easier binding in other languages.

Since: 2.26

busOwnNameOnConnection

busOwnNameOnConnection Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusConnection a) 
=> a

connection: a DBusConnection

-> Text

name: the well-known name to own

-> [BusNameOwnerFlags]

flags: a set of flags from the BusNameOwnerFlags enumeration

-> Maybe Closure

nameAcquiredClosure: Closure to invoke when name is acquired or Nothing

-> Maybe Closure

nameLostClosure: Closure to invoke when name is lost or Nothing

-> m Word32

Returns: an identifier (never 0) that an be used with busUnownName to stop owning the name.

Version of g_bus_own_name_on_connection() using closures instead of callbacks for easier binding in other languages.

Since: 2.26

busUnownName

busUnownName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

ownerId: an identifier obtained from g_bus_own_name()

-> m () 

Stops owning a name.

Since: 2.26

busUnwatchName

busUnwatchName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word32

watcherId: An identifier obtained from g_bus_watch_name()

-> m () 

Stops watching a name.

Since: 2.26

busWatchName

busWatchName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> BusType

busType: The type of bus to watch a name on.

-> Text

name: The name (well-known or unique) to watch.

-> [BusNameWatcherFlags]

flags: Flags from the BusNameWatcherFlags enumeration.

-> Maybe Closure

nameAppearedClosure: Closure to invoke when name is known to exist or Nothing.

-> Maybe Closure

nameVanishedClosure: Closure to invoke when name is known to not exist or Nothing.

-> m Word32

Returns: An identifier (never 0) that an be used with busUnwatchName to stop watching the name.

Version of g_bus_watch_name() using closures instead of callbacks for easier binding in other languages.

Since: 2.26

busWatchNameOnConnection

busWatchNameOnConnection Source #

Arguments

:: (HasCallStack, MonadIO m, IsDBusConnection a) 
=> a

connection: A DBusConnection.

-> Text

name: The name (well-known or unique) to watch.

-> [BusNameWatcherFlags]

flags: Flags from the BusNameWatcherFlags enumeration.

-> Maybe Closure

nameAppearedClosure: Closure to invoke when name is known to exist or Nothing.

-> Maybe Closure

nameVanishedClosure: Closure to invoke when name is known to not exist or Nothing.

-> m Word32

Returns: An identifier (never 0) that an be used with busUnwatchName to stop watching the name.

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 #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

type: a content type string

-> m Bool

Returns: True if the file type corresponds to a type that can be executable, False otherwise.

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

contentTypeEquals Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

type1: a content type string

-> Text

type2: a content type string

-> m Bool

Returns: True if the two strings are identical or equivalent, False otherwise.

Compares two content types for equality.

contentTypeFromMimeType

contentTypeFromMimeType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

mimeType: a mime type string

-> m (Maybe Text)

Returns: Newly allocated string with content type or Nothing. Free with free

Tries to find a content type based on the mime type name.

Since: 2.18

contentTypeGetDescription

contentTypeGetDescription Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

type: a content type string

-> m Text

Returns: a short description of the content type type. Free the returned string with free

Gets the human readable description of the content type.

contentTypeGetGenericIconName

contentTypeGetGenericIconName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

type: a content type string

-> m (Maybe Text)

Returns: the registered generic icon name for the given type, or Nothing if unknown. Free with free

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

contentTypeGetIcon Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

type: a content type string

-> m Icon

Returns: Icon corresponding to the content type. Free the returned object with objectUnref

Gets the icon for a content type.

contentTypeGetMimeType

contentTypeGetMimeType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

type: a content type string

-> m (Maybe Text)

Returns: the registered mime type for the given type, or Nothing if unknown.

Gets the mime type for the content type, if one is registered.

contentTypeGetSymbolicIcon

contentTypeGetSymbolicIcon Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

type: a content type string

-> m Icon

Returns: symbolic Icon corresponding to the content type. Free the returned object with objectUnref

Gets the symbolic icon for a content type.

Since: 2.34

contentTypeGuess

contentTypeGuess Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Maybe Text

filename: a string, or Nothing

-> Maybe ByteString

data: a stream of data, or Nothing

-> m (Text, Bool)

Returns: a string indicating a guessed content type for the given data. Free with free

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 #

Arguments

:: (HasCallStack, MonadIO m, IsFile a) 
=> a

root: the root of the tree to guess a type for

-> m [Text]

Returns: an Nothing-terminated array of zero or more content types. Free with strfreev

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

contentTypeIsA Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

type: a content type string

-> Text

supertype: a content type string

-> m Bool

Returns: True if type is a kind of supertype, False otherwise.

Determines if type is a subset of supertype.

contentTypeIsMimeType

contentTypeIsMimeType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

type: a content type string

-> Text

mimeType: a mime type string

-> m Bool

Returns: True if type is a kind of mimeType, False otherwise.

Determines if type is a subset of mimeType. Convenience wrapper around contentTypeIsA.

Since: 2.52

contentTypeIsUnknown

contentTypeIsUnknown Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

type: a content type string

-> m Bool

Returns: True if the type is the unknown type.

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.

contentTypesGetRegistered

contentTypesGetRegistered Source #

Arguments

:: (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 #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

string: an unescaped string to be included in a D-Bus address as the value in a key-value pair

-> m Text

Returns: a copy of string with all non-optionally-escaped bytes escaped

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 #

Arguments

:: (HasCallStack, MonadIO m, IsCancellable a) 
=> BusType

busType: a BusType

-> Maybe a

cancellable: a Cancellable or Nothing

-> m Text

Returns: a valid D-Bus address string for busType or Nothing if error is set (Can throw GError)

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

dbusAddressGetStream Source #

Arguments

:: (HasCallStack, MonadIO m, IsCancellable a) 
=> Text

address: A valid D-Bus address.

-> Maybe a

cancellable: A Cancellable or Nothing.

-> Maybe AsyncReadyCallback

callback: A AsyncReadyCallback to call when the request is satisfied.

-> 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 #

Arguments

:: (HasCallStack, MonadIO m, IsAsyncResult a) 
=> a

res: A AsyncResult obtained from the GAsyncReadyCallback passed to dbusAddressGetStream.

-> m (IOStream, Text)

Returns: A IOStream or Nothing if error is set. (Can throw GError)

Finishes an operation started with dbusAddressGetStream.

Since: 2.26

dbusAddressGetStreamSync

dbusAddressGetStreamSync Source #

Arguments

:: (HasCallStack, MonadIO m, IsCancellable a) 
=> Text

address: A valid D-Bus address.

-> Maybe a

cancellable: A Cancellable or Nothing.

-> m (IOStream, Text)

Returns: A IOStream or Nothing if error is set. (Can throw GError)

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

dbusGenerateGuid Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Text

Returns: A valid D-Bus GUID. Free with free.

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

dbusGvalueToGvariant Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> GValue

gvalue: A Value to convert to a GVariant

-> VariantType

type: A VariantType

-> m GVariant

Returns: A GVariant (never floating) of VariantType type holding the data from gvalue or Nothing in case of failure. Free with variantUnref.

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: Any VariantType

This can fail if e.g. gvalue is of type G_TYPE_STRING and type is ['i'][G-VARIANT-TYPE-INT32:CAPS]. It will also fail for any 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

dbusGvariantToGvalue Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> GVariant

value: A 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

dbusIsAddress Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

string: A string.

-> m Bool

Returns: True if string is a valid D-Bus address, False otherwise.

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

dbusIsGuid Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

string: The string to check.

-> m Bool

Returns: True if string is a guid, False otherwise.

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

dbusIsInterfaceName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

string: The string to check.

-> m Bool

Returns: True if valid, False otherwise.

Checks if string is a valid D-Bus interface name.

Since: 2.26

dbusIsMemberName

dbusIsMemberName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

string: The string to check.

-> m Bool

Returns: True if valid, False otherwise.

Checks if string is a valid D-Bus member (e.g. signal or method) name.

Since: 2.26

dbusIsName

dbusIsName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

string: The string to check.

-> m Bool

Returns: True if valid, False otherwise.

Checks if string is a valid D-Bus bus name (either unique or well-known).

Since: 2.26

dbusIsSupportedAddress

dbusIsSupportedAddress Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

string: A string.

-> m ()

(Can throw GError)

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

dbusIsUniqueName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

string: The string to check.

-> m Bool

Returns: True if valid, False otherwise.

Checks if string is a valid D-Bus unique bus name.

Since: 2.26

ioErrorFromErrno

ioErrorFromErrno Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

errNo: Error number as defined in errno.h.

-> m IOErrorEnum

Returns: IOErrorEnum value for the given errno.h error number.

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

ioErrorQuark Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Word32

Returns: a GQuark.

Gets the GIO Error Quark.

ioModulesScanAllInDirectory

ioModulesScanAllInDirectory Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Char]

dirname: pathname for a directory containing modules to scan.

-> 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 #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Char]

dirname: pathname for a directory containing modules to scan.

-> IOModuleScope

scope: a scope to use when scanning the modules

-> 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

ioSchedulerPushJob Source #

Arguments

:: (HasCallStack, MonadIO m, IsCancellable a) 
=> IOSchedulerJobFunc

jobFunc: a IOSchedulerJobFunc.

-> Int32

ioPriority: the [I/O priority][io-priority] of the request.

-> Maybe a

cancellable: optional Cancellable object, Nothing to ignore.

-> m () 

Deprecated: use ThreadPool or g_task_run_in_thread()

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 #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

filename: the filename of the keyfile

-> Text

rootPath: the path under which all settings keys appear

-> Maybe Text

rootGroup: the group name corresponding to rootPath, or Nothing

-> m SettingsBackend

Returns: a keyfile-backed SettingsBackend

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.

memorySettingsBackendNew

memorySettingsBackendNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m SettingsBackend

Returns: a newly created SettingsBackend

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 #

Arguments

:: (HasCallStack, MonadIO m) 
=> m SettingsBackend

Returns: a newly created SettingsBackend

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

pollableSourceNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsObject a) 
=> a

pollableStream: the stream associated with the new source

-> m Source

Returns: the new Source.

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 #

Arguments

:: (HasCallStack, MonadIO m, IsObject a, IsCancellable b) 
=> a

pollableStream: the stream associated with the new source

-> Maybe Source

childSource: optional child source to attach

-> Maybe b

cancellable: optional Cancellable to attach

-> m Source

Returns: the new Source.

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

pollableStreamRead Source #

Arguments

:: (HasCallStack, MonadIO m, IsInputStream a, IsCancellable b) 
=> a

stream: a InputStream

-> ByteString

buffer: a buffer to read data into

-> Bool

blocking: whether to do blocking I/O

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore.

-> m Int64

Returns: the number of bytes read, or -1 on error. (Can throw GError)

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

pollableStreamWrite Source #

Arguments

:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) 
=> a

stream: a OutputStream.

-> ByteString

buffer: the buffer containing the data to write.

-> Bool

blocking: whether to do blocking I/O

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore.

-> m Int64

Returns: the number of bytes written, or -1 on error. (Can throw GError)

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 #

Arguments

:: (HasCallStack, MonadIO m, IsOutputStream a, IsCancellable b) 
=> a

stream: a OutputStream.

-> ByteString

buffer: the buffer containing the data to write.

-> Bool

blocking: whether to do blocking I/O

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore.

-> m Word64

(Can throw GError)

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 #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

path: A pathname inside the resource

-> [ResourceLookupFlags]

lookupFlags: A ResourceLookupFlags

-> m [Text]

Returns: an array of constant strings (Can throw GError)

Returns all the names of children at the specified path in the set of globally registered resources. The return result is a Nothing terminated list of strings which should be released with strfreev.

lookupFlags controls the behaviour of the lookup.

Since: 2.32

resourcesGetInfo

resourcesGetInfo Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

path: A pathname inside the resource

-> [ResourceLookupFlags]

lookupFlags: A ResourceLookupFlags

-> m (Word64, Word32)

(Can throw GError)

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

resourcesLookupData Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

path: A pathname inside the resource

-> [ResourceLookupFlags]

lookupFlags: A ResourceLookupFlags

-> m Bytes

Returns: Bytes or Nothing on error. Free the returned object with bytesUnref (Can throw GError)

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

resourcesOpenStream Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

path: A pathname inside the resource

-> [ResourceLookupFlags]

lookupFlags: A ResourceLookupFlags

-> m InputStream

Returns: InputStream or Nothing on error. Free the returned object with objectUnref (Can throw GError)

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

resourcesRegister Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Resource

resource: A 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

resourcesUnregister Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Resource

resource: A Resource

-> m () 

Unregisters the resource from the process-global set of resources.

Since: 2.32

simpleAsyncReportGerrorInIdle

simpleAsyncReportGerrorInIdle Source #

Arguments

:: (HasCallStack, MonadIO m, IsObject a) 
=> Maybe a

object: a Object, or Nothing

-> Maybe AsyncReadyCallback

callback: a AsyncReadyCallback.

-> GError

error: the GError to report

-> 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 #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Char]

mountPath: a mount path, e.g. /media/disk or /usr

-> m Bool

Returns: True if mountPath is considered an implementation detail of the OS.

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 #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

devicePath: a device path, e.g. /dev/loop0 or nfsd

-> m Bool

Returns: True if devicePath is considered an implementation detail of the OS.

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

unixIsSystemFsType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

fsType: a file system type, e.g. procfs or tmpfs

-> m Bool

Returns: True if fsType is considered an implementation detail of the OS.

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

unixMountAt Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Char]

mountPath: path for a possible unix mount.

-> m (UnixMountEntry, Word64)

Returns: a UnixMountEntry.

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.

unixMountCompare

unixMountCompare Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> UnixMountEntry

mount1: first UnixMountEntry to compare.

-> UnixMountEntry

mount2: second UnixMountEntry to compare.

-> m Int32

Returns: 1, 0 or -1 if mount1 is greater than, equal to, or less than mount2, respectively.

Compares two unix mounts.

unixMountCopy

unixMountCopy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> UnixMountEntry

mountEntry: a UnixMountEntry.

-> m UnixMountEntry

Returns: a new UnixMountEntry

Makes a copy of mountEntry.

Since: 2.54

unixMountFor

unixMountFor Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> [Char]

filePath: file path on some unix mount.

-> m (UnixMountEntry, Word64)

Returns: a UnixMountEntry.

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.

Since: 2.52

unixMountFree

unixMountFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> UnixMountEntry

mountEntry: a UnixMountEntry.

-> m () 

Frees a unix mount.

unixMountGetDevicePath

unixMountGetDevicePath Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> UnixMountEntry

mountEntry: a GUnixMount.

-> m [Char]

Returns: a string containing the device path.

Gets the device path for a unix mount.

unixMountGetFsType

unixMountGetFsType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> UnixMountEntry

mountEntry: a GUnixMount.

-> m Text

Returns: a string containing the file system type.

Gets the filesystem type for the unix mount.

unixMountGetMountPath

unixMountGetMountPath Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> UnixMountEntry

mountEntry: input UnixMountEntry to get the mount path for.

-> m [Char]

Returns: the mount path for mountEntry.

Gets the mount path for a unix mount.

unixMountGuessCanEject

unixMountGuessCanEject Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> UnixMountEntry

mountEntry: a UnixMountEntry

-> m Bool

Returns: True if mountEntry is deemed to be ejectable.

Guesses whether a Unix mount can be ejected.

unixMountGuessIcon

unixMountGuessIcon Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> UnixMountEntry

mountEntry: a UnixMountEntry

-> m Icon

Returns: a Icon

Guesses the icon of a Unix mount.

unixMountGuessName

unixMountGuessName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> UnixMountEntry

mountEntry: a UnixMountEntry

-> m Text

Returns: A newly allocated string that must be freed with free

Guesses the name of a Unix mount. The result is a translated string.

unixMountGuessShouldDisplay

unixMountGuessShouldDisplay Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> UnixMountEntry

mountEntry: a UnixMountEntry

-> m Bool

Returns: True if mountEntry is deemed to be displayable.

Guesses whether a Unix mount should be displayed in the UI.

unixMountGuessSymbolicIcon

unixMountGuessSymbolicIcon Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> UnixMountEntry

mountEntry: a UnixMountEntry

-> m Icon

Returns: a Icon

Guesses the symbolic icon of a Unix mount.

Since: 2.34

unixMountIsReadonly

unixMountIsReadonly Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> UnixMountEntry

mountEntry: a GUnixMount.

-> m Bool

Returns: True if mountEntry is read only.

Checks if a unix mount is mounted read only.

unixMountIsSystemInternal

unixMountIsSystemInternal Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> UnixMountEntry

mountEntry: a GUnixMount.

-> m Bool

Returns: True if the unix mount is for a system path.

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 #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word64

time: guint64 to contain a timestamp.

-> m Bool

Returns: True if the mount points have changed since time.

Checks if the unix mount points have changed since a given unix time.

unixMountPointsGet

unixMountPointsGet Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m ([UnixMountPoint], Word64)

Returns: a List of the UNIX mountpoints.

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 #

Arguments

:: (HasCallStack, MonadIO m) 
=> Word64

time: guint64 to contain a timestamp.

-> m Bool

Returns: True if the mounts have changed since time.

Checks if the unix mounts have changed since a given unix time.

unixMountsGet

unixMountsGet Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m ([UnixMountEntry], Word64)

Returns: a List of the UNIX mounts.

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.