## GnomePassword

GnomePassword

## Synopsis

    #include <libgnomeui/libgnomeui.h>

                        GnomePasswordDialog;
                        GnomePasswordDialogDetails;
    enum                GnomePasswordDialogRemember;
    gboolean            gnome_password_dialog_anon_selected (GnomePasswordDialog *password_dialog);
    char *              gnome_password_dialog_get_domain    (GnomePasswordDialog *password_dialog);
    char *              gnome_password_dialog_get_password  (GnomePasswordDialog *password_dialog);
    char *              gnome_password_dialog_get_new_password
                                                            (GnomePasswordDialog *password_dialog);
    GnomePasswordDialogRemember  gnome_password_dialog_get_remember
                                                            (GnomePasswordDialog *password_dialog);
    char *              gnome_password_dialog_get_username  (GnomePasswordDialog *password_dialog);
    GtkWidget*          gnome_password_dialog_new           (const char *dialog_title,
                                                             const char *message,
                                                             const char *username,
                                                             const char *password,
                                                             gboolean readonly_username);
    gboolean            gnome_password_dialog_run_and_block (GnomePasswordDialog *password_dialog);
    void                gnome_password_dialog_set_domain    (GnomePasswordDialog *password_dialog,
                                                             const char *domain);
    void                gnome_password_dialog_set_password  (GnomePasswordDialog *password_dialog,
                                                             const char *password);
    void                gnome_password_dialog_set_readonly_domain
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean readonly);
    void                gnome_password_dialog_set_readonly_username
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean readonly);
    void                gnome_password_dialog_set_remember  (GnomePasswordDialog *password_dialog,
                                                             GnomePasswordDialogRemember remember);
    void                gnome_password_dialog_set_show_domain
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean show);
    void                gnome_password_dialog_set_show_password
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean show);
    void                gnome_password_dialog_set_show_new_password
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean show);
    void                gnome_password_dialog_set_show_new_password_quality
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean show);
    void                gnome_password_dialog_set_show_remember
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean show_remember);
    void                gnome_password_dialog_set_show_username
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean show);
    void                gnome_password_dialog_set_show_userpass_buttons
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean show_userpass_buttons);
    void                gnome_password_dialog_set_username  (GnomePasswordDialog *password_dialog,
                                                             const char *username);
    void                gnome_password_dialog_set_password_quality_func
                                                            (GnomePasswordDialog *password_dialog,
                                                             GnomePasswordDialogQualityFunc func,
                                                             gpointer data,
                                                             GDestroyNotify dnotify);

## Description

## Details

### GnomePasswordDialog

    typedef struct {
    	GtkDialog gtk_dialog;

    	GnomePasswordDialogDetails *details;
    } GnomePasswordDialog;

### GnomePasswordDialogDetails

    typedef struct _GnomePasswordDialogDetails GnomePasswordDialogDetails;

### enum GnomePasswordDialogRemember

    typedef enum {
    	GNOME_PASSWORD_DIALOG_REMEMBER_NOTHING,
    	GNOME_PASSWORD_DIALOG_REMEMBER_SESSION,
    	GNOME_PASSWORD_DIALOG_REMEMBER_FOREVER
    } GnomePasswordDialogRemember;

### gnome_password_dialog_anon_selected ()

    gboolean            gnome_password_dialog_anon_selected (GnomePasswordDialog *password_dialog);

Checks whether anonymous support is set to TRUE and the radio button for connecting as anonymous user is active.

`password_dialog` : | A GnomePasswordDialog
Returns : | TRUE if anonymous support is set and the radio button is active, FALSE otherwise.

### gnome_password_dialog_get_domain ()

    char *              gnome_password_dialog_get_domain    (GnomePasswordDialog *password_dialog);

Gets the domain name from the password dialog.

`password_dialog` : | A GnomePasswordDialog
Returns : | The domain name, a char*.

Since 2.4

### gnome_password_dialog_get_password ()

    char *              gnome_password_dialog_get_password  (GnomePasswordDialog *password_dialog);

Gets the password from the password dialog.

`password_dialog` : | A GnomePasswordDialog
Returns : | The password, a char*.

Since 2.4

### gnome_password_dialog_get_new_password ()

    char *              gnome_password_dialog_get_new_password
                                                            (GnomePasswordDialog *password_dialog);

Gets the new password from the password dialog.

`password_dialog` : | A GnomePasswordDialog
Returns : | The password, or `NULL` if the entries in the new password field and the confirmation field don't match.

Since 2.18

### gnome_password_dialog_get_remember ()

    GnomePasswordDialogRemember  gnome_password_dialog_get_remember
                                                            (GnomePasswordDialog *password_dialog);

Gets the state of the check buttons to remember password for the session and save password to keyring.

`password_dialog` : | A GnomePasswordDialog
Returns : | a GnomePasswordDialogRemember, which indicates whether to remember the password for the session or forever.

Since 2.6

### gnome_password_dialog_get_username ()

    char *              gnome_password_dialog_get_username  (GnomePasswordDialog *password_dialog);

Gets the username from the password dialog.

`password_dialog` : | A GnomePasswordDialog
Returns : | The username, a char*.

Since 2.4

### gnome_password_dialog_new ()

    GtkWidget*          gnome_password_dialog_new           (const char *dialog_title,
                                                             const char *message,
                                                             const char *username,
                                                             const char *password,
                                                             gboolean readonly_username);

Creates a new password dialog with an optional title, message, username, password etc. The user will be given the option to save the password for this session only or store it permanently in her keyring.

`dialog_title` : | The title of the dialog
`message` : | Message text for the dialog
`username` : | The username to be used in the dialog
`password` : | Password to be used
`readonly_username` : | Boolean value that controls whether the user can edit the username or not
Returns : | A new password dialog.

Since 2.4

### gnome_password_dialog_run_and_block ()

    gboolean            gnome_password_dialog_run_and_block (GnomePasswordDialog *password_dialog);

Gets the user input from PasswordDialog.

`password_dialog` : | A GnomePasswordDialog
Returns : | `TRUE` if "Connect" button is pressed. `FALSE` if "Cancel" button is pressed.

Since 2.4

### gnome_password_dialog_set_domain ()

    void                gnome_password_dialog_set_domain    (GnomePasswordDialog *password_dialog,
                                                             const char *domain);

Sets the domain field in the password dialog to `domain`.

`password_dialog` : | A GnomePasswordDialog
`domain` : | The domain that should be set

Since 2.4

### gnome_password_dialog_set_password ()

    void                gnome_password_dialog_set_password  (GnomePasswordDialog *password_dialog,
                                                             const char *password);

Sets the password in the password dialog.

`password_dialog` : | A GnomePasswordDialog
`password` : | The password that should be set

Since 2.4

### gnome_password_dialog_set_readonly_domain ()

    void                gnome_password_dialog_set_readonly_domain
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean readonly);

Sets the editable nature of the domain field in the password dialog based on the boolean value `readonly`.

`password_dialog` : | A GnomePasswordDialog
`readonly` : | Boolean value that controls whether the user can edit the domain or not

Since 2.6

### gnome_password_dialog_set_readonly_username ()

    void                gnome_password_dialog_set_readonly_username
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean readonly);

Sets the editable nature of the username field in the password dialog based on the boolean value `readonly`.

`password_dialog` : | A GnomePasswordDialog
`readonly` : | Boolean value that controls whether the user can edit the username or not

Since 2.4

### gnome_password_dialog_set_remember ()

    void                gnome_password_dialog_set_remember  (GnomePasswordDialog *password_dialog,
                                                             GnomePasswordDialogRemember remember);

Based on the value of GnomePasswordDialogRemember, sets the state of the check buttons to remember password for the session and save password to keyring .

`password_dialog` : | A GnomePasswordDialog.
`remember` : | A GnomePasswordDialogRemember.

Since 2.6

### gnome_password_dialog_set_show_domain ()

    void                gnome_password_dialog_set_show_domain
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean show);

Shows or hides the domain field in the password dialog based on the value of `show`.

`password_dialog` : | A GnomePasswordDialog
`show` : | Boolean value that controls whether the domain entry has to appear or not.

Since 2.6

### gnome_password_dialog_set_show_password ()

    void                gnome_password_dialog_set_show_password
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean show);

Shows or hides the password field in the password dialog based on the value of `show`.

`password_dialog` : | A GnomePasswordDialog
`show` : | Boolean value that controls whether the password entry has to appear or not.

Since 2.6

### gnome_password_dialog_set_show_new_password ()

    void                gnome_password_dialog_set_show_new_password
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean show);

Shows or hides the new password and new password confirmation fields based on the value of `show`.

`password_dialog` : | A GnomePasswordDialog
`show` : | Boolean value that controls whether the new password entry has to appear or not.

Since 2.18

### gnome_password_dialog_set_show_new_password_quality ()

    void                gnome_password_dialog_set_show_new_password_quality
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean show);

Shows or hides the new password quality meter.

`password_dialog` : | A GnomePasswordDialog
`show` : | Boolean value that controls whether the new password quality meter will appear or not.

Since 2.18

### gnome_password_dialog_set_show_remember ()

    void                gnome_password_dialog_set_show_remember
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean show_remember);

Shows or hides the check buttons to save password in keyring and remember password for session based on the value of `show_remember`.

`password_dialog` : | A GnomePasswordDialog
`show_remember` : | Boolean value that controls whether the check buttons for password retention should appear or not.

Since 2.6

### gnome_password_dialog_set_show_username ()

    void                gnome_password_dialog_set_show_username
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean show);

Shows or hides the username entry in the password dialog based on the value of `show`.

`password_dialog` : | A GnomePasswordDialog
`show` : | Boolean value that controls whether the username entry has to appear or not.

Since 2.6

### gnome_password_dialog_set_show_userpass_buttons ()

    void                gnome_password_dialog_set_show_userpass_buttons
                                                            (GnomePasswordDialog *password_dialog,
                                                             gboolean show_userpass_buttons);

Shows the radio buttons for connecting anonymously and connecting as user if `show_userpass_buttons` is TRUE. Also makes the 'Username' and 'Password' fields greyed out if the radio button for connecting anonymously is active. If `show_userpass_buttons` is FALSE, then these radio buttons are hidden and the 'Username' and 'Password' fields will be made active.

`password_dialog` : | A GnomePasswordDialog
`show_userpass_buttons` : | Boolean value that controls whether the radio buttons for connecting anonymously and connecting as user should be shown or not.

Since 2.8

### gnome_password_dialog_set_username ()

    void                gnome_password_dialog_set_username  (GnomePasswordDialog *password_dialog,
                                                             const char *username);

Sets the username in the password dialog.

`password_dialog` : | A GnomePasswordDialog
`username` : | The username that should be set

Since 2.4

### gnome_password_dialog_set_password_quality_func ()

    void                gnome_password_dialog_set_password_quality_func
                                                            (GnomePasswordDialog *password_dialog,
                                                             GnomePasswordDialogQualityFunc func,
                                                             gpointer data,
                                                             GDestroyNotify dnotify);

Sets the function which measures the quality of the new password as it's typed.

`password_dialog` : | A GnomePasswordDialog
`func` : | the new GnomePasswordDialogQualityFunc
`data` : | user data to pass to the quality func
`dnotify` : |

Since 2.18