SecretPrompt

SecretPrompt — a prompt in the Service

Synopsis

#include <secret/secret-unstable.h>

                    SecretPrompt;
struct              SecretPromptClass;
GVariant *          secret_prompt_get_result_value      (SecretPrompt *self,
                                                         const GVariantType *expected_type);
void                secret_prompt_perform               (SecretPrompt *self,
                                                         gulong window_id,
                                                         GCancellable *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gboolean            secret_prompt_perform_finish        (SecretPrompt *self,
                                                         GAsyncResult *result,
                                                         GError **error);
gboolean            secret_prompt_perform_sync          (SecretPrompt *self,
                                                         gulong window_id,
                                                         GCancellable *cancellable,
                                                         GError **error);
gboolean            secret_prompt_run                   (SecretPrompt *self,
                                                         gulong window_id,
                                                         GCancellable *cancellable,
                                                         GError **error);

Object Hierarchy

  GObject
   +----GDBusProxy
         +----SecretPrompt

Implemented Interfaces

SecretPrompt implements GDBusInterface, GInitable and GAsyncInitable.

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.

stability: Unstable

Details

SecretPrompt

typedef struct _SecretPrompt 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.

GDBusProxyClass parent_class;

the parent class

secret_prompt_get_result_value ()

GVariant *          secret_prompt_get_result_value      (SecretPrompt *self,
                                                         const GVariantType *expected_type);

Get the result returned from a completed prompt.

After performing a prompt in the Secret Service API, the prompt can return a result value. The type of value returned is dependent on the prompt.

It is not normally necessary to call this function, as this is done automatically by other functions in this library.

self :

a prompt

expected_type :

expected variant type of the result. [allow-none]

Returns :

the result value which should be released with g_variant_unref() when done, or NULL if no result. [transfer full]

secret_prompt_perform ()

void                secret_prompt_perform               (SecretPrompt *self,
                                                         gulong window_id,
                                                         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-zero then it is used as an XWindow id. 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.

self :

a prompt

window_id :

XWindow id for parent window to be transient for

cancellable :

optional cancellation object

callback :

called when the operation completes

user_data :

data to be passed to the callback

secret_prompt_perform_finish ()

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

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

self :

a prompt

result :

the asynchronous result passed to the callback

error :

location to place an error on failure

Returns :

FALSE if the prompt was dismissed or an error occurred

secret_prompt_perform_sync ()

gboolean            secret_prompt_perform_sync          (SecretPrompt *self,
                                                         gulong window_id,
                                                         GCancellable *cancellable,
                                                         GError **error);

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

If window_id is non-zero then it is used as an XWindow id. 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.

self :

a prompt

window_id :

XWindow id for parent window to be transient for

cancellable :

optional cancellation object

error :

location to place an error on failure

Returns :

FALSE if the prompt was dismissed or an error occurred

secret_prompt_run ()

gboolean            secret_prompt_run                   (SecretPrompt *self,
                                                         gulong window_id,
                                                         GCancellable *cancellable,
                                                         GError **error);

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

If window_id is non-zero then it is used as an XWindow id. 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.

self :

a prompt

window_id :

XWindow id for parent window to be transient for

cancellable :

optional cancellation object

error :

location to place an error on failure

Returns :

FALSE if the prompt was dismissed or an error occurred