Functions

aio_close (aio_context, fd)

aio_open (aio_context, path, flags, mode)

aio_read (aio_context, fd, offset)

aio_write (aio_context, fd, buffer, offset)

app_info_get_default_for_type (content_type, must_support_uris)

app_info_get_default_for_uri_scheme (uri_scheme)

app_info_launch_default_for_uri (uri, context)

app_info_launch_uris (appinfo, uris, context)

async_initable_init (initable, io_priority)

buffered_input_stream_fill (stream, count, io_priority)

bus_get (bus_type)

bus_own_name_on_connection (connection, name, flags)

data_input_stream_read_line (stream, io_priority)

data_input_stream_read_line_utf8 (stream, io_priority)

data_input_stream_read_upto (stream, stop_chars, stop_chars_len, io_priority)

dbus_connection_call (connection, bus_name, object_path, interface_name, method_name, parameters, reply_type, flags, timeout_msec)

dbus_connection_call_with_unix_fd_list (connection, bus_name, object_path, interface_name, method_name, parameters, reply_type, flags, timeout_msec, fd_list)

dbus_connection_close (connection)

dbus_connection_send_message_with_reply (connection, message, flags, timeout_msec)

dtls_connection_close (dtls_connection, io_priority)

dtls_connection_handshake (dtls_connection, io_priority)

dtls_connection_shutdown (dtls_connection, shutdown_read, shutdown_write, io_priority)

error_quark ()

fd_watch (fd, events)

file_append_to (file, flags, io_priority)

file_copy (source, destination, flags, io_priority)

file_copy_with_progress (source, destination, flags, io_priority, progress_callback, *progress_callback_data)

file_create (file, flags, io_priority)

file_create_readwrite (file, flags, io_priority)

file_delete (file, io_priority)

file_enumerate_children (file, attributes, flags, io_priority)

file_enumerator_close (file_enumerator, io_priority)

file_enumerator_next_files (file_enumerator, num_files, io_priority)

file_find_enclosing_mount (file, io_priority)

file_input_stream_query_info (stream, attributes, io_priority)

file_io_stream_query_info (stream, attributes, io_priority)

file_load_bytes (file)

file_load_contents_bytes (file)

file_load_partial_contents_bytes (file, read_more_callback, *read_more_callback_data)

file_make_directory (file, io_priority)

file_make_directory_with_parents (file)

file_make_symbolic_link (file, symlink_value, io_priority)

file_move (source, destination, flags, io_priority, progress_callback, *progress_callback_data)

file_new_tmp_dir (tmpl, io_priority)

file_open_readwrite (file, io_priority)

file_output_stream_query_info (stream, attributes, io_priority)

file_query_default_handler (file, io_priority)

file_query_exists (file)

file_query_file_type (file, flags, io_priority)

file_query_filesystem_info (file, attributes, io_priority)

file_query_info (file, attributes, flags, io_priority)

file_read (file, io_priority)

file_replace (file, etag, make_backup, flags, io_priority)

file_replace_contents (file, contents, etag, make_backup, flags)

file_replace_contents_bytes (file, contents, etag, make_backup, flags)

file_replace_readwrite (file, etag, make_backup, flags, io_priority)

file_set_attributes (file, file_info, flags, io_priority)

file_set_display_name (file, display_name, io_priority)

file_trash (file, io_priority)

find_program_in_path (program)

get_major_version ()

get_micro_version ()

get_min_stack_size ()

get_minor_version ()

get_page_size ()

init ()

input_stream_close (self, io_priority)

input_stream_read (self, io_priority)

input_stream_read_bytes (stream, count, io_priority)

input_stream_skip (self, count, io_priority)

io_stream_close (io_stream, io_priority)

io_stream_splice (stream1, stream2, flags, io_priority)

mkdir_with_parents (path, mode)

network_monitor_can_reach (monitor, connectable)

output_stream_close (self, io_priority)

output_stream_flush (self, io_priority)

output_stream_splice (output, input, flags, io_priority)

output_stream_write (self, buffer, io_priority)

output_stream_write_bytes (stream, bytes, io_priority)

output_stream_writev_all (stream, vectors, io_priority)

param_spec_object (name, nick, blurb, object_type, flags)

permission_acquire (permission)

permission_release (permission)

proxy_connect (proxy, connection, proxy_address)

proxy_resolver_lookup (resolver, uri)

resolver_lookup_by_address (resolver, address)

resolver_lookup_by_name (resolver, address)

resolver_lookup_by_name_with_flags (resolver, address, flags)

resolver_lookup_records (resolver, rrname, record_type)

resolver_lookup_service (resolver, service, protocol, domain)

socket_address_enumerator_next (enumerator)

socket_client_connect (socket_client, socket_connectable)

socket_client_connect_to_host (socket_client, host_and_port, default_port)

socket_client_connect_to_service (socket_client, domain, service)

socket_client_connect_to_uri (socket_client, uri, default_port)

socket_connection_connect (connection, address)

socket_listener_accept (listener)

socket_wait (socket, condition)

subprocess_wait (subprocess)

subprocess_wait_check (subprocess)

test_add_func (testpath, test_func)

thread_spawn (thread_name, thread_func, *user_data)

thread_wait_for (future)

tls_connection_handshake (tls_connection, io_priority)

tls_database_lookup_certificate_for_handle (database, handle, interaction, flags)

tls_database_lookup_certificate_issuer (database, certificate, interaction, flags)

tls_database_lookup_certificates_issued_by (database, issuer_raw_dn, interaction, flags)

tls_database_verify_chain (database, chain, purpose, identity, interaction, flags)

tls_interaction_ask_password (interaction, password)

tls_interaction_request_certificate (interaction, connection, flags)

unix_connection_receive_credentials (connection)

unix_connection_send_credentials (connection)

unlink (path)

value_dup_object (value)

value_get_object (value)

value_set_object (value, object)

value_take_object (value, object)

Details

Dex.aio_close(aio_context, fd)
Parameters:
Returns:

a future that will resolve to True when the close completes or rejects with error.

Return type:

Dex.Future

An asynchronous close() wrapper.

This function takes ownership of fd and will close it asynchronously.

Generally you want to provide NULL for the aio_context as that will get the default aio context for your scheduler.

Added in version 1.2.

Dex.aio_open(aio_context, path, flags, mode)
Parameters:
  • aio_context (Dex.AioContext or None)

  • path (str) – the path to open

  • flags (int) – flags for open()

  • mode (int) – permissions to use when creating the file

Returns:

a future that will resolve when the open completes or rejects with error.

Return type:

Dex.Future

An asynchronous open() wrapper.

Generally you want to provide NULL for the aio_context as that will get the default aio context for your scheduler.

The resulting future resolves to a file descriptor which can be consumed with [method`Dex`.Future.await_fd].

Added in version 1.2.

Dex.aio_read(aio_context, fd, offset)
Parameters:
Returns:

a future that will resolve when the read completes or rejects with error.

Return type:

(Dex.Future, buffer: bytes)

An asynchronous pread() wrapper.

Generally you want to provide NULL for the aio_context as that will get the default aio context for your scheduler.

Dex.aio_write(aio_context, fd, buffer, offset)
Parameters:
Returns:

a future that will resolve when the write completes or rejects with error.

Return type:

Dex.Future

An asynchronous pwrite() wrapper.

Generally you want to provide NULL for the aio_context as that will get the default aio context for your scheduler.

Dex.app_info_get_default_for_type(content_type, must_support_uris)
Parameters:
  • content_type (str) – a content type

  • must_support_uris (bool) – whether the app must support URIs

Returns:

a [class`Dex`.Future] that resolves to a [iface`Gio`.AppInfo] or rejects with error.

Return type:

Dex.Future

Wraps [func`Gio`.AppInfo.get_default_for_type_async].

Added in version 1.2.

Dex.app_info_get_default_for_uri_scheme(uri_scheme)
Parameters:

uri_scheme (str) – a URI scheme

Returns:

a [class`Dex`.Future] that resolves to a [iface`Gio`.AppInfo] or rejects with error.

Return type:

Dex.Future

Wraps [func`Gio`.AppInfo.get_default_for_uri_scheme_async].

Added in version 1.2.

Dex.app_info_launch_default_for_uri(uri, context)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [func`Gio`.AppInfo.launch_default_for_uri_async].

Added in version 1.2.

Dex.app_info_launch_uris(appinfo, uris, context)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.AppInfo.launch_uris_async].

Added in version 1.2.

Dex.async_initable_init(initable, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to the initable instance or rejects with error.

Return type:

Dex.Future

A helper for [method`Gio`.AsyncInitable.init_async].

Added in version 1.0.

Dex.buffered_input_stream_fill(stream, count, io_priority)
Parameters:
  • stream (Gio.BufferedInputStream) – a [class`Gio`.BufferedInputStream]

  • count (int) – the number of bytes to fill, or -1

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to the number of bytes read as a gint64, or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.BufferedInputStream.fill_async].

Added in version 1.2.

Dex.bus_get(bus_type)
Parameters:

bus_type (Gio.BusType) – the [enum`Gio`.BusType]

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.DBusConnection] or rejects with error.

Return type:

Dex.Future

Wrapper for [func`Gio`.bus_get].

Added in version 0.4.

Dex.bus_own_name_on_connection(connection, name, flags)
Parameters:
Returns:

out_name_acquired_future:

a location for the name acquired future

out_name_lost_future:

a location for the name lost future

Return type:

(out_name_acquired_future: Dex.Future, out_name_lost_future: Dex.Future)

Wrapper for [func`Gio`.bus_own_name].

Asks the D-Bus broker to own the well-known name name on the connection connection.

out_name_acquired_future is a future that awaits owning the name and either resolves to true, or rejects with an error.

out_name_lost_future is a future that rejects when the name was lost.

If either future is canceled, the name will be unowned.

Added in version 1.1.

Dex.data_input_stream_read_line(stream, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a string containing the line (without the line terminator), or None if the end of the stream is reached.

Return type:

Dex.Future

Reads a line from the data input stream.

Wraps [method`Gio`.DataInputStream.read_line_async].

Added in version 1.1.

Dex.data_input_stream_read_line_utf8(stream, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a string containing the line (without the line terminator), or None if the end of the stream is reached.

Return type:

Dex.Future

Reads a UTF-8 line from the data input stream.

Wraps [method`Gio`.DataInputStream.read_line_async] with [method`Gio`.DataInputStream.read_line_finish_utf8].

Added in version 1.2.

Dex.data_input_stream_read_upto(stream, stop_chars, stop_chars_len, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a string containing the read data, not including the stop character, or None if the end of the stream is reached.

Return type:

Dex.Future

Reads data from the stream until one of stop_chars is found.

Wraps [method`Gio`.DataInputStream.read_upto_async].

Added in version 1.2.

Dex.dbus_connection_call(connection, bus_name, object_path, interface_name, method_name, parameters, reply_type, flags, timeout_msec)
Parameters:
  • connection (Gio.DBusConnection) – a [class`Gio`.DBusConnection]

  • bus_name (str or None) – a unique or well-known bus name or None if connection is not a message bus connection

  • object_path (str) – path of remote object

  • interface_name (str) – D-Bus interface to invoke method on

  • method_name (str) – the name of the method to invoke

  • parameters (GLib.Variant or None) – a [struct`GLib`.Variant] tuple with parameters for the method or None if not passing parameters

  • reply_type (GLib.VariantType or None) – the expected type of the reply (which will be a tuple), or None

  • flags (Gio.DBusCallFlags) – flags from the [flags`Gio`.DBusCallFlags] enumeration

  • timeout_msec (int) – the timeout in milliseconds, -1 to use the default timeout or GObject.G_MAXINT for no timeout

Returns:

a [class`Dex`.Future] that resolves to a [struct`GLib`.Variant] or rejects with error.

Return type:

Dex.Future

Wrapper for [method`Gio`.DBusConnection.call].

Added in version 0.4.

Dex.dbus_connection_call_with_unix_fd_list(connection, bus_name, object_path, interface_name, method_name, parameters, reply_type, flags, timeout_msec, fd_list)
Parameters:
  • connection (Gio.DBusConnection) – a [class`Gio`.DBusConnection]

  • bus_name (str or None) – a unique or well-known bus name or None if connection is not a message bus connection

  • object_path (str) – path of remote object

  • interface_name (str) – D-Bus interface to invoke method on

  • method_name (str) – the name of the method to invoke

  • parameters (GLib.Variant or None) – a [struct`GLib`.Variant] tuple with parameters for the method or None if not passing parameters

  • reply_type (GLib.VariantType or None) – the expected type of the reply (which will be a tuple), or None

  • flags (Gio.DBusCallFlags) – flags from the [flags`Gio`.DBusCallFlags] enumeration

  • timeout_msec (int) – the timeout in milliseconds, -1 to use the default timeout or GObject.G_MAXINT for no timeout

  • fd_list (Gio.UnixFDList or None) – a [class`Gio`.UnixFDList]

Returns:

a [class`Dex`.FutureSet] that resolves to a [struct`GLib`.Variant].

The [class`Dex`.Future] containing the resulting [class`Gio`.UnixFDList] can be retrieved with [method`Dex`.FutureSet.get_future_at] with an index of 1.

Return type:

Dex.Future

Wrapper for [method`Gio`.DBusConnection.call_with_unix_fd_list].

Added in version 0.4.

Dex.dbus_connection_close(connection)
Parameters:

connection (Gio.DBusConnection) – a [class`Gio`.DBusConnection]

Returns:

a [class`Dex`.Future] that resolves to true or rejects with error.

Return type:

Dex.Future

Asynchronously closes a connection.

Added in version 1.0.

Dex.dbus_connection_send_message_with_reply(connection, message, flags, timeout_msec)
Parameters:
Returns:

a [class`Dex`.Future] that will resolve to a [class`Gio`.DBusMessage] or reject with failure.

out_serial:

a location for the message serial number

Return type:

(Dex.Future, out_serial: int)

Wrapper for [method`Gio`.DBusConnection.send_message_with_reply].

Added in version 0.4.

Dex.dtls_connection_close(dtls_connection, io_priority)
Parameters:
  • dtls_connection (Gio.DtlsConnection) – a [iface`Gio`.DtlsConnection]

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.DtlsConnection.close_async].

Added in version 1.2.

Dex.dtls_connection_handshake(dtls_connection, io_priority)
Parameters:
  • dtls_connection (Gio.DtlsConnection) – a [iface`Gio`.DtlsConnection]

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.DtlsConnection.handshake_async].

Added in version 1.2.

Dex.dtls_connection_shutdown(dtls_connection, shutdown_read, shutdown_write, io_priority)
Parameters:
  • dtls_connection (Gio.DtlsConnection) – a [iface`Gio`.DtlsConnection]

  • shutdown_read (bool) – whether to shut down the read side

  • shutdown_write (bool) – whether to shut down the write side

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.DtlsConnection.shutdown_async].

Added in version 1.2.

Dex.error_quark()
Return type:

int

Dex.fd_watch(fd, events)
Parameters:
  • fd (int) – a file-descriptor

  • events (int) – the POLLOUT|POLLIN style bitmask to watch for

Returns:

a [class`Dex`.Future] that resolves to the revents value when events is satisfied.

Return type:

Dex.Future

Creates a new GLib.Source that will fire when events is satisfied.

This is primarily useful when integrating with legacy systems on a fiber.

Added in version 1.1.

Dex.file_append_to(file, flags, io_priority)
Parameters:
  • file (Gio.File) – a [iface`Gio`.File]

  • flags (Gio.FileCreateFlags) – flags for appending to the file

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.FileOutputStream] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.File.append_to_async] as a [class`Dex`.Future].

Added in version 1.2.

Dex.file_copy(source, destination, flags, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to true if successful otherwise rejects with error.

Return type:

Dex.Future

Asynchronously copies a file and returns a [class`Dex`.Future] which can be observed for the result.

Dex.file_copy_with_progress(source, destination, flags, io_priority, progress_callback, *progress_callback_data)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to True or rejects with error

Return type:

Dex.Future

Wraps [method`Gio`.File.copy_async] with progress callback support.

Added in version 1.2.

Dex.file_create(file, flags, io_priority)
Parameters:
  • file (Gio.File) – a [iface`Gio`.File]

  • flags (Gio.FileCreateFlags) – flags for creating the file

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.FileOutputStream] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.File.create] as a [class`Dex`.Future].

Added in version 1.1.

Dex.file_create_readwrite(file, flags, io_priority)
Parameters:
  • file (Gio.File) – a [iface`Gio`.File]

  • flags (Gio.FileCreateFlags) – flags for creating the file

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.FileIOStream] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.File.create_readwrite_async] as a [class`Dex`.Future].

Added in version 1.2.

Dex.file_delete(file, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to true or rejects with error.

Return type:

Dex.Future

Asynchronously deletes a file and returns a [class`Dex`.Future] which can be observed for the result.

Dex.file_enumerate_children(file, attributes, flags, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.FileEnumerator] or rejects with error.

Return type:

Dex.Future

Dex.file_enumerator_close(file_enumerator, io_priority)
Parameters:
  • file_enumerator (Gio.FileEnumerator) – a [class`Gio`.FileEnumerator]

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.FileEnumerator.close_async].

Added in version 1.2.

Dex.file_enumerator_next_files(file_enumerator, num_files, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [struct`GLib`.List] of [class`Gio`.FileInfo]

Return type:

Dex.Future

Wraps [method`Gio`.FileEnumerator.next_files_async].

Use [method`Dex`.Future.await_boxed] to await for the result of this function.

When on a fiber, you can do:

``c g_autolist(GFileInfo) infos = dex_await_boxed (dex_file_enumerator_next_files (enumerator, 100, 0), &error); ``

Dex.file_find_enclosing_mount(file, io_priority)
Parameters:
  • file (Gio.File) – a [iface`Gio`.File]

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to a [iface`Gio`.Mount] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.File.find_enclosing_mount_async].

Added in version 1.2.

Dex.file_input_stream_query_info(stream, attributes, io_priority)
Parameters:
  • stream (Gio.FileInputStream) – a [class`Gio`.FileInputStream]

  • attributes (str) – file attributes to query

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.FileInfo] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.FileInputStream.query_info_async].

Added in version 1.2.

Dex.file_io_stream_query_info(stream, attributes, io_priority)
Parameters:
  • stream (Gio.FileIOStream) – a [class`Gio`.FileIOStream]

  • attributes (str) – file attributes to query

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.FileInfo] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.FileIOStream.query_info_async].

Added in version 1.2.

Dex.file_load_bytes(file)
Parameters:

file (Gio.File) – a [iface`Gio`.File]

Returns:

a [class`Dex`.Future] that resolves to a [struct`GLib`.Bytes] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.File.load_bytes_async].

Added in version 1.2.

Dex.file_load_contents_bytes(file)
Parameters:

file (Gio.File) – a [iface`Gio`.File]

Returns:

a [class`Dex`.Future] that resolves to a [struct`GLib`.Bytes].

Return type:

Dex.Future

Dex.file_load_partial_contents_bytes(file, read_more_callback, *read_more_callback_data)
Parameters:
  • file (Gio.File) – a [iface`Gio`.File]

  • read_more_callback (Gio.FileReadMoreCallback or None) – callback to determine if more bytes should be loaded

  • read_more_callback_data (object or None) – user data for read_more_callback

Returns:

a [class`Dex`.Future] that resolves to a [struct`GLib`.Bytes] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.File.load_partial_contents_async].

Added in version 1.2.

Dex.file_make_directory(file, io_priority)
Parameters:
Returns:

a [class`Dex`.Future]

Return type:

Dex.Future

Asynchronously creates a directory and returns [class`Dex`.Future] which can be observed for the result.

Dex.file_make_directory_with_parents(file)
Parameters:

file (Gio.File) – a [iface`Gio`.File]

Returns:

a [class`Dex`.Future] that resolves to a boolean or rejects with error.

Return type:

Dex.Future

Creates a directory at file.

If file already exists and is a directory, then the future will resolve to True.

Added in version 1.0.

Parameters:
  • file (Gio.File) – a [iface`Gio`.File]

  • symlink_value (str) – the path for the target of the symbolic link

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.File.make_symbolic_link_async].

Added in version 1.2.

Dex.file_move(source, destination, flags, io_priority, progress_callback, *progress_callback_data)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to True or rejects with error

Return type:

Dex.Future

Dex.file_new_tmp_dir(tmpl, io_priority)
Parameters:
  • tmpl (str or None) – template for the directory name, or None

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to a [iface`Gio`.File] or rejects with error.

Return type:

Dex.Future

Wraps [func`Gio`.File.new_tmp_dir_async] as a [class`Dex`.Future].

Added in version 1.2.

Dex.file_open_readwrite(file, io_priority)
Parameters:
  • file (Gio.File) – a [iface`Gio`.File]

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.FileIOStream] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.File.open_readwrite_async] as a [class`Dex`.Future].

Added in version 1.2.

Dex.file_output_stream_query_info(stream, attributes, io_priority)
Parameters:
  • stream (Gio.FileOutputStream) – a [class`Gio`.FileOutputStream]

  • attributes (str) – file attributes to query

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.FileInfo] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.FileOutputStream.query_info_async].

Added in version 1.2.

Dex.file_query_default_handler(file, io_priority)
Parameters:
  • file (Gio.File) – a [iface`Gio`.File]

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to a [iface`Gio`.AppInfo] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.File.query_default_handler_async].

Added in version 1.2.

Dex.file_query_exists(file)
Parameters:

file (Gio.File) – a [iface`Gio`.File]

Returns:

a [class`Dex`.Future] that will resolve with True if the file exists, otherwise reject with error.

Return type:

Dex.Future

Queries to see if file exists asynchronously.

Added in version 0.6.

Dex.file_query_file_type(file, flags, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [enum`Gio`.FileType].

Return type:

Dex.Future

Dex.file_query_filesystem_info(file, attributes, io_priority)
Parameters:
  • file (Gio.File) – a [iface`Gio`.File]

  • attributes (str) – an attribute query string

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.FileInfo] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.File.query_filesystem_info_async].

Added in version 1.2.

Dex.file_query_info(file, attributes, flags, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.FileInfo] or rejects with error.

Return type:

Dex.Future

Dex.file_read(file, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.FileInputStream].

Return type:

Dex.Future

Asynchronously opens a file for reading.

Dex.file_replace(file, etag, make_backup, flags, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.FileInputStream].

Return type:

Dex.Future

Opens a stream that will replace file on disk when the input stream is closed.

Dex.file_replace_contents(file, contents, etag, make_backup, flags)
Parameters:
  • file (Gio.File) – a [iface`Gio`.File]

  • contents (bytes) – the contents to write

  • etag (str or None) – the etag or None

  • make_backup (bool) – if a backup file should be created

  • flags (Gio.FileCreateFlags) – a set of [flags`Gio`.FileCreateFlags]

Returns:

a [class`Dex`.Future] which resolves to the new etag, or None if no etag is available.

Return type:

Dex.Future

Wraps [method`Gio`.File.replace_contents_async].

This function copies contents into a [struct`GLib`.Bytes] so the caller does not need to keep the buffer alive for the duration of the operation.

Added in version 1.2.

Dex.file_replace_contents_bytes(file, contents, etag, make_backup, flags)
Parameters:
Returns:

a [class`Dex`.Future] which resolves to the new etag. Therefore, it is possible to be None without an error having occurred.

Return type:

Dex.Future

Wraps [method`Gio`.File.replace_contents_bytes_async]

Dex.file_replace_readwrite(file, etag, make_backup, flags, io_priority)
Parameters:
  • file (Gio.File) – a [iface`Gio`.File]

  • etag (str or None) – the etag or None

  • make_backup (bool) – if a backup file should be created

  • flags (Gio.FileCreateFlags) – flags for replacing the file

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.FileIOStream] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.File.replace_readwrite_async] as a [class`Dex`.Future].

Added in version 1.2.

Dex.file_set_attributes(file, file_info, flags, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.FileInfo] or rejects with error.

Return type:

Dex.Future

Added in version 1.0.

Dex.file_set_display_name(file, display_name, io_priority)
Parameters:
  • file (Gio.File) – a [iface`Gio`.File]

  • display_name (str) – a new display name

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to the renamed [iface`Gio`.File] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.File.set_display_name_async].

Added in version 1.2.

Dex.file_trash(file, io_priority)
Parameters:
  • file (Gio.File) – a [iface`Gio`.File]

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.File.trash_async].

Added in version 1.2.

Dex.find_program_in_path(program)
Parameters:

program (str) – the name of the executable such as “grep”

Returns:

a [class`Dex`.Future] that resolves to a string containing the path or rejects with error.

Return type:

Dex.Future

Locates the first executable named program in the user’s path.

This runs [func`GLib`.find_program_in_path] on a dedicated thread.

Added in version 1.1.

Dex.get_major_version()
Return type:

int

Gets the major version number equivalent to DEX_MAJOR_VERSION at compile time of libdex.

Added in version 1.1.

Dex.get_micro_version()
Return type:

int

Gets the micro version number equivalent to DEX_MICRO_VERSION at compile time of libdex.

Added in version 1.1.

Dex.get_min_stack_size()
Return type:

int

Dex.get_minor_version()
Return type:

int

Gets the minor version number equivalent to DEX_MINOR_VERSION at compile time of libdex.

Added in version 1.1.

Dex.get_page_size()
Return type:

int

Dex.init()
Dex.input_stream_close(self, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to true if successful or rejects with error.

Return type:

Dex.Future

Dex.input_stream_read(self, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that reads counts bytes into buffer

Return type:

(Dex.Future, buffer: bytes)

Reads count bytes from an input stream into a pre-allocated buffer. The buffer must stay valid for the lifetime of this future.

Dex.input_stream_read_bytes(stream, count, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [struct`GLib`.Bytes].

Return type:

Dex.Future

Reads count bytes from the stream.

Dex.input_stream_skip(self, count, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to the number of bytes skipped as a gint64.

Return type:

Dex.Future

Dex.io_stream_close(io_stream, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to true or rejects with error.

Return type:

Dex.Future

Dex.io_stream_splice(stream1, stream2, flags, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.IOStream.splice_async].

Added in version 1.2.

Dex.mkdir_with_parents(path, mode)
Parameters:
  • path (str) – a path to a directory to create

  • mode (int) – the mode for the directory such as 0750

Returns:

a [class`Dex`.Future] that resolves to 0 if successful, otherwise rejects with error.

Return type:

Dex.Future

Similar to [func`GLib`.mkdir_with_parents] but runs on a dedicated thread.

Added in version 1.1.

Dex.network_monitor_can_reach(monitor, connectable)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.NetworkMonitor.can_reach_async].

Added in version 1.2.

Dex.output_stream_close(self, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to true or rejects with error.

Return type:

Dex.Future

Dex.output_stream_flush(self, io_priority)
Parameters:
  • self (Gio.OutputStream) – a [class`Gio`.OutputStream]

  • io_priority (int) – priority for the IO operation

Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.OutputStream.flush_async].

Added in version 1.2.

Dex.output_stream_splice(output, input, flags, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to the number of bytes spliced as a gint64 or rejects with error.

Return type:

Dex.Future

Dex.output_stream_write(self, buffer, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to the number of bytes written as a gint64

Return type:

Dex.Future

Dex.output_stream_write_bytes(stream, bytes, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a gint64.

Return type:

Dex.Future

Writes bytes to stream.

This function takes a reference to bytes and may be released after calling this function.

Dex.output_stream_writev_all(stream, vectors, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a guint64 containing the number of bytes written, or rejects with error.

Return type:

Dex.Future

Writes all bytes in vectors to stream.

This function copies the vectors array before starting the operation, but the buffers referenced by the vectors must remain valid until the returned future completes.

Wraps [method`Gio`.OutputStream.writev_all_async].

Added in version 1.2.

Dex.param_spec_object(name, nick, blurb, object_type, flags)
Parameters:
  • name (str) – canonical name of the property specified

  • nick (str or None) – nick name for the property specified

  • blurb (str or None) – description of the property specified

  • object_type (GObject.GType) – a DEX_TYPE_OBJECT derived type for this property

  • flags (GObject.ParamFlags) – flags for the property specified

Returns:

a newly created parameter specification

Return type:

GObject.ParamSpec

Creates a new [class`GObject`.ParamSpec] instance specifying a DEX_TYPE_OBJECT derived property.

This is similar to [func`GObject`.param_spec_object], but for DexObject instances such as [class`Dex`.Future].

Added in version 1.2.

Dex.permission_acquire(permission)
Parameters:

permission (Gio.Permission) – a [class`Gio`.Permission]

Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.Permission.acquire_async].

Added in version 1.2.

Dex.permission_release(permission)
Parameters:

permission (Gio.Permission) – a [class`Gio`.Permission]

Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.Permission.release_async].

Added in version 1.2.

Dex.proxy_connect(proxy, connection, proxy_address)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.IOStream] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.Proxy.connect_async].

Added in version 1.2.

Dex.proxy_resolver_lookup(resolver, uri)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a string vector of proxy URIs or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.ProxyResolver.lookup_async].

Added in version 1.2.

Dex.resolver_lookup_by_address(resolver, address)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a hostname string or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.Resolver.lookup_by_address_async].

Added in version 1.2.

Dex.resolver_lookup_by_name(resolver, address)
Parameters:
  • resolver (Gio.Resolver) – a [class`Gio`.Resolver]

  • address (str) – the address to look up

Returns:

a [class`Dex`.Future] that resolves to a [struct`GLib`.List] of [class`Gio`.InetAddress].

Return type:

Dex.Future

Dex.resolver_lookup_by_name_with_flags(resolver, address, flags)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [struct`GLib`.List] of [class`Gio`.InetAddress] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.Resolver.lookup_by_name_with_flags_async].

Added in version 1.2.

Dex.resolver_lookup_records(resolver, rrname, record_type)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [struct`GLib`.List] of [struct`GLib`.Variant] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.Resolver.lookup_records_async].

Added in version 1.2.

Dex.resolver_lookup_service(resolver, service, protocol, domain)
Parameters:
  • resolver (Gio.Resolver) – a [class`Gio`.Resolver]

  • service (str) – service name

  • protocol (str) – protocol name

  • domain (str) – domain name

Returns:

a [class`Dex`.Future] that resolves to a [struct`GLib`.List] of [struct`Gio`.SrvTarget] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.Resolver.lookup_service_async].

Added in version 1.2.

Dex.socket_address_enumerator_next(enumerator)
Parameters:

enumerator (Gio.SocketAddressEnumerator) – a [class`Gio`.SocketAddressEnumerator]

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.SocketAddress], None at the end of the enumeration, or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.SocketAddressEnumerator.next_async].

Added in version 1.2.

Dex.socket_client_connect(socket_client, socket_connectable)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.SocketConnection] or rejects with error.

Return type:

Dex.Future

Dex.socket_client_connect_to_host(socket_client, host_and_port, default_port)
Parameters:
  • socket_client (Gio.SocketClient) – a [class`Gio`.SocketClient]

  • host_and_port (str) – host and optional port to connect to

  • default_port (int) – default port to use

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.SocketConnection] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.SocketClient.connect_to_host_async].

Added in version 1.2.

Dex.socket_client_connect_to_service(socket_client, domain, service)
Parameters:
  • socket_client (Gio.SocketClient) – a [class`Gio`.SocketClient]

  • domain (str) – domain to connect to

  • service (str) – service to connect to

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.SocketConnection] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.SocketClient.connect_to_service_async].

Added in version 1.2.

Dex.socket_client_connect_to_uri(socket_client, uri, default_port)
Parameters:
  • socket_client (Gio.SocketClient) – a [class`Gio`.SocketClient]

  • uri (str) – URI to connect to

  • default_port (int) – default port to use

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.SocketConnection] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.SocketClient.connect_to_uri_async].

Added in version 1.2.

Dex.socket_connection_connect(connection, address)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.SocketConnection.connect_async].

Added in version 1.2.

Dex.socket_listener_accept(listener)
Parameters:

listener (Gio.SocketListener) – a [class`Gio`.SocketListener]

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.SocketConnection] or rejects with error.

Return type:

Dex.Future

Dex.socket_wait(socket, condition)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [flags`GLib`.IOCondition].

Return type:

Dex.Future

Creates a [class`Dex`.Future] that resolves when socket satisfies condition.

The future resolves to the [flags`GLib`.IOCondition] reported by the socket source. This may include additional conditions such as GObject.IOCondition.HUP or GObject.IOCondition.ERR.

Added in version 1.2.

Dex.subprocess_wait(subprocess)
Parameters:

subprocess (Gio.Subprocess) – a [class`Gio`.Subprocess]

Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.Subprocess.wait_async].

Added in version 1.2.

Dex.subprocess_wait_check(subprocess)
Parameters:

subprocess (Gio.Subprocess) – a [class`Gio`.Subprocess]

Returns:

a [class`Dex`.Future] that will resolve when subprocess exits cleanly or reject upon signal or non-successful exit.

Return type:

Dex.Future

Creates a future that awaits for subprocess to complete using [method`Gio`.Subprocess.wait_check_async].

Added in version 0.4.

Dex.test_add_func(testpath, test_func)
Parameters:
  • testpath (str) – test case path

  • test_func (GLib.TestFunc) – test function to execute from a fiber

Adds a test function like GLib.test_add_func(), but runs test_func from a [class`Dex`.Fiber]. The calling thread is given a thread-default [class`Dex`.Scheduler] if it does not already have one, allowing tests to use Dex.Future.await_() and related APIs directly.

After test_func completes, the scheduler’s main context is iterated until no immediately pending sources remain.

Dex.thread_spawn(thread_name, thread_func, *user_data)
Parameters:
  • thread_name (str or None) – the name for the thread

  • thread_func (Dex.ThreadFunc) – the function to call on a thread

  • user_data (object or None) – closure data for thread_func

Returns:

a [class`Dex`.Future] that resolves or rejects the value or error returned from thread_func as a [class`Dex`.Future].

Return type:

Dex.Future

Spawns a new thread named thread_name running thread_func with user_data passed to it.

thread_func must return a [class`Dex`.Future].

If this function is called from a thread that is not running a [class`Dex`.Scheduler] then the default scheduler will be used to call user_data_destroy.

If the resulting [class`Dex`.Future] has not resolved or rejected, then the same scheduler used to call user_data_destroy will be used to propagate the result to the caller.

Added in version 1.0.

Dex.thread_wait_for(future)
Parameters:

future (Dex.Future) – a [class`Dex`.Future]

Raises:

GLib.Error

Returns:

True if future resolved, otherwise False and error is set to the rejection.

Return type:

bool

Use this when running on a thread spawned with dex_thread_spawn() and you need to block the thread until future has resolved or rejected.

Added in version 1.0.

Dex.tls_connection_handshake(tls_connection, io_priority)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to true or rejects with error.

Return type:

Dex.Future

Added in version 1.2.

Dex.tls_database_lookup_certificate_for_handle(database, handle, interaction, flags)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.TlsCertificate] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.TlsDatabase.lookup_certificate_for_handle_async].

Added in version 1.2.

Dex.tls_database_lookup_certificate_issuer(database, certificate, interaction, flags)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.TlsCertificate] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.TlsDatabase.lookup_certificate_issuer_async].

Added in version 1.2.

Dex.tls_database_lookup_certificates_issued_by(database, issuer_raw_dn, interaction, flags)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [struct`GLib`.List] of [class`Gio`.TlsCertificate] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.TlsDatabase.lookup_certificates_issued_by_async].

Added in version 1.2.

Dex.tls_database_verify_chain(database, chain, purpose, identity, interaction, flags)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to [flags`Gio`.TlsCertificateFlags] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.TlsDatabase.verify_chain_async].

Added in version 1.2.

Dex.tls_interaction_ask_password(interaction, password)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [enum`Gio`.TlsInteractionResult] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.TlsInteraction.ask_password_async].

Added in version 1.2.

Dex.tls_interaction_request_certificate(interaction, connection, flags)
Parameters:
Returns:

a [class`Dex`.Future] that resolves to a [enum`Gio`.TlsInteractionResult] or rejects with error.

Return type:

Dex.Future

Wraps [method`Gio`.TlsInteraction.request_certificate_async].

Added in version 1.2.

Dex.unix_connection_receive_credentials(connection)
Parameters:

connection (Gio.UnixConnection) – a [class`Gio`.UnixConnection]

Returns:

a [class`Dex`.Future] that resolves to a [class`Gio`.Credentials] or rejects with error.

Return type:

Dex.Future

Wraps g_unix_connection_receive_credentials_async().

Added in version 1.2.

Dex.unix_connection_send_credentials(connection)
Parameters:

connection (Gio.UnixConnection) – a [class`Gio`.UnixConnection]

Returns:

a [class`Dex`.Future] that resolves to True or rejects with error.

Return type:

Dex.Future

Wraps g_unix_connection_send_credentials_async().

Added in version 1.2.

Parameters:

path (str) – the path to unlink

Returns:

a [class`Dex`.Future] that resolves to an int of 0 on success or rejects with error.

Return type:

Dex.Future

This runs [func`GLib`.unlink] on a dedicated thread.

Added in version 1.1.

Dex.value_dup_object(value)
Parameters:

value (GObject.Value) – a GValue initialized with type DEX_TYPE_OBJECT

Returns:

a DexObject

Return type:

Dex.Object or None

Retrieves the DexObject stored inside the given value.

Added in version 1.0.

Dex.value_get_object(value)
Parameters:

value (GObject.Value) – a GValue initialized with type DEX_TYPE_OBJECT

Returns:

a DexObject

Return type:

Dex.Object or None

Retrieves the DexObject stored inside the given value.

Added in version 0.4.

Dex.value_set_object(value, object)
Parameters:

Stores the given DexObject inside value.

The [struct`GObject`.Value] will acquire a reference to the object.

Added in version 0.4.

Dex.value_take_object(value, object)
Parameters:
  • value (GObject.Value) – a [struct`GObject`.Value] initialized with type DEX_TYPE_OBJECT

  • object (Dex.Object or None) – a DexObject

Stores the given DexObject inside value.

This function transfers the ownership of the object to the GValue.

Added in version 0.4.