MatePassword

## MatePassword MatePassword |

## Synopsis

    #include <libmateui/libmateui.h>

    struct              MatePasswordDialog;
                        MatePasswordDialogDetails;
    enum                MatePasswordDialogRemember;
    gboolean            mate_password_dialog_anon_selected (MatePasswordDialog *password_dialog);
    char *              mate_password_dialog_get_domain    (MatePasswordDialog *password_dialog);
    char *              mate_password_dialog_get_password  (MatePasswordDialog *password_dialog);
    char *              mate_password_dialog_get_new_password
                                                            (MatePasswordDialog *password_dialog);
    MatePasswordDialogRemember  mate_password_dialog_get_remember
                                                            (MatePasswordDialog *password_dialog);
    char *              mate_password_dialog_get_username  (MatePasswordDialog *password_dialog);
    GtkWidget *         mate_password_dialog_new           (const char *dialog_title,
                                                             const char *message,
                                                             const char *username,
                                                             const char *password,
                                                             gboolean readonly_username);
    gboolean            mate_password_dialog_run_and_block (MatePasswordDialog *password_dialog);
    void                mate_password_dialog_set_domain    (MatePasswordDialog *password_dialog,
                                                             const char *domain);
    void                mate_password_dialog_set_password  (MatePasswordDialog *password_dialog,
                                                             const char *password);
    void                mate_password_dialog_set_readonly_domain
                                                            (MatePasswordDialog *password_dialog,
                                                             gboolean readonly);
    void                mate_password_dialog_set_readonly_username
                                                            (MatePasswordDialog *password_dialog,
                                                             gboolean readonly);
    void                mate_password_dialog_set_remember  (MatePasswordDialog *password_dialog,
                                                             MatePasswordDialogRemember remember);
    void                mate_password_dialog_set_show_domain
                                                            (MatePasswordDialog *password_dialog,
                                                             gboolean show);
    void                mate_password_dialog_set_show_password
                                                            (MatePasswordDialog *password_dialog,
                                                             gboolean show);
    void                mate_password_dialog_set_show_new_password
                                                            (MatePasswordDialog *password_dialog,
                                                             gboolean show);
    void                mate_password_dialog_set_show_new_password_quality
                                                            (MatePasswordDialog *password_dialog,
                                                             gboolean show);
    void                mate_password_dialog_set_show_remember
                                                            (MatePasswordDialog *password_dialog,
                                                             gboolean show_remember);
    void                mate_password_dialog_set_show_username
                                                            (MatePasswordDialog *password_dialog,
                                                             gboolean show);
    void                mate_password_dialog_set_show_userpass_buttons
                                                            (MatePasswordDialog *password_dialog,
                                                             gboolean show_userpass_buttons);
    void                mate_password_dialog_set_username  (MatePasswordDialog *password_dialog,
                                                             const char *username);
    void                mate_password_dialog_set_password_quality_func
                                                            (MatePasswordDialog *password_dialog,
                                                             MatePasswordDialogQualityFunc func,
                                                             gpointer data,
                                                             GDestroyNotify dnotify);

## Description

## Details

### struct MatePasswordDialog

    struct MatePasswordDialog {
    	GtkDialog gtk_dialog;

    	MatePasswordDialogDetails *details;
    };

### MatePasswordDialogDetails

    typedef struct _MatePasswordDialogDetails MatePasswordDialogDetails;

### enum MatePasswordDialogRemember

    typedef enum {
    	MATE_PASSWORD_DIALOG_REMEMBER_NOTHING,
    	MATE_PASSWORD_DIALOG_REMEMBER_SESSION,
    	MATE_PASSWORD_DIALOG_REMEMBER_FOREVER
    } MatePasswordDialogRemember;

### mate_password_dialog_anon_selected ()

    gboolean            mate_password_dialog_anon_selected (MatePasswordDialog *password_dialog);

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

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

### mate_password_dialog_get_domain ()

    char *              mate_password_dialog_get_domain    (MatePasswordDialog *password_dialog);

Gets the domain name from the password dialog.

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

Since 2.4

### mate_password_dialog_get_password ()

    char *              mate_password_dialog_get_password  (MatePasswordDialog *password_dialog);

Gets the password from the password dialog.

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

Since 2.4

### mate_password_dialog_get_new_password ()

    char *              mate_password_dialog_get_new_password
                                                            (MatePasswordDialog *password_dialog);

Gets the new password from the password dialog.

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

Since 2.18

### mate_password_dialog_get_remember ()

    MatePasswordDialogRemember  mate_password_dialog_get_remember
                                                            (MatePasswordDialog *password_dialog);

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

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

Since 2.6

### mate_password_dialog_get_username ()

    char *              mate_password_dialog_get_username  (MatePasswordDialog *password_dialog);

Gets the username from the password dialog.

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

Since 2.4

### mate_password_dialog_new ()

    GtkWidget *         mate_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

### mate_password_dialog_run_and_block ()

    gboolean            mate_password_dialog_run_and_block (MatePasswordDialog *password_dialog);

Gets the user input from PasswordDialog.

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

Since 2.4

### mate_password_dialog_set_domain ()

    void                mate_password_dialog_set_domain    (MatePasswordDialog *password_dialog,
                                                             const char *domain);

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

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

Since 2.4

### mate_password_dialog_set_password ()

    void                mate_password_dialog_set_password  (MatePasswordDialog *password_dialog,
                                                             const char *password);

Sets the password in the password dialog.

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

Since 2.4

### mate_password_dialog_set_readonly_domain ()

    void                mate_password_dialog_set_readonly_domain
                                                            (MatePasswordDialog *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 MatePasswordDialog
`readonly` : | Boolean value that controls whether the user can edit the domain or not

Since 2.6

### mate_password_dialog_set_readonly_username ()

    void                mate_password_dialog_set_readonly_username
                                                            (MatePasswordDialog *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 MatePasswordDialog
`readonly` : | Boolean value that controls whether the user can edit the username or not

Since 2.4

### mate_password_dialog_set_remember ()

    void                mate_password_dialog_set_remember  (MatePasswordDialog *password_dialog,
                                                             MatePasswordDialogRemember remember);

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

`password_dialog` : | A MatePasswordDialog.
`remember` : | A MatePasswordDialogRemember.

Since 2.6

### mate_password_dialog_set_show_domain ()

    void                mate_password_dialog_set_show_domain
                                                            (MatePasswordDialog *password_dialog,
                                                             gboolean show);

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

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

Since 2.6

### mate_password_dialog_set_show_password ()

    void                mate_password_dialog_set_show_password
                                                            (MatePasswordDialog *password_dialog,
                                                             gboolean show);

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

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

Since 2.6

### mate_password_dialog_set_show_new_password ()

    void                mate_password_dialog_set_show_new_password
                                                            (MatePasswordDialog *password_dialog,
                                                             gboolean show);

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

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

Since 2.18

### mate_password_dialog_set_show_new_password_quality ()

    void                mate_password_dialog_set_show_new_password_quality
                                                            (MatePasswordDialog *password_dialog,
                                                             gboolean show);

Shows or hides the new password quality meter.

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

Since 2.18

### mate_password_dialog_set_show_remember ()

    void                mate_password_dialog_set_show_remember
                                                            (MatePasswordDialog *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 MatePasswordDialog
`show_remember` : | Boolean value that controls whether the check buttons for password retention should appear or not.

Since 2.6

### mate_password_dialog_set_show_username ()

    void                mate_password_dialog_set_show_username
                                                            (MatePasswordDialog *password_dialog,
                                                             gboolean show);

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

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

Since 2.6

### mate_password_dialog_set_show_userpass_buttons ()

    void                mate_password_dialog_set_show_userpass_buttons
                                                            (MatePasswordDialog *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 MatePasswordDialog
`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

### mate_password_dialog_set_username ()

    void                mate_password_dialog_set_username  (MatePasswordDialog *password_dialog,
                                                             const char *username);

Sets the username in the password dialog.

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

Since 2.4

### mate_password_dialog_set_password_quality_func ()

    void                mate_password_dialog_set_password_quality_func
                                                            (MatePasswordDialog *password_dialog,
                                                             MatePasswordDialogQualityFunc func,
                                                             gpointer data,
                                                             GDestroyNotify dnotify);

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

`password_dialog` : | A MatePasswordDialog
`func` : | the new MatePasswordDialogQualityFunc
`data` : | user data to pass to the quality func
`dnotify` : |

Since 2.18