summaryrefslogtreecommitdiff
path: root/gnu/installer/newt/page.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2019-05-25 00:25:15 +0200
committerMarius Bakke <mbakke@fastmail.com>2019-05-25 00:25:15 +0200
commit57df83e07d4b5e78d9a54c1a88d05b4a9ed65714 (patch)
tree76684e63965e9ad6e37d9d45bc3159e6c9782cd0 /gnu/installer/newt/page.scm
parent43d9ed7792808638eabb43aa6133f1d6186c520b (diff)
parent136b7d81f0eb713783e9ea7cf7f260a2b6252dfd (diff)
downloadguix-patches-57df83e07d4b5e78d9a54c1a88d05b4a9ed65714.tar
guix-patches-57df83e07d4b5e78d9a54c1a88d05b4a9ed65714.tar.gz
Merge branch 'staging' into core-updates
Diffstat (limited to 'gnu/installer/newt/page.scm')
-rw-r--r--gnu/installer/newt/page.scm42
1 files changed, 32 insertions, 10 deletions
diff --git a/gnu/installer/newt/page.scm b/gnu/installer/newt/page.scm
index 3173d54737..728721c08f 100644
--- a/gnu/installer/newt/page.scm
+++ b/gnu/installer/newt/page.scm
@@ -75,6 +75,7 @@ this page to TITLE."
#:key
(allow-empty-input? #f)
(default-text #f)
+ (input-hide-checkbox? #f)
(input-field-width 40)
(input-flags 0))
"Run a page to prompt user for an input. The given TEXT will be displayed
@@ -86,22 +87,38 @@ input box, such as FLAG-PASSWORD."
(make-reflowed-textbox -1 -1 text
input-field-width
#:flags FLAG-BORDER))
- (grid (make-grid 1 3))
+ (input-visible-cb
+ (make-checkbox -1 -1 (G_ "Hide") #\x "x "))
+ (input-flags* (if input-hide-checkbox?
+ (logior FLAG-PASSWORD FLAG-SCROLL
+ input-flags)
+ input-flags))
(input-entry (make-entry -1 -1 20
- #:flags input-flags))
+ #:flags input-flags*))
(ok-button (make-button -1 -1 (G_ "OK")))
+ (grid (vertically-stacked-grid
+ GRID-ELEMENT-COMPONENT text-box
+ GRID-ELEMENT-SUBGRID
+ (apply
+ horizontal-stacked-grid
+ GRID-ELEMENT-COMPONENT input-entry
+ `(,@(if input-hide-checkbox?
+ (list GRID-ELEMENT-COMPONENT input-visible-cb)
+ '())))
+ GRID-ELEMENT-COMPONENT ok-button))
(form (make-form)))
+ (add-component-callback
+ input-visible-cb
+ (lambda (component)
+ (set-entry-flags input-entry
+ FLAG-PASSWORD
+ FLAG-ROLE-TOGGLE)))
+
(when default-text
(set-entry-text input-entry default-text))
- (set-grid-field grid 0 0 GRID-ELEMENT-COMPONENT text-box)
- (set-grid-field grid 0 1 GRID-ELEMENT-COMPONENT input-entry
- #:pad-top 1)
- (set-grid-field grid 0 2 GRID-ELEMENT-COMPONENT ok-button
- #:pad-top 1)
-
- (add-components-to-form form text-box input-entry ok-button)
+ (add-form-to-grid grid form #t)
(make-wrapped-grid-window grid title)
(let ((error-page (lambda ()
(run-error-page (G_ "Please enter a non empty input.")
@@ -559,7 +576,12 @@ ITEMS when 'Ok' is pressed."
'())))))
(form (make-form)))
- (set-textbox-text file-textbox file-text)
+ (set-textbox-text file-textbox
+ (receive (_w _h text)
+ (reflow-text file-text
+ file-textbox-width
+ 0 0)
+ text))
(add-form-to-grid grid form #t)
(make-wrapped-grid-window grid title)