awaitPortalResponse

suspend fun <T> awaitPortalResponse(connection: DBusConnection, methodName: String, call: () -> DBusPath, parseSuccess: (Map<String, Variant<*>>) -> T): Result<T>(source)

Awaits a portal response signal after making a D-Bus request.

This utility encapsulates the common pattern of:

  1. Setting up a signal handler for Request.Response

  2. Making the D-Bus call

  3. Waiting for the response signal

  4. Parsing the result or returning a failure

Return

Result.success with the parsed result, or Result.failure on error or cancellation.

Parameters

connection

The D-Bus connection to use for signal handling.

methodName

The name of the portal method being called (for error messages).

call

A lambda that makes the D-Bus call and returns the request handle path.

parseSuccess

A lambda that parses the signal results on success.

Type Parameters

T

The type of the successful result.