[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/12: installer: Add #:selection parameter to 'run-checkbox-tree-page'.
From: |
guix-commits |
Subject: |
05/12: installer: Add #:selection parameter to 'run-checkbox-tree-page'. |
Date: |
Sun, 28 Apr 2019 16:57:16 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 7253c2b6297f85ec94512a2cff39ab25df043ad9
Author: Ludovic Courtès <address@hidden>
Date: Sun Apr 28 21:43:35 2019 +0200
installer: Add #:selection parameter to 'run-checkbox-tree-page'.
* gnu/installer/newt/page.scm (%none-selected): New variable.
(run-checkbox-tree-page): Add #:selection.
[fill-checkbox-tree]: Honor it.
---
gnu/installer/newt/page.scm | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/gnu/installer/newt/page.scm b/gnu/installer/newt/page.scm
index e9514e1..3173d54 100644
--- a/gnu/installer/newt/page.scm
+++ b/gnu/installer/newt/page.scm
@@ -437,10 +437,14 @@ error is raised if the MAX-SCALE-UPDATE limit is reached."
(lambda ()
(destroy-form-and-pop form)))))
+(define %none-selected
+ (circular-list #f))
+
(define* (run-checkbox-tree-page #:key
info-text
title
items
+ (selection %none-selected)
item->text
(info-textbox-width 50)
(checkbox-tree-height 10)
@@ -453,7 +457,8 @@ a checkbox list. The page contains vertically stacked from
the top to the
bottom, an informative text set to INFO-TEXT, the checkbox list and two
buttons, 'Ok' and 'Exit'. The page title's is set to TITLE. ITEMS are
converted to text using ITEM->TEXT before being displayed in the checkbox
-list.
+list. SELECTION is a list of Booleans of the same length as ITEMS that
+specifies which items are initially checked.
INFO-TEXTBOX-WIDTH is the width of the textbox where INFO-TEXT will be
displayed. CHECKBOX-TREE-HEIGHT is the height of the checkbox list.
@@ -465,12 +470,15 @@ pressed.
This procedure returns the list of checked items in the checkbox list among
ITEMS when 'Ok' is pressed."
(define (fill-checkbox-tree checkbox-tree items)
- (map
- (lambda (item)
- (let* ((item-text (item->text item))
- (key (add-entry-to-checkboxtree checkbox-tree item-text 0)))
- (cons key item)))
- items))
+ (map (lambda (item selected?)
+ (let* ((item-text (item->text item))
+ (key (add-entry-to-checkboxtree checkbox-tree item-text
+ (if selected?
+ FLAG-SELECTED
+ 0))))
+ (cons key item)))
+ items
+ selection))
(let* ((checkbox-tree
(make-checkboxtree -1 -1
- branch master updated (e0f3a4f -> d779de1), guix-commits, 2019/04/28
- 12/12: installer: Tell the user where the config file is., guix-commits, 2019/04/28
- 10/12: installer: User accounts can now have a "real name.", guix-commits, 2019/04/28
- 11/12: installer: Fix handling of user password mismatches., guix-commits, 2019/04/28
- 09/12: installer: User can have a "real name"., guix-commits, 2019/04/28
- 07/12: installer: Add 'nss-certs' to the networking services., guix-commits, 2019/04/28
- 08/12: installer: Improve layout of the partitioning page., guix-commits, 2019/04/28
- 06/12: installer: Recommended services are pre-selected., guix-commits, 2019/04/28
- 03/12: Update NEWS., guix-commits, 2019/04/28
- 05/12: installer: Add #:selection parameter to 'run-checkbox-tree-page'.,
guix-commits <=
- 04/12: doc: Duplicate recommendation about 'guix-install.sh'., guix-commits, 2019/04/28
- 01/12: describe: Provide a hint when origin detection fails., guix-commits, 2019/04/28
- 02/12: vm-image: Add 'nss-certs' to the global package set., guix-commits, 2019/04/28