1.145 <GtkPasswordEntry>

Class: <GtkPasswordEntry>

It derives from <GtkWidget>.

A single-line text entry widget for entering passwords and other secrets.

It does not show its contents in clear text, does not allow to copy it to the clipboard, and it shows a warning when Caps Lock is engaged. If the underlying platform allows it, <GtkPasswordEntry> will also place the text in a non-pageable memory area, to avoid it being written out to disk by the operating system.

Optionally, it can offer a way to reveal the contents in clear text.

<GtkPasswordEntry> provides only minimal API and should be used with the <GtkEditable> API.

CSS Nodes

entry.password
╰── text
    ├── image.caps-lock-indicator
    ┊

<GtkPasswordEntry> has a single CSS node with name entry that carries a .passwordstyle class. The text Css node below it has a child with name image and style class .caps-lock-indicator for the Caps Lock icon, and possibly other children.

Accessibility

<GtkPasswordEntry> uses the Gtk.AccessibleRole.text_box role.

Properties

Property: password-entry:activates-default self

Whether to activate the default widget when Enter is pressed.

Its value is a boolean.

Set it with (set! (password-entry:activates-default self) value).

Property: password-entry:extra-menu self

A menu model whose contents will be appended to the context menu.

Its value is a <GMenuModel>, or #f.

Set it with (set! (password-entry:extra-menu self) value).

Property: password-entry:placeholder-text self

The text that will be displayed in the <GtkPasswordEntry> when it is empty and unfocused.

Its value is a string, or #f.

Set it with (set! (password-entry:placeholder-text self) value).

Property: password-entry:show-peek-icon self

Whether to show an icon for revealing the content.

Its value is a boolean.

Set it with (set! (password-entry:show-peek-icon self) value).

Procedures

Method: password-entry:get-extra-menu self ⇒ %return
Method: get-extra-menu self ⇒ %return

Gets the menu model set with password-entry:set-extra-menu.

self

Passed: a <GtkPasswordEntry>.

a <GtkPasswordEntry>

%return

Returned: a <GMenuModel>, or #f.

the menu model

Method: password-entry:get-show-peek-icon? self ⇒ %return
Method: get-show-peek-icon? self ⇒ %return

Returns whether the entry is showing an icon to reveal the contents.

self

Passed: a <GtkPasswordEntry>.

a <GtkPasswordEntry>

%return

Returned: a boolean.

#t if an icon is shown

Procedure: password-entry:new ⇒ %return

Creates a <GtkPasswordEntry>.

%return

Returned: a <GtkWidget>.

a new <GtkPasswordEntry>

Method: password-entry:set-extra-menu self [model]
Method: set-extra-menu self [model]

Sets a menu model to add when constructing the context menu for self.

self

Passed: a <GtkPasswordEntry>.

a <GtkPasswordEntry>

model

Passed, or left out: a <GMenuModel>, or #f.

a <GMenuModel>

Method: password-entry:set-show-peek-icon self show-peek-icon
Method: set-show-peek-icon self show-peek-icon

Sets whether the entry should have a clickable icon to reveal the contents.

Setting this to #f also hides the text again.

self

Passed: a <GtkPasswordEntry>.

a <GtkPasswordEntry>

show-peek-icon

Passed: a boolean.

whether to show the peek icon

Signals

Signal: password-entry:activate

Connect a handler with (connect object password-entry:activate handler). It is called as (handler self).

Emitted when the entry is activated.

The keybindings for this signal are all forms of the Enter key.

self

Passed: a <GtkPasswordEntry>.