HildonGetPasswordDialog

HildonGetPasswordDialog — A widget used to get a password.

Synopsis




                    HildonGetPasswordDialog;
GtkWidget*          hildon_get_password_dialog_new      (GtkWindow *parent,
                                                         gboolean get_old);
GtkWidget*          hildon_get_password_dialog_new_with_default
                                                        (GtkWindow *parent,
                                                         const gchar *password,
                                                         gboolean get_old);
void                hildon_get_password_dialog_set_message
                                                        (HildonGetPasswordDialog *dialog,
                                                         const gchar *message);
void                hildon_get_password_dialog_set_caption
                                                        (HildonGetPasswordDialog *dialog,
                                                         const gchar *new_caption);
void                hildon_get_password_dialog_set_max_characters
                                                        (HildonGetPasswordDialog *dialog,
                                                         gint max_characters);
const gchar*        hildon_get_password_dialog_get_password
                                                        (HildonGetPasswordDialog *dialog);

Object Hierarchy


  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkBin
                                 +----GtkWindow
                                       +----GtkDialog
                                             +----HildonGetPasswordDialog

Implemented Interfaces

HildonGetPasswordDialog implements AtkImplementorIface and GtkBuildable.

Properties


  "caption-label"            gchararray            : Read / Write
  "get-old"                  gboolean              : Read / Write / Construct Only
  "max-characters"           gint                  : Read / Write
  "message"                  gchararray            : Read / Write
  "numbers-only"             gboolean              : Read / Write
  "password"                 gchararray            : Read / Write

Description

HildonGetPasswordDialog prompts the user for a password. It allows inputting password, with an optional configurable label eg. for showing a custom message. The maximum length of the password can be set.

Example 15. HildonGetPassword example

get_dialog =  HILDON_GET_PASSWORD_DIALOG (hildon_get_password_dialog_new (parent, FALSE));

gtk_widget_show (GTK_WIDGET (get_dialog));

i = gtk_dialog_run (GTK_DIALOG (get_dialog));

pass = hildon_get_password_dialog_get_password (get_dialog);

if (i == GTK_RESPONSE_OK && (strcmp (pass, dialog.current_password) != 0))
{
     gtk_infoprint (GTK_WINDOW (parent), STR_PASSWORD_INCORRECT);
     gtk_widget_set_sensitive (GTK_WIDGET (dialog.button2), FALSE);
     gtk_widget_set_sensitive (GTK_WIDGET (dialog.button3), FALSE);
     gtk_widget_set_sensitive (GTK_WIDGET (dialog.button4), FALSE);
}

else if (i == GTK_RESPONSE_OK)
{   
     gtk_widget_set_sensitive( GTK_WIDGET( dialog.button2 ), TRUE);
}

else
{
     gtk_widget_set_sensitive (GTK_WIDGET (dialog.button2), FALSE);
     gtk_widget_set_sensitive (GTK_WIDGET (dialog.button3), FALSE);
     gtk_widget_set_sensitive (GTK_WIDGET (dialog.button4), FALSE);
}
gtk_widget_destroy (GTK_WIDGET (get_dialog));
}


Details

HildonGetPasswordDialog

typedef struct _HildonGetPasswordDialog HildonGetPasswordDialog;


hildon_get_password_dialog_new ()

GtkWidget*          hildon_get_password_dialog_new      (GtkWindow *parent,
                                                         gboolean get_old);

Construct a new HildonGetPasswordDialog.

parent :

parent window; can be NULL

get_old :

FALSE creates a new get password dialog and TRUE creates a new get old password dialog. That is, if the password to be obtained is the old password, this parameter is specified TRUE.

Returns :

a new GtkWidget of type HildonGetPasswordDialog

hildon_get_password_dialog_new_with_default ()

GtkWidget*          hildon_get_password_dialog_new_with_default
                                                        (GtkWindow *parent,
                                                         const gchar *password,
                                                         gboolean get_old);

Same as hildon_get_password_dialog_new but with a default password in password field.

parent :

parent window; can be NULL

password :

a default password to be shown in password field

get_old :

FALSE creates a new get password dialog and TRUE creates a new get old password dialog. That is, if the password to be obtained is the old password, this parameter is specified TRUE.

Returns :

a new GtkWidget of type HildonGetPasswordDialog

hildon_get_password_dialog_set_message ()

void                hildon_get_password_dialog_set_message
                                                        (HildonGetPasswordDialog *dialog,
                                                         const gchar *message);

Sets the optional descriptive text displayed at the top of the dialog.

dialog :

the dialog

message :

a custom message or some other descriptive text to be set

hildon_get_password_dialog_set_caption ()

void                hildon_get_password_dialog_set_caption
                                                        (HildonGetPasswordDialog *dialog,
                                                         const gchar *new_caption);

Sets the password entry field's neigbouring label.

dialog :

the dialog

new_caption :

the text to be set as the caption label

hildon_get_password_dialog_set_max_characters ()

void                hildon_get_password_dialog_set_max_characters
                                                        (HildonGetPasswordDialog *dialog,
                                                         gint max_characters);

sets the maximum number of characters allowed as the password

dialog :

the dialog

max_characters :

the maximum number of characters the password dialog accepts

hildon_get_password_dialog_get_password ()

const gchar*        hildon_get_password_dialog_get_password
                                                        (HildonGetPasswordDialog *dialog);

Gets the currently entered password. The string should not be freed.

dialog :

pointer to HildonSetPasswordDialog

Returns :

current password entered by the user.

Property Details

The "caption-label" property

  "caption-label"            gchararray            : Read / Write

Caption label.

Default value: NULL


The "get-old" property

  "get-old"                  gboolean              : Read / Write / Construct Only

If the dialog is used to retrieve an old password or set a new one.

Default value: FALSE


The "max-characters" property

  "max-characters"           gint                  : Read / Write

Maximum characters than can be entered.

Default value: 0


The "message" property

  "message"                  gchararray            : Read / Write

Optional message displayed to the user.

Default value: NULL


The "numbers-only" property

  "numbers-only"             gboolean              : Read / Write

If the password entry field is operating in numbers-only mode.

Default value: FALSE


The "password" property

  "password"                 gchararray            : Read / Write

Password field contents.

Default value: "DEFAULT"

See Also

HildonSetPasswordDialog