diff options
author | Marius Bakke <mbakke@fastmail.com> | 2019-04-01 00:02:39 +0200 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2019-04-01 00:02:39 +0200 |
commit | 571fb008a576378883c053be186d2c620290ea39 (patch) | |
tree | 5279a2c2772a9b76299a48d697d568f208a89722 /gnu/installer/newt/page.scm | |
parent | 7c86fdda7ceed11377b0e17b47c91598be59be52 (diff) | |
parent | f125c5a5ea03d53749f45d310694b79241d5888d (diff) | |
download | guix-571fb008a576378883c053be186d2c620290ea39.tar.gz |
Merge branch 'master' into staging
Diffstat (limited to 'gnu/installer/newt/page.scm')
-rw-r--r-- | gnu/installer/newt/page.scm | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gnu/installer/newt/page.scm b/gnu/installer/newt/page.scm index 23fbfcce76..8b3fd488e9 100644 --- a/gnu/installer/newt/page.scm +++ b/gnu/installer/newt/page.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com> +;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -29,6 +30,7 @@ draw-connecting-page run-input-page run-error-page + run-confirmation-page run-listbox-selection-page run-scale-page run-checkbox-tree-page @@ -141,6 +143,42 @@ of the page is set to TITLE." (newt-set-color COLORSET-ROOT "white" "blue") (destroy-form-and-pop form))) +(define* (run-confirmation-page text title + #:key (exit-button-procedure (const #f))) + "Run a page to inform the user of an error. The page contains the given TEXT +to explain the error and an \"OK\" button to acknowledge the error. The title +of the page is set to TITLE." + (let* ((text-box + (make-reflowed-textbox -1 -1 text 40 + #:flags FLAG-BORDER)) + (ok-button (make-button -1 -1 (G_ "Continue"))) + (exit-button (make-button -1 -1 (G_ "Exit"))) + (grid (vertically-stacked-grid + GRID-ELEMENT-COMPONENT text-box + GRID-ELEMENT-SUBGRID + (horizontal-stacked-grid + GRID-ELEMENT-COMPONENT ok-button + GRID-ELEMENT-COMPONENT exit-button))) + (form (make-form))) + + (add-form-to-grid grid form #t) + (make-wrapped-grid-window grid title) + + (receive (exit-reason argument) + (run-form form) + (dynamic-wind + (const #t) + (lambda () + (case exit-reason + ((exit-component) + (cond + ((components=? argument ok-button) + #t) + ((components=? argument exit-button) + (exit-button-procedure)))))) + (lambda () + (destroy-form-and-pop form)))))) + (define* (run-listbox-selection-page #:key info-text title |