Gcr.SystemPrompt

g GObject.GInterface GObject.GInterface Gcr.Prompt Gcr.Prompt GObject.GInterface->Gcr.Prompt Gio.AsyncInitable Gio.AsyncInitable GObject.GInterface->Gio.AsyncInitable Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable GObject.Object GObject.Object Gcr.SystemPrompt Gcr.SystemPrompt GObject.Object->Gcr.SystemPrompt Gcr.Prompt->Gcr.SystemPrompt Gio.AsyncInitable->Gcr.SystemPrompt Gio.Initable->Gcr.SystemPrompt

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gcr.Prompt (31), Gio.AsyncInitable (4), Gio.Initable (2)

Structs:

GObject.ObjectClass (5)

class

error_get_domain ()

class

open (timeout_seconds, cancellable)

class

open_async (timeout_seconds, cancellable, callback, *user_data)

class

open_finish (result)

class

open_for_prompter (prompter_name, timeout_seconds, cancellable)

class

open_for_prompter_async (prompter_name, timeout_seconds, cancellable, callback, *user_data)

close (cancellable)

close_async (cancellable, callback, *user_data)

close_finish (result)

get_secret_exchange ()

Virtual Methods

Inherited:

GObject.Object (7), Gcr.Prompt (5), Gio.AsyncInitable (2), Gio.Initable (1)

Properties

Inherited:

Gcr.Prompt (11)

Name

Type

Flags

Short Description

bus-name

str

r/w/co

Prompter bus name

secret-exchange

Gcr.SecretExchange

r/w

Secret exchange for passing passwords

timeout-seconds

int

w/co

Timeout (in seconds) for opening prompt

Signals

Inherited:

GObject.Object (1), Gcr.Prompt (1)

Fields

Inherited:

GObject.Object (1), Gcr.Prompt (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Gcr.SystemPrompt(**kwargs)
Bases:

GObject.Object, Gcr.Prompt, Gio.AsyncInitable, Gio.Initable

Abstract:

No

Structure:

Gcr.SystemPromptClass

A [iface`Prompt`] implementation which calls to the system prompter to display prompts in a system modal fashion.

Since the system prompter usually only displays one prompt at a time, you may have to wait for the prompt to be displayed. Use [func`SystemPrompt`.open] or a related function to open a prompt. Since this can take a long time, you should always check that the prompt is still needed after it is opened. A previous prompt may have already provided the information needed and you may no longer need to prompt.

Use [method`SystemPrompt`.close] to close the prompt when you’re done with it.

classmethod error_get_domain()[source]
Return type:

int

classmethod open(timeout_seconds, cancellable)[source]
Parameters:
  • timeout_seconds (int) – the number of seconds to wait to access the prompt, or -1

  • cancellable (Gio.Cancellable or None) – optional cancellation object

Raises:

GLib.Error

Returns:

the prompt, or None if prompt could not be opened

Return type:

Gcr.SystemPrompt

Opens a system prompt with the default prompter.

Most system prompters only allow showing one prompt at a time, and if another prompt is shown then this method will block for up to timeout_seconds seconds. If timeout_seconds is equal to -1, then this will block indefinitely until the prompt can be opened. If timeout_seconds expires, then this function will fail with a Gcr.SystemPromptError.SYSTEM_PROMPT_IN_PROGRESS error.

classmethod open_async(timeout_seconds, cancellable, callback, *user_data)[source]
Parameters:
  • timeout_seconds (int) – the number of seconds to wait to access the prompt, or -1

  • cancellable (Gio.Cancellable or None) – optional cancellation object

  • callback (Gio.AsyncReadyCallback or None) – called when the operation completes

  • user_data (object or None) – data to pass the callback

Asynchronously open a system prompt with the default system prompter.

Most system prompters only allow showing one prompt at a time, and if another prompt is shown then this method will block for up to timeout_seconds seconds. If timeout_seconds is equal to -1, then this will block indefinitely until the prompt can be opened. If timeout_seconds expires, then this operation will fail with a Gcr.SystemPromptError.SYSTEM_PROMPT_IN_PROGRESS error.

classmethod open_finish(result)[source]
Parameters:

result (Gio.AsyncResult) – the asynchronous result

Raises:

GLib.Error

Returns:

the prompt, or None if prompt could not be opened

Return type:

Gcr.SystemPrompt

Complete an operation to asynchronously open a system prompt.

classmethod open_for_prompter(prompter_name, timeout_seconds, cancellable)[source]
Parameters:
  • prompter_name (str or None) – the prompter dbus name

  • timeout_seconds (int) – the number of seconds to wait to access the prompt, or -1

  • cancellable (Gio.Cancellable or None) – optional cancellation object

Raises:

GLib.Error

Returns:

the prompt, or None if prompt could not be opened

Return type:

Gcr.SystemPrompt

Opens a system prompt. If prompter_name is None, then the default system prompter is used.

Most system prompters only allow showing one prompt at a time, and if another prompt is shown then this method will block for up to timeout_seconds seconds. If timeout_seconds is equal to -1, then this will block indefinitely until the prompt can be opened. If timeout_seconds expires, then this function will fail with a Gcr.SystemPromptError.SYSTEM_PROMPT_IN_PROGRESS error.

classmethod open_for_prompter_async(prompter_name, timeout_seconds, cancellable, callback, *user_data)[source]
Parameters:
  • prompter_name (str or None) – the prompter D-Bus name

  • timeout_seconds (int) – the number of seconds to wait to access the prompt, or -1

  • cancellable (Gio.Cancellable or None) – optional cancellation object

  • callback (Gio.AsyncReadyCallback or None) – called when the operation completes

  • user_data (object or None) – data to pass the callback

Opens a system prompt asynchronously. If prompter_name is None, then the default system prompter is used.

Most system prompters only allow showing one prompt at a time, and if another prompt is shown then this method will block for up to timeout_seconds seconds. If timeout_seconds is equal to -1, then this will block indefinitely until the prompt can be opened. If timeout_seconds expires, then this operation will fail with a Gcr.SystemPromptError.SYSTEM_PROMPT_IN_PROGRESS error.

close(cancellable)[source]
Parameters:

cancellable (Gio.Cancellable or None) – an optional cancellation object

Raises:

GLib.Error

Returns:

whether close was cleanly completed

Return type:

bool

Close this prompt. After calling this function, no further prompts will succeed on this object. The prompt object is not unreferenced by this function, and you must unreference it once done.

This call may block, use the Gcr.SystemPrompt.close_async() to perform this action indefinitely.

Whether or not this function returns True, the system prompt object is still closed and may not be further used.

close_async(cancellable, callback, *user_data)[source]
Parameters:

Close this prompt asynchronously. After calling this function, no further methods may be called on this object. The prompt object is not unreferenced by this function, and you must unreference it once done.

This call returns immediately and completes asynchronously.

close_finish(result)[source]
Parameters:

result (Gio.AsyncResult) – asynchronous operation result

Raises:

GLib.Error

Returns:

whether close was cleanly completed

Return type:

bool

Complete operation to close this prompt.

Whether or not this function returns True, the system prompt object is still closed and may not be further used.

get_secret_exchange()[source]
Returns:

the secret exchange

Return type:

Gcr.SecretExchange

Get the current [class`SecretExchange`] used to transfer secrets in this prompt.

Property Details

Gcr.SystemPrompt.props.bus_name
Name:

bus-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The DBus bus name of the prompter to use for prompting, or None for the default prompter.

Gcr.SystemPrompt.props.secret_exchange
Name:

secret-exchange

Type:

Gcr.SecretExchange

Default Value:

None

Flags:

READABLE, WRITABLE

The Gcr.SecretExchange to use when transferring passwords. A default secret exchange will be used if this is not set.

Gcr.SystemPrompt.props.timeout_seconds
Name:

timeout-seconds

Type:

int

Default Value:

-1

Flags:

WRITABLE, CONSTRUCT_ONLY

The timeout in seconds to wait when opening the prompt.