7 Functions

Procedure: action-name-is-valid? action-name ⇒ %return

Checks if action-name is valid.

action-name is valid if it consists only of alphanumeric characters, plus - and .. The empty string is not a valid action name.

It is an error to call this function with a non-UTF-8 action-name. action-name must not be NULL.

action-name

Passed: a string.

a potential action name

%return

Returned: a boolean.

TRUE if action-name is valid

Procedure: action-parse-detailed-name detailed-name ⇒ %return action-name target-value

Parses a detailed action name into its separate name and target components.

Detailed action names can have three formats.

The first format is used to represent an action name with no target value and consists of just an action name containing no whitespace nor the characters :, ( or ). For example: app.action.

The second format is used to represent an action with a target value that is a non-empty string consisting only of alphanumerics, plus - and .. In that case, the action name and target value are separated by a double colon (::). For example: app.action::target.

The third format is used to represent an action with any type of target value, including strings. The target value follows the action name, surrounded in parens. For example: app.action(42). The target value is parsed using variant:parse. If a tuple-typed value is desired, it must be specified in the same way, resulting in two sets of parens, for example: app.action((1,2,3)). A string target can be specified this way as well: app.action('target'). For strings, this third format must be used if target value is empty or contains characters other than alphanumerics, - and ..

If this function returns TRUE, a non-NULL value is guaranteed to be returned in action-name (if a pointer is passed in). A NULL value may still be returned in target-value, as the detailed-name may not contain a target.

If returned, the <GVariant> in target-value is guaranteed to not be floating.

detailed-name

Passed: a string.

a detailed action name

%return

Returned: a boolean.

TRUE if successful, else FALSE with error set

action-name

Returned: a string.

the action name

target-value

Returned: a <GVariant>, or #f.

the target value, or NULL for no target

Procedure: action-print-detailed-name action-name [target-value] ⇒ %return

Formats a detailed action name from action-name and target-value.

It is an error to call this function with an invalid action name.

This function is the opposite of action:parse-detailed-name. It will produce a string that can be parsed back to the action-name and target-value by that function.

See that function for the types of strings that will be printed by this function.

action-name

Passed: a string.

a valid action name

target-value

Passed, or left out: a <GVariant>, or #f.

a <GVariant> target value, or NULL

%return

Returned: a string.

a detailed format string

Procedure: app-info-create-from-commandline commandline application-name flags ⇒ %return

Creates a new <GAppInfo> from the given information.

Note that for commandline, the quoting rules of the Exec key of the freedesktop.org Desktop Entry Specification are applied. For example, if the commandline contains percent-encoded URIs, the percent-character must be doubled in order to prevent it from being swallowed by Exec key unquoting. See the specification for exact quoting rules.

commandline

Passed: a file name, as a string.

the command line to use

application-name

Passed: a string, or #f.

the application name, or NULL to use commandline

flags

Passed: a <GAppInfoCreateFlags>, or a list of its symbols, or one of them.

flags that can specify details of the created <GAppInfo>

%return

Returned: a <GAppInfo>.

new <GAppInfo> for given command.

Procedure: app-info-get-all ⇒ %return

Gets a list of all of the applications currently registered on this system.

For desktop files, this includes applications that have ‘NoDisplay=true‘ set or are excluded from display by means of ‘OnlyShowIn‘ or ‘NotShowIn‘. See app-info:should-show?.

The returned list does not include applications which have the ‘Hidden‘ key set.

%return

Returned: a list, each a <GAppInfo>.

a newly allocated list of references to <GAppInfo>s.

Procedure: app-info-get-all-for-type content-type ⇒ %return

Gets a list of all <GAppInfo>s for a given content type, including the recommended and fallback <GAppInfo>s. See app-info:get-recommended-for-type and app-info:get-fallback-for-type.

content-type

Passed: a string.

the content type to find a <GAppInfo> for

%return

Returned: a list, each a <GAppInfo>.

list of <GAppInfo>s for given content-type.

Procedure: app-info-get-default-for-type content-type must-support-uris ⇒ %return

Gets the default <GAppInfo> for a given content type.

content-type

Passed: a string.

the content type to find a <GAppInfo> for

must-support-uris

Passed: a boolean.

if TRUE, the <GAppInfo> is expected to support URIs

%return

Returned: a <GAppInfo>, or #f.

<GAppInfo> for given content-type or NULL on error.

Procedure: app-info-get-default-for-type-async content-type must-support-uris [cancellable] [callback]

Asynchronously gets the default <GAppInfo> for a given content type.

content-type

Passed: a string.

the content type to find a <GAppInfo> for

must-support-uris

Passed: a boolean.

if TRUE, the <GAppInfo> is expected to support URIs

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is done

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to callback

Procedure: app-info-get-default-for-type-finish result ⇒ %return

Finishes a default <GAppInfo> lookup started by app-info:get-default-for-type-async.

If no #<GAppInfo> is found, then error will be set to Gio.IOErrorEnum.NOT_FOUND.

result

Passed: a <GAsyncResult>.

the async result

%return

Returned: a <GAppInfo>.

<GAppInfo> for given content-type or NULL on error.

Procedure: app-info-get-default-for-uri-scheme uri-scheme ⇒ %return

Gets the default application for handling URIs with the given URI scheme.

A URI scheme is the initial part of the URI, up to but not including the :. For example, http, ftp or sip.

uri-scheme

Passed: a string.

a string containing a URI scheme.

%return

Returned: a <GAppInfo>, or #f.

<GAppInfo> for given uri-scheme or NULL on error.

Procedure: app-info-get-default-for-uri-scheme-async uri-scheme [cancellable] [callback]

Asynchronously gets the default application for handling URIs with the given URI scheme. A URI scheme is the initial part of the URI, up to but not including the :, e.g. http, ftp or sip.

uri-scheme

Passed: a string.

a string containing a URI scheme.

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is done

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to callback

Procedure: app-info-get-default-for-uri-scheme-finish result ⇒ %return

Finishes a default <GAppInfo> lookup started by app-info:get-default-for-uri-scheme-async.

If no <GAppInfo> is found, then error will be set to Gio.IOErrorEnum.NOT_FOUND.

result

Passed: a <GAsyncResult>.

the async result

%return

Returned: a <GAppInfo>.

<GAppInfo> for given uri-scheme or NULL on error.

Procedure: app-info-get-fallback-for-type content-type ⇒ %return

Gets a list of fallback <GAppInfo>s for a given content type, i.e. those applications which claim to support the given content type by MIME type subclassing and not directly.

content-type

Passed: a string.

the content type to find a <GAppInfo> for

%return

Returned: a list, each a <GAppInfo>.

list of <GAppInfo>s for given content-type or NULL on error.

Procedure: app-info-get-recommended-for-type content-type ⇒ %return

Gets a list of recommended <GAppInfo>s for a given content type, i.e. those applications which claim to support the given content type exactly, and not by MIME type subclassing.

Note that the first application of the list is the last used one, i.e. the last one for which app-info:set-as-last-used-for-type? has been called.

content-type

Passed: a string.

the content type to find a <GAppInfo> for

%return

Returned: a list, each a <GAppInfo>.

list of <GAppInfo>s for given content-type or NULL on error.

Procedure: app-info-launch-default-for-uri-async uri [context] [cancellable] [callback]

Async version of app-info:launch-default-for-uri?.

This version is useful if you are interested in receiving error information in the case where the application is sandboxed and the portal may present an application chooser dialog to the user.

This is also useful if you want to be sure that the D-Bus–activated applications are really started before termination and if you are interested in receiving error information from their activation.

uri

Passed: a string.

the uri to show

context

Passed, or left out: a <GAppLaunchContext>, or #f.

optional launch context

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable>

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is done

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to callback

Procedure: app-info-launch-default-for-uri-finish? result ⇒ %return

Finishes an asynchronous launch-default-for-uri operation.

result

Passed: a <GAsyncResult>.

the async result

%return

Returned: a boolean.

TRUE if the launch was successful, FALSE if error is set

Procedure: app-info-launch-default-for-uri? uri [context] ⇒ %return

Utility function that launches the default application registered to handle the specified uri. Synchronous I/O is done on the uri to detect the type of the file if required.

The D-Bus–activated applications don’t have to be started if your application terminates too soon after this function. To prevent this, use app-info:launch-default-for-uri-async instead.

uri

Passed: a string.

the uri to show

context

Passed, or left out: a <GAppLaunchContext>, or #f.

optional launch context

%return

Returned: a boolean.

TRUE on success, FALSE on error.

Procedure: app-info-reset-type-associations content-type

Removes all changes to the type associations done by app-info:set-as-default-for-type?, app-info:set-as-default-for-extension?, app-info:add-supports-type? or app-info:remove-supports-type?.

content-type

Passed: a string.

a content type

Procedure: bus-get bus-type [cancellable] [callback]

Asynchronously connects to the message bus specified by bus-type.

When the operation is finished, callback will be invoked. You can then call bus-get-finish to get the result of the operation.

This is an asynchronous failable function. See bus-get-sync for the synchronous version.

bus-type

Passed: a <GBusType>, or one of its symbols.

a <GBusType>

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable> or #f

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback

Procedure: bus-get-finish res ⇒ %return

Finishes an operation started with bus-get.

The returned object is a singleton, that is, shared with other callers of bus-get and bus-get-sync for bus-type. In the event that you need a private message bus connection, use dbus-address-get-for-bus-sync and dbus-connection:new-for-address with G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT and G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flags.

Note that the returned <GDBusConnection> object will (usually) have the dbus-connection:exit-on-close property set to #t.

res

Passed: a <GAsyncResult>.

a <GAsyncResult> obtained from the GAsyncReadyCallback passed to bus-get

%return

Returned: a <GDBusConnection>.

a <GDBusConnection> or #f if error is set. Free with object:unref.

Procedure: bus-get-sync bus-type [cancellable] ⇒ %return

Synchronously connects to the message bus specified by bus-type. 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 bus-type, they will share the same object.

This is a synchronous failable function. See bus-get and bus-get-finish for the asynchronous version.

The returned object is a singleton, that is, shared with other callers of bus-get and bus-get-sync for bus-type. In the event that you need a private message bus connection, use dbus-address-get-for-bus-sync and dbus-connection:new-for-address with G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT and G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flags.

Note that the returned <GDBusConnection> object will (usually) have the dbus-connection:exit-on-close property set to #t.

bus-type

Passed: a <GBusType>, or one of its symbols.

a <GBusType>

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable> or #f

%return

Returned: a <GDBusConnection>.

a <GDBusConnection> or #f if error is set. Free with object:unref.

Procedure: bus-own-name bus-type name flags [bus-acquired-closure] [name-acquired-closure] [name-lost-closure] ⇒ %return

Requests ownership of name on the bus specified by bus-type.

It asynchronously calls name-acquired-handler and name-lost-handler when the name is acquired and lost, respectively.

Callbacks will be invoked in the thread-default main context (see main-context:push-thread-default) of the thread you are calling this function from.

You are guaranteed that one of the name-acquired-handler and name-lost-handler callbacks will be invoked after calling this function — there are three possible cases:

  • name-lost-handler with a NULL connection (if a connection to the bus can’t be made).
  • bus-acquired-handler then name-lost-handler (if the name can’t be obtained).
  • bus-acquired-handler then name-acquired-handler (if the name was obtained).

When you are done owning the name, call bus-unown-name with the owner ID this function returns.

If the name is acquired or lost (for example another application could acquire the name if you allow replacement or the application currently owning the name exits), the handlers are also invoked. If the <GDBusConnection> that is used for attempting to own the name closes, then name-lost-handler is invoked since it is no longer possible for other processes to access the process.

You cannot use bus-own-name several times for the same name (unless interleaved with calls to bus-unown-name) — only the first call will work.

Another guarantee is that invocations of name-acquired-handler and name-lost-handler are guaranteed to alternate; that is, if name-acquired-handler is invoked then you are guaranteed that the next time one of the handlers is invoked, it will be name-lost-handler. The reverse is also true.

If you plan on exporting objects (using, for example, dbus-connection:register-object), note that it is generally too late to export the objects in name-acquired-handler. Instead, you can do this in bus-acquired-handler since you are guaranteed that this will run before name is requested from the bus.

This behavior makes it very simple to write applications that want to own names and export objects. Simply register objects to be exported in bus-acquired-handler and unregister the objects (if any) in name-lost-handler.

bus-type

Passed: a <GBusType>, or one of its symbols.

the type of bus to own a name on

name

Passed: a string.

the well-known name to own

flags

Passed: a <GBusNameOwnerFlags>, or a list of its symbols, or one of them.

a set of flags with ownership options

bus-acquired-closure

Passed, or left out: a <GClosure>, or #f.

name-acquired-closure

Passed, or left out: a <GClosure>, or #f.

name-lost-closure

Passed, or left out: a <GClosure>, or #f.

%return

Returned: an unsigned 32-bit integer.

an identifier (never 0) that can be used with bus-unown-name to stop owning the name

bus-acquired-handler

handler to invoke when connected to the bus of type bus-type, or NULL to ignore

See GBusAcquiredCallback for how it is called.

name-acquired-handler

handler to invoke when name is acquired, or NULL to ignore

See GBusNameAcquiredCallback for how it is called.

name-lost-handler

handler to invoke when name is lost, or NULL to ignore

See GBusNameLostCallback for how it is called.

user-data

user data to pass to handlers

user-data-free-func

function for freeing user-data

See GDestroyNotify for how it is called.

Procedure: bus-own-name-on-connection connection name flags [name-acquired-closure] [name-lost-closure] ⇒ %return

Like bus-own-name but takes a <GDBusConnection> instead of a <GBusType>.

connection

Passed: a <GDBusConnection>.

a bus connection

name

Passed: a string.

the well-known name to own

flags

Passed: a <GBusNameOwnerFlags>, or a list of its symbols, or one of them.

a set of flags with ownership options

name-acquired-closure

Passed, or left out: a <GClosure>, or #f.

name-lost-closure

Passed, or left out: a <GClosure>, or #f.

%return

Returned: an unsigned 32-bit integer.

an identifier (never 0) that can be used with bus-unown-name to stop owning the name

name-acquired-handler

handler to invoke when name is acquired, or NULL to ignore

See GBusNameAcquiredCallback for how it is called.

name-lost-handler

handler to invoke when name is lost, or NULL to ignore

See GBusNameLostCallback for how it is called.

user-data

user data to pass to handlers

user-data-free-func

function for freeing user-data

See GDestroyNotify for how it is called.

Procedure: bus-unown-name owner-id

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 <GMainContext> after this function has returned. You should continue to iterate the <GMainContext> until the GDestroyNotify function passed to bus-own-name is called, in order to avoid memory leaks through callbacks queued on the <GMainContext> after it’s stopped being iterated.

owner-id

Passed: an unsigned 32-bit integer.

an identifier obtained from bus-own-name

Procedure: bus-unwatch-name watcher-id

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 <GMainContext> after this function has returned. You should continue to iterate the <GMainContext> until the GDestroyNotify function passed to bus-watch-name is called, in order to avoid memory leaks through callbacks queued on the <GMainContext> after it’s stopped being iterated.

watcher-id

Passed: an unsigned 32-bit integer.

An identifier obtained from bus-watch-name

Procedure: bus-watch-name bus-type name flags [name-appeared-closure] [name-vanished-closure] ⇒ %return

Starts watching name on the bus specified by bus-type and calls name-appeared-handler and name-vanished-handler when the name is known to have an owner respectively known to lose its owner. Callbacks will be invoked in the thread-default main context (see main-context:push-thread-default) of the thread you are calling this function from.

You are guaranteed that one of the handlers will be invoked after calling this function. When you are done watching the name, just call bus-unwatch-name with the watcher id this function returns.

If the name vanishes or appears (for example the application owning the name could restart), the handlers are also invoked. If the <GDBusConnection> that is used for watching the name disconnects, then name-vanished-handler is invoked since it is no longer possible to access the name.

Another guarantee is that invocations of name-appeared-handler and name-vanished-handler are guaranteed to alternate; that is, if name-appeared-handler is invoked then you are guaranteed that the next time one of the handlers is invoked, it will be name-vanished-handler. The reverse is also true.

This behavior makes it very simple to write applications that want to take action when a certain name exists. Basically, the application should create object proxies in name-appeared-handler and destroy them again (if any) in name-vanished-handler.

bus-type

Passed: a <GBusType>, or one of its symbols.

The type of bus to watch a name on.

name

Passed: a string.

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

flags

Passed: a <GBusNameWatcherFlags>, or a list of its symbols, or one of them.

Flags from the <GBusNameWatcherFlags> enumeration.

name-appeared-closure

Passed, or left out: a <GClosure>, or #f.

name-vanished-closure

Passed, or left out: a <GClosure>, or #f.

%return

Returned: an unsigned 32-bit integer.

An identifier (never 0) that can be used with bus-unwatch-name to stop watching the name.

name-appeared-handler

Handler to invoke when name is known to exist or #f.

See GBusNameAppearedCallback for how it is called.

name-vanished-handler

Handler to invoke when name is known to not exist or #f.

See GBusNameVanishedCallback for how it is called.

user-data

User data to pass to handlers.

user-data-free-func

Function for freeing user-data or #f.

See GDestroyNotify for how it is called.

Procedure: bus-watch-name-on-connection connection name flags [name-appeared-closure] [name-vanished-closure] ⇒ %return

Like bus-watch-name but takes a <GDBusConnection> instead of a <GBusType>.

connection

Passed: a <GDBusConnection>.

A <GDBusConnection>.

name

Passed: a string.

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

flags

Passed: a <GBusNameWatcherFlags>, or a list of its symbols, or one of them.

Flags from the <GBusNameWatcherFlags> enumeration.

name-appeared-closure

Passed, or left out: a <GClosure>, or #f.

name-vanished-closure

Passed, or left out: a <GClosure>, or #f.

%return

Returned: an unsigned 32-bit integer.

An identifier (never 0) that can be used with bus-unwatch-name to stop watching the name.

name-appeared-handler

Handler to invoke when name is known to exist or #f.

See GBusNameAppearedCallback for how it is called.

name-vanished-handler

Handler to invoke when name is known to not exist or #f.

See GBusNameVanishedCallback for how it is called.

user-data

User data to pass to handlers.

user-data-free-func

Function for freeing user-data or #f.

See GDestroyNotify for how it is called.

Procedure: content-type-can-be-executable? type ⇒ %return

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

type

Passed: a string.

a content type string

%return

Returned: a boolean.

#t if the file type corresponds to a type that can be executable, #f otherwise.

Procedure: content-type-equals? type1 type2 ⇒ %return

Compares two content types for equality.

type1

Passed: a string.

a content type string

type2

Passed: a string.

a content type string

%return

Returned: a boolean.

#t if the two strings are identical or equivalent, #f otherwise.

Procedure: content-type-from-mime-type mime-type ⇒ %return

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

mime-type

Passed: a string.

a mime type string

%return

Returned: a string, or #f.

Newly allocated string with content type or #f. Free with byte-array:free

Procedure: content-type-get-description type ⇒ %return

Gets the human readable description of the content type.

type

Passed: a string.

a content type string

%return

Returned: a string.

a short description of the content type type. Free the returned string with byte-array:free

Procedure: content-type-get-generic-icon-name type ⇒ %return

Gets the generic icon name for a content type.

See the shared-mime-info specification for more on the generic icon name.

type

Passed: a string.

a content type string

%return

Returned: a string, or #f.

the registered generic icon name for the given type, or #f if unknown. Free with byte-array:free

Procedure: content-type-get-icon type ⇒ %return

Gets the icon for a content type.

type

Passed: a string.

a content type string

%return

Returned: a <GIcon>.

<GIcon> corresponding to the content type. Free the returned object with object:unref

Procedure: content-type-get-mime-dirs ⇒ %return

Get the list of directories which MIME data is loaded from. See content-type-set-mime-dirs for details.

%return

Returned: a vector, each a string.

#f-terminated list of directories to load MIME data from, including any mime/ subdirectory, and with the first directory to try listed first

Procedure: content-type-get-mime-type type ⇒ %return

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

type

Passed: a string.

a content type string

%return

Returned: a string, or #f.

the registered mime type for the given type, or #f if unknown; free with byte-array:free.

Procedure: content-type-get-symbolic-icon type ⇒ %return

Gets the symbolic icon for a content type.

type

Passed: a string.

a content type string

%return

Returned: a <GIcon>.

symbolic <GIcon> corresponding to the content type. Free the returned object with object:unref

Procedure: content-type-guess filename data ⇒ %return result-uncertain

Guesses the content type based on example data. If the function is uncertain, result-uncertain will be set to #t. Either filename or data may be #f, in which case the guess will be based solely on the other argument.

filename

Passed: a file name, as a string, or #f.

a path, or #f

data

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer, or #f.

a stream of data, or #f

%return

Returned: a string.

a string indicating a guessed content type for the given data. Free with byte-array:free

result-uncertain

Returned: a boolean.

return location for the certainty of the result, or #f

data-size

Not passed: guile-gi gives the length of data.

the size of data

Procedure: content-type-guess-for-tree root ⇒ %return

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 mount:guess-content-type.

root

Passed: a <GFile>.

the root of the tree to guess a type for

%return

Returned: a vector, each a string.

an #f-terminated array of zero or more content types. Free with strfreev

Procedure: content-type-is-a? type supertype ⇒ %return

Determines if type is a subset of supertype.

type

Passed: a string.

a content type string

supertype

Passed: a string.

a content type string

%return

Returned: a boolean.

#t if type is a kind of supertype, #f otherwise.

Procedure: content-type-is-mime-type? type mime-type ⇒ %return

Determines if type is a subset of mime-type. Convenience wrapper around content-type-is-a?.

type

Passed: a string.

a content type string

mime-type

Passed: a string.

a mime type string

%return

Returned: a boolean.

#t if type is a kind of mime-type, #f otherwise.

Procedure: content-type-is-unknown? type ⇒ %return

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.

type

Passed: a string.

a content type string

%return

Returned: a boolean.

#t if the type is the unknown type.

Procedure: content-type-set-mime-dirs [dirs]

Set the list of directories used by GIO to load the MIME database. If dirs is #f, 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 G_TEST_OPTION_ISOLATE_DIRS, but they depend on the system’s MIME database, you should call this function with dirs set to #f before calling g_test_init(), for instance:


  // 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 ();
dirs

Passed, or left out: a list or vector, each a string, or #f.

#f-terminated list of directories to load MIME data from, including any mime/ subdirectory, and with the first directory to try listed first

Procedure: content-types-get-registered ⇒ %return

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

%return

Returned: a list, each a string.

list of the registered content types

Procedure: dbus-address-escape-value string ⇒ %return

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.

string

Passed: a string.

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

%return

Returned: a string.

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

Procedure: dbus-address-get-for-bus-sync bus-type [cancellable] ⇒ %return

Synchronously looks up the D-Bus address for the well-known message bus instance specified by bus-type. This may involve using various platform specific mechanisms.

The returned address will be in the D-Bus address format.

bus-type

Passed: a <GBusType>, or one of its symbols.

a <GBusType>

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable> or #f

%return

Returned: a string.

a valid D-Bus address string for bus-type or #f if error is set

Procedure: dbus-address-get-stream address [cancellable] [callback]

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 dbus-address-get-stream-finish to get the result of the operation.

This is an asynchronous failable function. See dbus-address-get-stream-sync for the synchronous version.

address

Passed: a string.

A valid D-Bus address.

cancellable

Passed, or left out: a <GCancellable>, or #f.

A <GCancellable> or #f.

callback

Passed, or left out: a procedure, or #f.

A GAsyncReadyCallback to call when the request is satisfied.

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

Data to pass to callback.

Procedure: dbus-address-get-stream-finish res ⇒ %return out-guid

Finishes an operation started with dbus-address-get-stream.

A server is not required to set a GUID, so out-guid may be set to #f even on success.

res

Passed: a <GAsyncResult>.

A <GAsyncResult> obtained from the GAsyncReadyCallback passed to dbus-address-get-stream.

%return

Returned: a <GIOStream>.

A <GIOStream> or #f if error is set.

out-guid

Returned: a string, or #f.

#f or return location to store the GUID extracted from address, if any.

Procedure: dbus-address-get-stream-sync address [cancellable] ⇒ %return out-guid

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.

A server is not required to set a GUID, so out-guid may be set to #f even on success.

This is a synchronous failable function. See dbus-address-get-stream for the asynchronous version.

address

Passed: a string.

A valid D-Bus address.

cancellable

Passed, or left out: a <GCancellable>, or #f.

A <GCancellable> or #f.

%return

Returned: a <GIOStream>.

A <GIOStream> or #f if error is set.

out-guid

Returned: a string, or #f.

#f or return location to store the GUID extracted from address, if any.

Procedure: dbus-annotation-info-lookup annotations name ⇒ %return

Looks up the value of an annotation.

The cost of this function is O(n) in number of annotations.

annotations

Passed: a list or vector, each a <GDBusAnnotationInfo>, or #f.

A #f-terminated array of annotations or #f.

name

Passed: a string.

The name of the annotation to look up.

%return

Returned: a string, or #f.

The value or #f if not found. Do not free, it is owned by annotations.

Procedure: dbus-error-encode-gerror error ⇒ %return

Creates a D-Bus error name to use for error.

If error matches a registered error (see dbus-error:register-error?), the corresponding D-Bus error name will be returned.

Otherwise the a name of the form org.gtk.GDBus.UnmappedGError.Quark._ESCAPED_QUARK_NAME.Code_ERROR_CODE will be used. This allows other GDBus applications to map the error on the wire back to a <GError> using dbus-error:new-for-dbus-error.

This function is typically only used in object mappings to put a <GError> on the wire. Regular applications should not use it.

error

Passed: a <GError>.

an error

%return

Returned: a string.

a D-Bus error name

Procedure: dbus-error-get-remote-error error ⇒ %return

Gets the D-Bus error name used for error, if any.

This function is guaranteed to return a D-Bus error name for all <GError>s returned from functions handling remote method calls (for example, dbus-connection:call-finish) unless dbus-error:strip-remote-error? has already been used on error.

error

Passed: a <GError>.

an error

%return

Returned: a string, or #f.

an allocated string, or NULL if the D-Bus error name could not be found

Procedure: dbus-error-is-remote-error? error ⇒ %return

Checks if error represents an error received via D-Bus from a remote peer.

If so, use dbus-error:get-remote-error to get the name of the error.

error

Passed: a <GError>.

an error

%return

Returned: a boolean.

true if error represents an error from a remote peer; false otherwise

Procedure: dbus-error-new-for-dbus-error dbus-error-name dbus-error-message ⇒ %return

Creates a <GError> based on the contents of dbus-error-name and dbus-error-message.

Errors registered with dbus-error:register-error? will be looked up using dbus-error-name and if a match is found, the error domain and code is used. Applications can use dbus-error:get-remote-error to recover dbus-error-name.

If a match against a registered error is not found and the D-Bus error name is in a form as returned by dbus-error:encode-gerror the error domain and code encoded in the name is used to create the <GError>. Also, dbus-error-name is added to the error message such that it can be recovered with dbus-error:get-remote-error.

Otherwise, a <GError> with the error code Gio.IOErrorEnum.DBUS_ERROR in the <GIOErrorEnum> error domain is returned. Also, dbus-error-name is added to the error message such that it can be recovered with dbus-error:get-remote-error.

In all three cases, dbus-error-name can always be recovered from the returned <GError> using the dbus-error:get-remote-error function (unless dbus-error:strip-remote-error? hasn’t been used on the returned error).

This function is typically only used in object mappings to prepare <GError> instances for applications. Regular applications should not use it.

dbus-error-name

Passed: a string.

D-Bus error name

dbus-error-message

Passed: a string.

D-Bus error message

%return

Returned: a <GError>.

an allocated <GError>

Procedure: dbus-error-quark ⇒ %return
%return

Returned: an unsigned 32-bit integer.

Procedure: dbus-error-register-error? error-domain error-code dbus-error-name ⇒ %return

Creates an association mapping between dbus-error-name and <GError>s specified by error-domain and error-code.

This is typically done in the function that returns the GLib.Quark for an error domain.

error-domain

Passed: an unsigned 32-bit integer.

a GLib.Quark for an error domain

error-code

Passed: a 32-bit integer.

an error code

dbus-error-name

Passed: a string.

a D-Bus error name

%return

Returned: a boolean.

true if the association was created, false if it already exists

Procedure: dbus-error-strip-remote-error? error ⇒ %return

Looks for extra information in the error message used to recover the D-Bus error name and strips it if found.

If stripped, the message field in error will correspond exactly to what was received on the wire.

This is typically used when presenting errors to the end user.

error

Passed: a <GError>.

an error

%return

Returned: a boolean.

true if information was stripped; false otherwise

Procedure: dbus-error-unregister-error? error-domain error-code dbus-error-name ⇒ %return

Destroys an association previously set up with dbus-error:register-error?.

error-domain

Passed: an unsigned 32-bit integer.

a GLib.Quark for an error domain

error-code

Passed: a 32-bit integer.

an error code

dbus-error-name

Passed: a string.

a D-Bus error name

%return

Returned: a boolean.

true if the association was destroyed, false if it wasn’t found

Procedure: dbus-escape-object-path s ⇒ %return

This is a language binding friendly version of dbus-escape-object-path-bytestring.

s

Passed: a string.

the string to escape

%return

Returned: a string.

an escaped version of s. Free with byte-array:free.

Procedure: dbus-escape-object-path-bytestring bytes ⇒ %return

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 dbus-unescape-object-path.

bytes

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer.

the string of bytes to escape

%return

Returned: a string.

an escaped version of bytes. Free with byte-array:free.

Procedure: dbus-generate-guid ⇒ %return

Generate a D-Bus GUID that can be used with e.g. dbus-connection:new.

See the 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 RFC 4122.

%return

Returned: a string.

A valid D-Bus GUID. Free with byte-array:free.

Procedure: dbus-gvalue-to-gvariant gvalue type ⇒ %return

Converts a <GValue> 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 <GVariantType>

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 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 #f, the empty <GVariant> instance (never #f) 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 dbus-gvariant-to-gvalue! function for how to convert a <GVariant> to a <GValue>.

gvalue

Passed: a <GValue>.

A <GValue> to convert to a <GVariant>

type

Passed: a <GVariantType>.

A <GVariantType>

%return

Returned: a <GVariant>.

A <GVariant> (never floating) of <GVariantType> type holding the data from gvalue or an empty <GVariant> in case of failure. Free with variant:unref.

Procedure: dbus-gvariant-to-gvalue! value out-gvalue ⇒ out-gvalue

Converts a <GVariant> to a <GValue>. If value is floating, it is consumed.

The rules specified in the dbus-gvalue-to-gvariant 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 <GValue> containing a basic value or string array. Any other <GVariant> (handle, variant, tuple, dict entry) will be converted to a <GValue> containing that <GVariant>.

The conversion never fails - a valid <GValue> is always returned in out-gvalue.

value

Passed: a <GVariant>.

A <GVariant>.

out-gvalue

Passed, filled in, and returned: a <GValue>.

Return location pointing to a zero-filled (uninitialized) <GValue>.

Procedure: dbus-is-address? string ⇒ %return

Checks if string is a D-Bus address.

This doesn’t check if string is actually supported by <GDBusServer> or <GDBusConnection> - use dbus-is-supported-address? to do more checks.

string

Passed: a string.

A string.

%return

Returned: a boolean.

#t if string is a valid D-Bus address, #f otherwise.

Procedure: dbus-is-error-name? string ⇒ %return

Check whether string is a valid D-Bus error name.

This function returns the same result as dbus-is-interface-name?, because D-Bus error names are defined to have exactly the same syntax as interface names.

string

Passed: a string.

The string to check.

%return

Returned: a boolean.

#t if valid, #f otherwise.

Procedure: dbus-is-guid? string ⇒ %return

Checks if string is a D-Bus GUID.

See the documentation for dbus-generate-guid for more information about the format of a GUID.

string

Passed: a string.

The string to check.

%return

Returned: a boolean.

#t if string is a GUID, #f otherwise.

Procedure: dbus-is-interface-name? string ⇒ %return

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

string

Passed: a string.

The string to check.

%return

Returned: a boolean.

#t if valid, #f otherwise.

Procedure: dbus-is-member-name? string ⇒ %return

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

string

Passed: a string.

The string to check.

%return

Returned: a boolean.

#t if valid, #f otherwise.

Procedure: dbus-is-name? string ⇒ %return

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

string

Passed: a string.

The string to check.

%return

Returned: a boolean.

#t if valid, #f otherwise.

Procedure: dbus-is-supported-address? string ⇒ %return

Like dbus-is-address? 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.

string

Passed: a string.

A string.

%return

Returned: a boolean.

#t if string is a valid D-Bus address that is supported by this library, #f if error is set.

Procedure: dbus-is-unique-name? string ⇒ %return

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

string

Passed: a string.

The string to check.

%return

Returned: a boolean.

#t if valid, #f otherwise.

Procedure: dbus-unescape-object-path s ⇒ %return

Unescapes an string that was previously escaped with dbus-escape-object-path. If the string is in a format that could not have been returned by dbus-escape-object-path, this function returns #f.

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

s

Passed: a string.

the string to unescape

%return

Returned: a bytevector, or #f.

an unescaped version of s, or #f if s is not a string returned from dbus-escape-object-path. Free with byte-array:free.

Procedure: dtls-client-connection-new base-socket [server-identity] ⇒ %return

Creates a new <GDtlsClientConnection> wrapping base-socket which is assumed to communicate with the server identified by server-identity.

base-socket

Passed: a <GDatagramBased>.

the <GDatagramBased> to wrap

server-identity

Passed, or left out: a <GSocketConnectable>, or #f.

the expected identity of the server

%return

Returned: a <GDtlsClientConnection>.

the new <GDtlsClientConnection>, or #f on error

Procedure: dtls-server-connection-new base-socket [certificate] ⇒ %return

Creates a new <GDtlsServerConnection> wrapping base-socket.

base-socket

Passed: a <GDatagramBased>.

the <GDatagramBased> to wrap

certificate

Passed, or left out: a <GTlsCertificate>, or #f.

the default server certificate, or #f

%return

Returned: a <GDtlsServerConnection>.

the new <GDtlsServerConnection>, or #f on error

Procedure: file-new-build-filenamev args ⇒ %return

Constructs a <GFile> from a vector of elements using the correct separator for filenames.

Using this function is equivalent to calling build-filenamev, followed by file-new-for-path on the result.

args

Passed: a list or vector, each a file name, as a string.

#f-terminated array of strings containing the path elements.

%return

Returned: a <GFile>.

a new <GFile>

Procedure: file-new-for-commandline-arg arg ⇒ %return

Creates a <GFile> with the given argument from the command line. The value of arg can be either a URI, an absolute path or a relative path resolved relative to the current working directory. This operation never fails, but the returned object might not support any I/O operation if arg points to a malformed path.

Note that on Windows, this function expects its argument to be in UTF-8 – not the system code page. This means that you should not use this function with string from argv as it is passed to main(). g_win32_get_command_line() will return a UTF-8 version of the commandline. <GApplication> also uses UTF-8 but application-command-line:create-file-for-arg may be more useful for you there. It is also always possible to use this function with GOptionContext arguments of type filename.

arg

Passed: a file name, as a string.

a command line string

%return

Returned: a <GFile>.

a new <GFile>. Free the returned object with object:unref.

Procedure: file-new-for-commandline-arg-and-cwd arg cwd ⇒ %return

Creates a <GFile> with the given argument from the command line.

This function is similar to file-new-for-commandline-arg except that it allows for passing the current working directory as an argument instead of using the current working directory of the process.

This is useful if the commandline argument was given in a context other than the invocation of the current process.

See also application-command-line:create-file-for-arg.

arg

Passed: a file name, as a string.

a command line string

cwd

Passed: a file name, as a string.

the current working directory of the commandline

%return

Returned: a <GFile>.

a new <GFile>

Procedure: file-new-for-path path ⇒ %return

Constructs a <GFile> for a given path. This operation never fails, but the returned object might not support any I/O operation if path is malformed.

path

Passed: a file name, as a string.

a string containing a relative or absolute path. The string must be encoded in the glib filename encoding.

%return

Returned: a <GFile>.

a new <GFile> for the given path. Free the returned object with object:unref.

Procedure: file-new-for-uri uri ⇒ %return

Constructs a <GFile> for a given URI. This operation never fails, but the returned object might not support any I/O operation if uri is malformed or if the uri type is not supported.

uri

Passed: a string.

a UTF-8 string containing a URI

%return

Returned: a <GFile>.

a new <GFile> for the given uri. Free the returned object with object:unref.

Procedure: file-new-tmp [tmpl] ⇒ %return iostream

Opens a file in the preferred directory for temporary files (as returned by get-tmp-dir) and returns a <GFile> and <GFileIOStream> pointing to it.

tmpl should be a string in the GLib file name encoding containing a sequence of six ’X’ characters, and containing no directory components. If it is #f, a default template is used.

Unlike the other <GFile> constructors, this will return #f if a temporary file could not be created.

tmpl

Passed, or left out: a file name, as a string, or #f.

Template for the file name, as in file-open-tmp, or #f for a default template

%return

Returned: a <GFile>.

a new <GFile>. Free the returned object with object:unref.

iostream

Returned: a <GFileIOStream>.

on return, a <GFileIOStream> for the created file

Procedure: file-new-tmp-async tmpl io-priority [cancellable] [callback]

Asynchronously opens a file in the preferred directory for temporary files (as returned by get-tmp-dir) as file-new-tmp.

tmpl should be a string in the GLib file name encoding containing a sequence of six ’X’ characters, and containing no directory components. If it is #f, a default template is used.

tmpl

Passed: a file name, as a string, or #f.

Template for the file name, as in file-open-tmp, or #f for a default template

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is done

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to callback

Procedure: file-new-tmp-dir-async tmpl io-priority [cancellable] [callback]

Asynchronously creates a directory in the preferred directory for temporary files (as returned by get-tmp-dir) as dir-make-tmp.

tmpl should be a string in the GLib file name encoding containing a sequence of six ’X’ characters, and containing no directory components. If it is #f, a default template is used.

tmpl

Passed: a file name, as a string, or #f.

Template for the file name, as in dir-make-tmp, or #f for a default template

io-priority

Passed: a 32-bit integer.

the I/O priority of the request

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is done

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

data to pass to callback

Procedure: file-new-tmp-dir-finish result ⇒ %return

Finishes a temporary directory creation started by file-new-tmp-dir-async.

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFile>.

a new <GFile>. Free the returned object with object:unref.

Procedure: file-new-tmp-finish result ⇒ %return iostream

Finishes a temporary file creation started by file-new-tmp-async.

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GFile>.

a new <GFile>. Free the returned object with object:unref.

iostream

Returned: a <GFileIOStream>.

on return, a <GFileIOStream> for the created file

Procedure: file-parse-name parse-name ⇒ %return

Constructs a <GFile> with the given parse-name (i.e. something given by file:get-parse-name). This operation never fails, but the returned object might not support any I/O operation if the parse-name cannot be parsed.

parse-name

Passed: a string.

a file name or path to be parsed

%return

Returned: a <GFile>.

a new <GFile>.

Procedure: icon-deserialize value ⇒ %return

Deserializes a <GIcon> previously serialized using icon:serialize.

value

Passed: a <GVariant>.

a <GVariant> created with icon:serialize

%return

Returned: a <GIcon>, or #f.

a <GIcon>, or #f when deserialization fails.

Procedure: icon-new-for-string str ⇒ %return

Generate a <GIcon> instance from str. This function can fail if str is not valid - see icon:to-string for discussion.

If your application or library provides one or more <GIcon> implementations you need to ensure that each GType is registered with the type system prior to calling icon-new-for-string.

str

Passed: a string.

A string obtained via icon:to-string.

%return

Returned: a <GIcon>.

An object implementing the <GIcon> interface or #f if error is set.

Procedure: io-error-from-errno err-no ⇒ %return

Converts errno.h error codes into GIO error codes.

The fallback value failed 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:


  int saved_errno;

  ret = read (blah);
  saved_errno = errno;

  g_io_error_from_errno (saved_errno);
err-no

Passed: a 32-bit integer.

Error number as defined in errno.h.

%return

Returned: a <GIOErrorEnum>.

<GIOErrorEnum> value for the given errno.h error number

Procedure: io-error-from-file-error file-error ⇒ %return

Converts <%GFileError> error codes into GIO error codes.

file-error

Passed: a <%GFileError>, or one of its symbols.

a <%GFileError>.

%return

Returned: a <GIOErrorEnum>.

<GIOErrorEnum> value for the given <%GFileError> error value.

Procedure: io-error-quark ⇒ %return

Gets the GIO Error Quark.

%return

Returned: an unsigned 32-bit integer.

a GQuark.

Procedure: io-modules-load-all-in-directory dirname ⇒ %return

Loads all the modules in the specified directory.

If don’t require all modules to be initialized (and thus registering all gtypes) then you can use io-modules-scan-all-in-directory which allows delayed/lazy loading of modules.

dirname

Passed: a file name, as a string.

pathname for a directory containing modules to load.

%return

Returned: a list, each a <GIOModule>.

a list of GIOModules loaded from the directory, All the modules are loaded into memory, if you want to unload them (enabling on-demand loading) you must call type-module:unuse on all the modules. Free the list with g_list_free().

Procedure: io-modules-scan-all-in-directory dirname

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. g_io_extension_point_get_extensions() or g_io_extension_point_get_extension_by_name().

If you need to guarantee that all types are loaded in all the modules, use io-modules-load-all-in-directory.

dirname

Passed: a file name, as a string.

pathname for a directory containing modules to scan.

Procedure: keyfile-settings-backend-new filename root-path [root-group] ⇒ %return

Creates a keyfile-backed <GSettingsBackend>.

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 root-path (which must start and end with a slash and not contain two consecutive slashes). root-path may be "/".

If root-group is non-NULL then it specifies the name of the keyfile group used for keys that are written directly below root-path. For example, if root-path is "/apps/example/" and root-group is "toplevel", then setting the key "/apps/example/enabled" to true will cause the following to appear in the keyfile:

[toplevel]
enabled=true

If root-group is NULL then it is not permitted to store keys directly below the root-path.

For keys not stored directly below root-path (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 root-path and, in the event that root-group is NULL, also for keys directly under root-path. 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.

filename

Passed: a string.

the filename of the keyfile

root-path

Passed: a string.

the path under which all settings keys appear

root-group

Passed, or left out: a string, or #f.

the group name corresponding to root-path, or NULL to disallow storing keys directly beneath root-path

%return

Returned: a <GSettingsBackend>.

a keyfile-backed <GSettingsBackend>

Procedure: memory-monitor-dup-default ⇒ %return

Gets a reference to the default <GMemoryMonitor> for the system.

%return

Returned: a <GMemoryMonitor>.

a new reference to the default <GMemoryMonitor>

Procedure: memory-settings-backend-new ⇒ %return

Creates a memory-backed <GSettingsBackend>.

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.

%return

Returned: a <GSettingsBackend>.

a newly created <GSettingsBackend>

Procedure: network-monitor-get-default ⇒ %return

Gets the default <GNetworkMonitor> for the system.

%return

Returned: a <GNetworkMonitor>.

a <GNetworkMonitor>, which will be a dummy object if no network monitor is available

Procedure: networking-init

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

Procedure: null-settings-backend-new ⇒ %return

Creates a readonly <GSettingsBackend>.

This backend does not allow changes to settings, so all settings will always have their default values.

%return

Returned: a <GSettingsBackend>.

a newly created <GSettingsBackend>

Procedure: pollable-source-new pollable-stream ⇒ %return

Utility method for <GPollableInputStream> and <GPollableOutputStream> implementations. Creates a new <GSource> that expects a callback of type GPollableSourceFunc. The new source does not actually do anything on its own; use source:add-child-source to add other sources to it to cause it to trigger.

pollable-stream

Passed: a <GObject>.

the stream associated with the new source

%return

Returned: a <GSource>.

the new <GSource>.

Procedure: pollable-source-new-full pollable-stream [child-source] [cancellable] ⇒ %return

Utility method for <GPollableInputStream> and <GPollableOutputStream> implementations. Creates a new <GSource>, as with pollable-source-new, but also attaching child-source (with a dummy callback), and cancellable, if they are non-#f.

pollable-stream

Passed: a <GObject>.

the stream associated with the new source

child-source

Passed, or left out: a <GSource>, or #f.

optional child source to attach

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> to attach

%return

Returned: a <GSource>.

the new <GSource>.

Procedure: pollable-stream-read stream buffer blocking [cancellable] ⇒ %return

Tries to read from stream, as with input-stream:read! (if blocking is #t) or pollable-input-stream:read-nonblocking! (if blocking is #f). This can be used to more easily share code between blocking and non-blocking implementations of a method.

If blocking is #f, then stream must be a <GPollableInputStream> for which pollable-input-stream:can-poll? returns #t, or else the behavior is undefined. If blocking is #t, then stream does not need to be a <GPollableInputStream>.

stream

Passed: a <GInputStream>.

a <GInputStream>

buffer

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer.

a buffer to read data into

blocking

Passed: a boolean.

whether to do blocking I/O

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

%return

Returned: a 64-bit integer.

the number of bytes read, or -1 on error.

count

Not passed: guile-gi gives the length of buffer.

the number of bytes to read

Procedure: pollable-stream-write stream buffer blocking [cancellable] ⇒ %return

Tries to write to stream, as with output-stream:write (if blocking is #t) or pollable-output-stream:write-nonblocking (if blocking is #f). This can be used to more easily share code between blocking and non-blocking implementations of a method.

If blocking is #f, then stream must be a <GPollableOutputStream> for which pollable-output-stream:can-poll? returns #t or else the behavior is undefined. If blocking is #t, then stream does not need to be a <GPollableOutputStream>.

stream

Passed: a <GOutputStream>.

a <GOutputStream>.

buffer

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer.

the buffer containing the data to write.

blocking

Passed: a boolean.

whether to do blocking I/O

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

%return

Returned: a 64-bit integer.

the number of bytes written, or -1 on error.

count

Not passed: guile-gi gives the length of buffer.

the number of bytes to write

Procedure: pollable-stream-write-all stream buffer blocking [cancellable] ⇒ %return bytes-written

Tries to write count bytes to stream, as with output-stream:write-all, but using pollable-stream-write rather than output-stream:write.

On a successful write of count bytes, #t is returned, and bytes-written is set to count.

If there is an error during the operation (including would-block in the non-blocking case), #f is returned and error is set to indicate the error status, bytes-written is updated to contain the number of bytes written into the stream before the error occurred.

As with pollable-stream-write, if blocking is #f, then stream must be a <GPollableOutputStream> for which pollable-output-stream:can-poll? returns #t or else the behavior is undefined. If blocking is #t, then stream does not need to be a <GPollableOutputStream>.

stream

Passed: a <GOutputStream>.

a <GOutputStream>.

buffer

Passed: a bytevector, or a list or vector, each an unsigned 8-bit integer.

the buffer containing the data to write.

blocking

Passed: a boolean.

whether to do blocking I/O

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

%return

Returned: a boolean.

#t on success, #f if there was an error

bytes-written

Returned: an unsigned 64-bit integer.

location to store the number of bytes that was written to the stream

count

Not passed: guile-gi gives the length of buffer.

the number of bytes to write

Procedure: power-profile-monitor-dup-default ⇒ %return

Gets a reference to the default <GPowerProfileMonitor> for the system.

%return

Returned: a <GPowerProfileMonitor>.

a new reference to the default <GPowerProfileMonitor>

Procedure: proxy-get-default-for-protocol protocol ⇒ %return

Find the gio-proxy extension point for a proxy implementation that supports the specified protocol.

protocol

Passed: a string.

the proxy protocol name (e.g. http, socks, etc)

%return

Returned: a <GProxy>, or #f.

return a <GProxy> or NULL if protocol is not supported.

Procedure: proxy-resolver-get-default ⇒ %return

Gets the default <GProxyResolver> for the system.

%return

Returned: a <GProxyResolver>.

the default <GProxyResolver>, which will be a dummy object if no proxy resolver is available

Procedure: resolver-error-quark ⇒ %return

Gets the <GResolver> Error Quark.

%return

Returned: an unsigned 32-bit integer.

a GQuark.

Procedure: resource-error-quark ⇒ %return

Gets the <GResource> Error Quark.

%return

Returned: an unsigned 32-bit integer.

a GLib.Quark

Procedure: resource-load filename ⇒ %return

Loads a binary resource bundle and creates a <GResource> representation of it, allowing you to query it for data.

If you want to use this resource in the global resource namespace you need to register it with resources-register.

If filename is empty or the data in it is corrupt, internal will be returned. If filename doesn’t exist, or there is an error in reading it, an error from mapped-file:new will be returned.

filename

Passed: a file name, as a string.

the path of a filename to load, in the GLib filename encoding

%return

Returned: a <GResource>.

a new <GResource>, or NULL on error

Procedure: resources-enumerate-children path lookup-flags ⇒ %return

Returns all the names of children at the specified path in the set of globally registered resources.

The return result is a NULL terminated list of strings which should be released with strfreev.

lookup-flags controls the behaviour of the lookup.

path

Passed: a string.

A path name inside the resource

lookup-flags

Passed: a <GResourceLookupFlags>, or a list of its symbols, or one of them.

A <GResourceLookupFlags>

%return

Returned: a vector, each a string.

an array of constant strings

Procedure: resources-get-info path lookup-flags ⇒ %return size flags

Looks for a file at the specified path in the set of globally registered resources and if found returns information about it.

lookup-flags controls the behaviour of the lookup.

path

Passed: a string.

A path name inside the resource

lookup-flags

Passed: a <GResourceLookupFlags>, or a list of its symbols, or one of them.

A <GResourceLookupFlags>

%return

Returned: a boolean.

TRUE if the file was found, FALSE if there were errors

size

Returned: an unsigned 64-bit integer.

a location to place the length of the contents of the file, or NULL if the length is not needed

flags

Returned: an unsigned 32-bit integer.

a location to place the <GResourceFlags> about the file, or NULL if the flags are not needed

Procedure: resources-has-children? path ⇒ %return

Returns whether the specified path in the set of globally registered resources has children.

path

Passed: a string.

A pathname

%return

Returned: a boolean.

#t if patch has children

Procedure: resources-lookup-data path lookup-flags ⇒ %return

Looks for a file at the specified path in the set of globally registered resources and returns a <GBytes> 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 read-only data section in the program binary. For compressed files we allocate memory on the heap and automatically uncompress the data.

lookup-flags controls the behaviour of the lookup.

path

Passed: a string.

A path name inside the resource

lookup-flags

Passed: a <GResourceLookupFlags>, or a list of its symbols, or one of them.

A <GResourceLookupFlags>

%return

Returned: a <GBytes>.

<GBytes> or NULL on error

Procedure: resources-open-stream path lookup-flags ⇒ %return

Looks for a file at the specified path in the set of globally registered resources and returns a <GInputStream> that lets you read the data.

lookup-flags controls the behaviour of the lookup.

path

Passed: a string.

A path name inside the resource

lookup-flags

Passed: a <GResourceLookupFlags>, or a list of its symbols, or one of them.

A <GResourceLookupFlags>

%return

Returned: a <GInputStream>.

<GInputStream> or NULL on error

Procedure: resources-register resource

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 resources-lookup-data.

resource

Passed: a <GResource>.

A <GResource>

Procedure: resources-unregister resource

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

resource

Passed: a <GResource>.

A <GResource>

Procedure: settings-schema-source-get-default ⇒ %return

Gets the default system schema source.

This function is not required for normal uses of <GSettings> but it may be useful to authors of plugin management systems or to those who want to introspect the content of schemas.

If no schemas are installed, #f will be returned.

The returned source may actually consist of multiple schema sources from different directories, depending on which directories were given in XDG_DATA_DIRS and GSETTINGS_SCHEMA_DIR. For this reason, all lookups performed against the default source should probably be done recursively.

%return

Returned: a <GSettingsSchemaSource>, or #f.

the default schema source

Procedure: tls-backend-get-default ⇒ %return

Gets the default <GTlsBackend> for the system.

%return

Returned: a <GTlsBackend>.

a <GTlsBackend>, which will be a dummy object if no TLS backend is available

Procedure: tls-channel-binding-error-quark ⇒ %return

Gets the TLS channel binding error quark.

%return

Returned: an unsigned 32-bit integer.

a GQuark.

Procedure: tls-client-connection-new base-io-stream [server-identity] ⇒ %return

Creates a new <GTlsClientConnection> wrapping base-io-stream (which must have pollable input and output streams) which is assumed to communicate with the server identified by server-identity.

See the documentation for tls-connection:base-io-stream for restrictions on when application code can run operations on the base-io-stream after this function has returned.

base-io-stream

Passed: a <GIOStream>.

the <GIOStream> to wrap

server-identity

Passed, or left out: a <GSocketConnectable>, or #f.

the expected identity of the server

%return

Returned: a <GTlsClientConnection>.

the new <GTlsClientConnection>, or #f on error

Procedure: tls-error-quark ⇒ %return

Gets the TLS error quark.

%return

Returned: an unsigned 32-bit integer.

a GQuark.

Procedure: tls-file-database-new anchors ⇒ %return

Creates a new <GTlsFileDatabase> which uses anchor certificate authorities in anchors to verify certificate chains.

The certificates in anchors must be PEM encoded.

anchors

Passed: a file name, as a string.

filename of anchor certificate authorities.

%return

Returned: a <GTlsFileDatabase>.

the new <GTlsFileDatabase>, or #f on error

Procedure: tls-server-connection-new base-io-stream [certificate] ⇒ %return

Creates a new <GTlsServerConnection> wrapping base-io-stream (which must have pollable input and output streams).

See the documentation for tls-connection:base-io-stream for restrictions on when application code can run operations on the base-io-stream after this function has returned.

base-io-stream

Passed: a <GIOStream>.

the <GIOStream> to wrap

certificate

Passed, or left out: a <GTlsCertificate>, or #f.

the default server certificate, or #f

%return

Returned: a <GTlsServerConnection>.

the new <GTlsServerConnection>, or #f on error