![]() |
![]() |
![]() |
Gcr Library Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Prerequisites | Known Implementations | Properties | Signals |
GcrPrompt; struct GcrPromptIface; enum GcrPromptReply; const gchar * gcr_prompt_password (GcrPrompt *prompt
,GCancellable *cancellable
,GError **error
); void gcr_prompt_password_async (GcrPrompt *prompt
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); const gchar * gcr_prompt_password_finish (GcrPrompt *prompt
,GAsyncResult *result
,GError **error
); const gchar * gcr_prompt_password_run (GcrPrompt *prompt
,GCancellable *cancellable
,GError **error
); GcrPromptReply gcr_prompt_confirm (GcrPrompt *prompt
,GCancellable *cancellable
,GError **error
); void gcr_prompt_confirm_async (GcrPrompt *prompt
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
); GcrPromptReply gcr_prompt_confirm_finish (GcrPrompt *prompt
,GAsyncResult *result
,GError **error
); GcrPromptReply gcr_prompt_confirm_run (GcrPrompt *prompt
,GCancellable *cancellable
,GError **error
); void gcr_prompt_reset (GcrPrompt *prompt
); void gcr_prompt_close (GcrPrompt *prompt
); gchar * gcr_prompt_get_title (GcrPrompt *prompt
); void gcr_prompt_set_title (GcrPrompt *prompt
,const gchar *title
); gchar * gcr_prompt_get_message (GcrPrompt *prompt
); void gcr_prompt_set_message (GcrPrompt *prompt
,const gchar *message
); gchar * gcr_prompt_get_description (GcrPrompt *prompt
); void gcr_prompt_set_description (GcrPrompt *prompt
,const gchar *description
); gchar * gcr_prompt_get_warning (GcrPrompt *prompt
); void gcr_prompt_set_warning (GcrPrompt *prompt
,const gchar *warning
); gchar * gcr_prompt_get_continue_label (GcrPrompt *prompt
); void gcr_prompt_set_continue_label (GcrPrompt *prompt
,const gchar *continue_label
); gchar * gcr_prompt_get_cancel_label (GcrPrompt *prompt
); void gcr_prompt_set_cancel_label (GcrPrompt *prompt
,const gchar *cancel_label
); gchar * gcr_prompt_get_choice_label (GcrPrompt *prompt
); void gcr_prompt_set_choice_label (GcrPrompt *prompt
,const gchar *choice_label
); gboolean gcr_prompt_get_choice_chosen (GcrPrompt *prompt
); void gcr_prompt_set_choice_chosen (GcrPrompt *prompt
,gboolean chosen
); gboolean gcr_prompt_get_password_new (GcrPrompt *prompt
); void gcr_prompt_set_password_new (GcrPrompt *prompt
,gboolean new_password
); gint gcr_prompt_get_password_strength (GcrPrompt *prompt
); gchar * gcr_prompt_get_caller_window (GcrPrompt *prompt
); void gcr_prompt_set_caller_window (GcrPrompt *prompt
,const gchar *window_id
);
"caller-window" gchar* : Read / Write / Construct "cancel-label" gchar* : Read / Write / Construct "choice-chosen" gboolean : Read / Write "choice-label" gchar* : Read / Write / Construct "continue-label" gchar* : Read / Write / Construct "description" gchar* : Read / Write / Construct "message" gchar* : Read / Write / Construct "password-new" gboolean : Read / Write "password-strength" gint : Read "title" gchar* : Read / Write / Construct "warning" gchar* : Read / Write / Construct
A GcrPrompt represents a prompt displayed to the user. It is an interface with various implementations.
Various properties are set on the prompt, and then the prompt is displayed
the various prompt methods like gcr_prompt_password_run()
.
A GcrPrompt may be used to display multiple related prompts. Most implemantions do not hide the window between display of multiple related prompts, and the GcrPrompt must be closed or destroyed in order to make it go away. This allows the user to see that the prompts are related.
Use GcrPromptDialog to create an in-process GTK+ dialog prompt. Use GcrSystemPrompt to create a system prompt in a prompter process.
The prompt implementation will always display the GcrPrompt:message property, but may choose not to display the GcrPrompt:description or GcrPrompt:title properties.
struct GcrPromptIface { GTypeInterface parent_iface; void (* prompt_password_async) (GcrPrompt *prompt, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); const gchar * (* prompt_password_finish) (GcrPrompt *prompt, GAsyncResult *result, GError **error); void (* prompt_confirm_async) (GcrPrompt *prompt, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); GcrPromptReply (* prompt_confirm_finish) (GcrPrompt *prompt, GAsyncResult *result, GError **error); void (* prompt_close) (GcrPrompt *prompt); };
The interface for implementing GcrPrompt.
GTypeInterface |
parent interface |
begin a password prompt | |
complete a password prompt | |
begin a confirm prompt | |
complete a confirm prompt | |
close a prompt |
typedef enum { GCR_PROMPT_REPLY_CANCEL = 0, GCR_PROMPT_REPLY_CONTINUE = 1, } GcrPromptReply;
Various replies returned by gcr_prompt_confirm()
and friends.
const gchar * gcr_prompt_password (GcrPrompt *prompt
,GCancellable *cancellable
,GError **error
);
Prompts for password. Set the various properties on the prompt before calling this method to explain which password should be entered.
This method will block until the a response is returned from the prompter.
A password will be returned if the user enters a password successfully. The returned password is valid until the next time a method is called to display another prompt.
NULL
will be returned if the user cancels or if an error occurs. Check the
error
argument to tell the difference.
|
a prompt |
|
optional cancellation object |
|
location to place error on failure |
Returns : |
the password owned by the prompt, or NULL
|
void gcr_prompt_password_async (GcrPrompt *prompt
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Prompts for password. Set the various properties on the prompt before calling this method to explain which password should be entered.
This method will return immediately and complete asynchronously.
|
a prompt |
|
optional cancellation object |
|
called when the operation completes |
|
data to pass to the callback |
const gchar * gcr_prompt_password_finish (GcrPrompt *prompt
,GAsyncResult *result
,GError **error
);
Complete an operation to prompt for a password.
A password will be returned if the user enters a password successfully. The returned password is valid until the next time a method is called to display another prompt.
NULL
will be returned if the user cancels or if an error occurs. Check the
error
argument to tell the difference.
|
a prompt |
|
asynchronous result passed to callback |
|
location to place error on failure |
Returns : |
the password owned by the prompt, or NULL
|
const gchar * gcr_prompt_password_run (GcrPrompt *prompt
,GCancellable *cancellable
,GError **error
);
Prompts for password. Set the various properties on the prompt before calling this method to explain which password should be entered.
This method will block until the a response is returned from the prompter
and will run a main loop similar to a gtk_dialog_run()
. The application
will remain responsive but care must be taken to handle reentrancy issues.
A password will be returned if the user enters a password successfully. The returned password is valid until the next time a method is called to display another prompt.
NULL
will be returned if the user cancels or if an error occurs. Check the
error
argument to tell the difference.
|
a prompt |
|
optional cancellation object |
|
location to place error on failure |
Returns : |
the password owned by the prompt, or NULL
|
GcrPromptReply gcr_prompt_confirm (GcrPrompt *prompt
,GCancellable *cancellable
,GError **error
);
Prompts for confirmation asking a cancel/continue style question. Set the various properties on the prompt before calling this function to represent the question correctly.
This method will block until the a response is returned from the prompter.
GCR_PROMPT_REPLY_OK
will be returned if the user confirms the prompt. The
return value will also be GCR_PROMPT_REPLY_CANCEL
if the user cancels or if
an error occurs. Check the error
argument to tell the difference.
|
a prompt |
|
optional cancellation object |
|
location to place error on failure |
Returns : |
the reply from the prompt |
void gcr_prompt_confirm_async (GcrPrompt *prompt
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Prompts for confirmation asking a cancel/continue style question. Set the various properties on the prompt before calling this method to represent the question correctly.
This method will return immediately and complete asynchronously.
|
a prompt |
|
optional cancellation object |
|
called when the operation completes |
|
data to pass to the callback |
GcrPromptReply gcr_prompt_confirm_finish (GcrPrompt *prompt
,GAsyncResult *result
,GError **error
);
Complete an operation to prompt for confirmation.
GCR_PROMPT_REPLY_OK
will be returned if the user confirms the prompt. The
return value will also be GCR_PROMPT_REPLY_CANCEL
if the user cancels or if
an error occurs. Check the error
argument to tell the difference.
|
a prompt |
|
asynchronous result passed to callback |
|
location to place error on failure |
Returns : |
the reply from the prompt |
GcrPromptReply gcr_prompt_confirm_run (GcrPrompt *prompt
,GCancellable *cancellable
,GError **error
);
Prompts for confirmation asking a cancel/continue style question. Set the various properties on the prompt before calling this function to represent the question correctly.
This method will block until the a response is returned from the prompter
and will run a main loop similar to a gtk_dialog_run()
. The application
will remain responsive but care must be taken to handle reentrancy issues.
GCR_PROMPT_REPLY_OK
will be returned if the user confirms the prompt. The
return value will also be GCR_PROMPT_REPLY_CANCEL
if the user cancels or if
an error occurs. Check the error
argument to tell the difference.
|
a prompt |
|
optional cancellation object |
|
location to place error on failure |
Returns : |
the reply from the prompt |
void gcr_prompt_close (GcrPrompt *prompt
);
Closes the prompt so that in can no longer be used to prompt. The various prompt methods will return results as if the user dismissed the prompt.
The prompt may also be closed by the implementor of the GcrPrompt object.
This emits the GcrPrompt::prompt-close signal on the prompt object.
|
a prompt |
gchar * gcr_prompt_get_title (GcrPrompt *prompt
);
Gets the title of the prompt.
A prompt implementation may choose not to display the prompt title. The prompt message should contain relevant information.
|
the prompt |
Returns : |
a newly allocated string containing the prompt title. [transfer full] |
void gcr_prompt_set_title (GcrPrompt *prompt
,const gchar *title
);
Sets the title of the prompt.
A prompt implementation may choose not to display the prompt title. The prompt message should contain relevant information.
|
the prompt |
|
the prompt title |
gchar * gcr_prompt_get_message (GcrPrompt *prompt
);
Gets the prompt message for the user.
A prompt implementation should always display this message.
|
the prompt |
Returns : |
a newly allocated string containing the detailed description of the prompt. [transfer full] |
void gcr_prompt_set_message (GcrPrompt *prompt
,const gchar *message
);
Sets the prompt message for the user.
A prompt implementation should always display this message.
|
the prompt |
|
the prompt message |
gchar * gcr_prompt_get_description (GcrPrompt *prompt
);
Get the detailed description of the prompt.
A prompt implementation may choose not to display this detailed description. The prompt message should contain relevant information.
|
the prompt |
Returns : |
a newly allocated string containing the detailed description of the prompt. [transfer full] |
void gcr_prompt_set_description (GcrPrompt *prompt
,const gchar *description
);
Set the detailed description of the prompt.
A prompt implementation may choose not to display this detailed description.
Use gcr_prompt_set_message()
to set a general message containing relevant
information.
|
the prompt |
|
the detailed description |
gchar * gcr_prompt_get_warning (GcrPrompt *prompt
);
Get a prompt warning displayed on the prompt.
This is a warning like "The password is incorrect." usually displayed to the user about a previous 'unsuccessful' prompt.
If this string is NULL
then no warning is displayed.
|
the prompt |
Returns : |
a newly allocated string containing the prompt
warning, or NULL if no warning. [transfer full]
|
void gcr_prompt_set_warning (GcrPrompt *prompt
,const gchar *warning
);
Set a prompt warning displayed on the prompt.
This is a warning like "The password is incorrect." usually displayed to the user about a previous 'unsuccessful' prompt.
If this string is NULL
then no warning is displayed.
|
the prompt |
|
the warning or NULL . [allow-none]
|
gchar * gcr_prompt_get_continue_label (GcrPrompt *prompt
);
Get the label for the continue button.
This is the button that results in a GCR_PROMPT_REPLY_CONTINUE
reply
from the prompt.
|
the prompt |
Returns : |
a newly allocated string containing the label. [transfer full] |
void gcr_prompt_set_continue_label (GcrPrompt *prompt
,const gchar *continue_label
);
Set the label for the continue button.
This is the button that results in a GCR_PROMPT_REPLY_CONTINUE
reply
from the prompt.
|
the prompt |
|
the label |
gchar * gcr_prompt_get_cancel_label (GcrPrompt *prompt
);
Get the label for the cancel button.
This is the button that results in a GCR_PROMPT_REPLY_CANCEL
reply
from the prompt.
|
the prompt |
Returns : |
a newly allocated string containing the label. [transfer full] |
void gcr_prompt_set_cancel_label (GcrPrompt *prompt
,const gchar *cancel_label
);
Set the label for the continue button.
This is the button that results in a GCR_PROMPT_REPLY_CANCEL
reply
from the prompt.
|
the prompt |
|
the label |
gchar * gcr_prompt_get_choice_label (GcrPrompt *prompt
);
Get the label for the additional choice.
This will be NULL
if no additional choice is being displayed.
|
the prompt |
Returns : |
a newly allocated string containing the additional
choice or NULL . [transfer full]
|
void gcr_prompt_set_choice_label (GcrPrompt *prompt
,const gchar *choice_label
);
Set the label for the additional choice.
If this is a non-NULL
value then an additional boolean choice will be
displayed by the prompt allowing the user to select or deselect it.
The initial value of the choice can be set with the
gcr_prompt_set_choice_label()
method.
If this is NULL
, then no additional choice is being displayed.
|
the prompt |
|
the additional choice or NULL . [allow-none]
|
gboolean gcr_prompt_get_choice_chosen (GcrPrompt *prompt
);
Get whether the additional choice was chosen or not.
The additional choice would have been setup using
gcr_prompt_set_choice_label()
.
|
the prompt |
Returns : |
whether chosen |
void gcr_prompt_set_choice_chosen (GcrPrompt *prompt
,gboolean chosen
);
Set whether the additional choice is chosen or not.
The additional choice should be set up using gcr_prompt_set_choice_label()
.
|
the prompt |
|
whether chosen |
gboolean gcr_prompt_get_password_new (GcrPrompt *prompt
);
Get whether the prompt will prompt for a new password.
This will cause the prompt implementation to ask the user to confirm the password and/or display other relevant user interface for creating a new password.
|
the prompt |
Returns : |
whether in new password mode or not |
void gcr_prompt_set_password_new (GcrPrompt *prompt
,gboolean new_password
);
Set whether the prompt will prompt for a new password.
This will cause the prompt implementation to ask the user to confirm the password and/or display other relevant user interface for creating a new password.
|
the prompt |
|
whether in new password mode or not |
gint gcr_prompt_get_password_strength (GcrPrompt *prompt
);
Get indication of the password strength.
Prompts will return a zero value if the password is empty, and a value greater than zero if the password has any characters.
This is only valid after a successful prompt for a password.
|
the prompt |
Returns : |
zero if the password is empty, greater than zero if not |
gchar * gcr_prompt_get_caller_window (GcrPrompt *prompt
);
Get the string handle of the caller's window.
The caller window indicates to the prompt which window is prompting the user. The prompt may choose to ignore this information or use it in whatever way it sees fit.
|
the prompt |
Returns : |
a newly allocated string containing the string handle of the window. [transfer full] |
void gcr_prompt_set_caller_window (GcrPrompt *prompt
,const gchar *window_id
);
Set the string handle of the caller's window.
The caller window indicates to the prompt which window is prompting the user. The prompt may choose to ignore this information or use it in whatever way it sees fit.
|
the prompt |
|
the window id |
"caller-window"
property"caller-window" gchar* : Read / Write / Construct
The string handle of the caller's window.
The caller window indicates to the prompt which window is prompting the user. The prompt may choose to ignore this information or use it in whatever way it sees fit.
Default value: NULL
"cancel-label"
property"cancel-label" gchar* : Read / Write / Construct
The label for the cancel button in the prompt.
Default value: "Cancel"
"choice-chosen"
property"choice-chosen" gboolean : Read / Write
Whether the additional choice is chosen or not.
The additional choice would have been setup using "choice-label".
Default value: FALSE
"choice-label"
property"choice-label" gchar* : Read / Write / Construct
The label for the additional choice.
If this is a non-NULL
value then an additional boolean choice will be
displayed by the prompt allowing the user to select or deselect it.
If NULL
, then no additional choice is displayed.
The initial value of the choice can be set with "choice-chosen".
Default value: NULL
"continue-label"
property"continue-label" gchar* : Read / Write / Construct
The label for the continue button in the prompt.
Default value: "Continue"
"description"
property"description" gchar* : Read / Write / Construct
The detailed description of the prompt.
A prompt implementation may choose not to display this detailed description. The prompt message should contain relevant information.
Default value: NULL
"message"
property"message" gchar* : Read / Write / Construct
The prompt message for the user.
A prompt implementation should always display this message.
Default value: NULL
"password-new"
property"password-new" gboolean : Read / Write
Whether the prompt will prompt for a new password.
This will cause the prompt implementation to ask the user to confirm the password and/or display other relevant user interface for creating a new password.
Default value: FALSE
"password-strength"
property"password-strength" gint : Read
Indication of the password strength.
Prompts will return a zero value if the password is empty, and a value greater than zero if the password has any characters.
This is only valid after a successful prompt for a password.
Allowed values: >= 0
Default value: 0
"title"
property"title" gchar* : Read / Write / Construct
The title of the prompt.
A prompt implementation may choose not to display the prompt title. The "message" should contain relevant information.
Default value: NULL
"prompt-close"
signalvoid user_function (GcrPrompt *arg0,
gpointer user_data) : Run First
Action signal fired when the prompt is to be closed. After the default handler has run, the prompt is closed. The various prompting methods will return results as if the user dismissed the prompt.
You can use the gcr_prompt_close()
method to emit this signal.
|
user data set when the signal handler was connected. |