Class Prompt
- All Implemented Interfaces:
AsyncInitable, DBusInterface, Initable, Proxy
A prompt in the Service
A proxy object representing a prompt that the Secret Service will display to the user.
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 Service.prompt(Prompt, VariantType, Cancellable, AsyncReadyCallback) method. In this way it is handled
automatically.
In order to customize prompt handling, override the
Service.promptAsync(Prompt, VariantType, Cancellable, AsyncReadyCallback) and Service.promptFinish(AsyncResult) virtual
methods of the Service class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPrompt.Builder<B extends Prompt.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classThe class forSecretPrompt.Nested classes/interfaces inherited from class DBusProxy
DBusProxy.DBusProxyClass, DBusProxy.GPropertiesChangedCallback, DBusProxy.GSignalCallbackNested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface AsyncInitable
AsyncInitable.AsyncInitable$Impl, AsyncInitable.AsyncInitableIfaceNested classes/interfaces inherited from interface DBusInterface
DBusInterface.DBusInterface$Impl, DBusInterface.DBusInterfaceIfaceNested classes/interfaces inherited from interface Initable
Initable.Initable$Impl, Initable.InitableIface -
Constructor Summary
ConstructorsConstructorDescriptionPrompt()Create a new Prompt.Prompt(MemorySegment address) Create a Prompt instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected PromptasParent()Return this instance as if it were its parent type.static Prompt.Builder<? extends Prompt.Builder> builder()APrompt.Builderobject constructs aPromptwith the specified properties.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the Prompt class.voidperform(@Nullable String windowId, VariantType returnType, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Runs a prompt and performs the prompting.performFinish(AsyncResult result) Complete asynchronous operation to run a prompt and perform the prompting.performSync(@Nullable String windowId, @Nullable Cancellable cancellable, VariantType returnType) Runs a prompt and performs the prompting.run(@Nullable String windowId, @Nullable Cancellable cancellable, VariantType returnType) Runs a prompt and performs the prompting.Methods inherited from class DBusProxy
call, call, callFinish, callSync, callSync, callWithUnixFdList, callWithUnixFdList, callWithUnixFdListFinish, callWithUnixFdListSync, callWithUnixFdListSync, emitGPropertiesChanged, emitGSignal, finish, forBusFinish, forBusSync, forBusSync, getCachedProperty, getCachedPropertyNames, getConnection, getDefaultTimeout, getFlags, getInterfaceInfo, getInterfaceName, getName, getNameOwner, getObjectPath, gPropertiesChanged, gSignal, new_, new_, newForBus, newForBus, onGPropertiesChanged, onGSignal, setCachedProperty, setDefaultTimeout, setInterfaceInfo, sync, syncMethods inherited from class GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCodeMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AsyncInitable
initAsync, initFinishMethods inherited from interface DBusInterface
getInfo, getObject, setObject
-
Constructor Details
-
Prompt
Create a Prompt instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Prompt
public Prompt()Create a new Prompt.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
-
perform
public void perform(@Nullable String windowId, VariantType returnType, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Runs a prompt and performs the prompting.
Returns
trueif the prompt was completed and not dismissed.If
windowIdis 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%dprintf 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:
windowId- string form of XWindow id for parent window to be transient forreturnType- the variant type of the prompt resultcancellable- optional cancellation objectcallback- called when the operation completes
-
performFinish
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:
result- the asynchronous result passed to the callback- Returns:
nullif the prompt was dismissed or an error occurred, a variant result if the prompt was successful- Throws:
GErrorException- seeGError
-
performSync
public Variant performSync(@Nullable String windowId, @Nullable Cancellable cancellable, VariantType returnType) throws GErrorException 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
windowIdis 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%dprintf 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:
windowId- string form of XWindow id for parent window to be transient forcancellable- optional cancellation objectreturnType- the variant type of the prompt result- Returns:
nullif the prompt was dismissed or an error occurred- Throws:
GErrorException- seeGError
-
run
public Variant run(@Nullable String windowId, @Nullable Cancellable cancellable, VariantType returnType) throws GErrorException 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
windowIdis 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%dprintf 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:
windowId- string form of XWindow id for parent window to be transient forcancellable- optional cancellation objectreturnType- the variant type of the prompt result- Returns:
nullif the prompt was dismissed or an error occurred- Throws:
GErrorException- seeGError
-
builder
APrompt.Builderobject constructs aPromptwith the specified properties. Use the variousset...()methods to set properties, and finish construction withPrompt.Builder.build().- Returns:
- the builder object
-