SecretPrompt: Libsecret Library Reference Manual

## SecretPrompt SecretPrompt — a prompt in the Service |

## Functions

void | secret_prompt_perform ()
GVariant * | secret_prompt_perform_finish ()
GVariant * | secret_prompt_perform_sync ()
GVariant * | secret_prompt_run ()

## Types and Values

struct | SecretPrompt
struct | SecretPromptClass

## Object Hierarchy

        GObject
        ╰── GDBusProxy
            ╰── SecretPrompt

## Implemented Interfaces

SecretPrompt implements GDBusInterface, GInitable and GAsyncInitable.

## Includes

    #include <libsecret/secret.h>

## Description

A SecretPrompt represents a prompt in the Secret Service.

Certain actions on the Secret Service require user prompting to complete, such as creating a collection, or unlocking a collection. When such a prompt is necessary, then a SecretPrompt object is created by this library, and passed to the `secret_service_prompt()` method. In this way it is handled automatically.

In order to customize prompt handling, override the SecretServiceClass::prompt_async and SecretServiceClass::prompt_finish virtual methods of the SecretService class.

## Functions

### secret_prompt_perform ()

    void
    secret_prompt_perform (SecretPrompt *self,
                           const gchar *window_id,
                           const GVariantType *return_type,
                           GCancellable *cancellable,
                           GAsyncReadyCallback callback,
                           gpointer user_data);

Runs a prompt and performs the prompting. Returns `TRUE` if the prompt was completed and not dismissed.

If `window_id` is non-null then it is used as an XWindow id on Linux. The API expects this id to be converted to a string using the ``d`` printf format. The Secret Service can make its prompt transient for the window with this id. In some Secret Service implementations this is not possible, so the behavior depending on this should degrade gracefully.

This method will return immediately and complete asynchronously.

#### Parameters

self | a prompt |
window_id | string form of XWindow id for parent window to be transient for. | [allow-none]
return_type | the variant type of the prompt result |
cancellable | optional cancellation object |
callback | called when the operation completes |
user_data | data to be passed to the callback |

### secret_prompt_perform_finish ()

    GVariant *
    secret_prompt_perform_finish (SecretPrompt *self,
                                  GAsyncResult *result,
                                  GError **error);

Complete asynchronous operation to run a prompt and perform the prompting.

Returns a variant result if the prompt was completed and not dismissed. The type of result depends on the action the prompt is completing, and is defined in the Secret Service DBus API specification.

#### Parameters

self | a prompt |
result | the asynchronous result passed to the callback |
error | location to place an error on failure |

#### Returns

`NULL` if the prompt was dismissed or an error occurred, a variant result if the prompt was successful.

[transfer full]

### secret_prompt_perform_sync ()

    GVariant *
    secret_prompt_perform_sync (SecretPrompt *self,
                                const gchar *window_id,
                                GCancellable *cancellable,
                                const GVariantType *return_type,
                                GError **error);

Runs a prompt and performs the prompting. Returns a variant result if the prompt was completed and not dismissed. The type of result depends on the action the prompt is completing, and is defined in the Secret Service DBus API specification.

If `window_id` is non-null then it is used as an XWindow id on Linux. The API expects this id to be converted to a string using the ``d`` printf format. The Secret Service can make its prompt transient for the window with this id. In some Secret Service implementations this is not possible, so the behavior depending on this should degrade gracefully.

This method may block indefinitely and should not be used in user interface threads.

#### Parameters

self | a prompt |
window_id | string form of XWindow id for parent window to be transient for. | [allow-none]
cancellable | optional cancellation object |
return_type | the variant type of the prompt result |
error | location to place an error on failure |

#### Returns

`NULL` if the prompt was dismissed or an error occurred.

[transfer full]

### secret_prompt_run ()

    GVariant *
    secret_prompt_run (SecretPrompt *self,
                       const gchar *window_id,
                       GCancellable *cancellable,
                       const GVariantType *return_type,
                       GError **error);

Runs a prompt and performs the prompting. Returns a variant result if the prompt was completed and not dismissed. The type of result depends on the action the prompt is completing, and is defined in the Secret Service DBus API specification.

If `window_id` is non-null then it is used as an XWindow id on Linux. The API expects this id to be converted to a string using the ``d`` printf format. The Secret Service can make its prompt transient for the window with this id. In some Secret Service implementations this is not possible, so the behavior depending on this should degrade gracefully.

This runs the dialog in a recursive mainloop. When run from a user interface thread, this means the user interface will remain responsive. Care should be taken that appropriate user interface actions are disabled while running the prompt.

#### Parameters

self | a prompt |
window_id | string form of XWindow id for parent window to be transient for. | [allow-none]
cancellable | optional cancellation object |
return_type | the variant type of the prompt result |
error | location to place an error on failure |

#### Returns

`NULL` if the prompt was dismissed or an error occurred.

[transfer full]

## Types and Values

### struct SecretPrompt

    struct SecretPrompt;

A proxy object representing a prompt that the Secret Service will display to the user.

### struct SecretPromptClass

    struct SecretPromptClass {
    	GDBusProxyClass parent_class;
    };

The class for SecretPrompt.

#### Members

GDBusProxyClass `parent_class`; | the parent class |