mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 05:48:07 -05:00
installer: Remove group selection in user page.
Assume that the user's group is always "users". * gnu/installer/newt/user.scm (run-user-add-page): Remove group fields, (run-user-page): ditto.
This commit is contained in:
parent
1ad1b6e2f2
commit
35e99a23b5
1 changed files with 15 additions and 21 deletions
|
@ -17,6 +17,7 @@
|
|||
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gnu installer newt user)
|
||||
#:use-module (gnu installer user)
|
||||
#:use-module (gnu installer newt page)
|
||||
#:use-module (gnu installer newt utils)
|
||||
#:use-module (guix i18n)
|
||||
|
@ -33,16 +34,12 @@ (define (pad-label label)
|
|||
|
||||
(let* ((label-name
|
||||
(make-label -1 -1 (pad-label (G_ "Name"))))
|
||||
(label-group
|
||||
(make-label -1 -1 (pad-label (G_ "Group"))))
|
||||
(label-home-directory
|
||||
(make-label -1 -1 (pad-label (G_ "Home directory"))))
|
||||
(entry-width 30)
|
||||
(entry-name (make-entry -1 -1 entry-width))
|
||||
(entry-group (make-entry -1 -1 entry-width
|
||||
#:initial-value "users"))
|
||||
(entry-home-directory (make-entry -1 -1 entry-width))
|
||||
(entry-grid (make-grid 2 3))
|
||||
(entry-grid (make-grid 2 2))
|
||||
(button-grid (make-grid 1 1))
|
||||
(ok-button (make-button -1 -1 (G_ "Ok")))
|
||||
(grid (make-grid 1 2))
|
||||
|
@ -53,10 +50,8 @@ (define (pad-label label)
|
|||
|
||||
(set-entry-grid-field 0 0 label-name)
|
||||
(set-entry-grid-field 1 0 entry-name)
|
||||
(set-entry-grid-field 0 1 label-group)
|
||||
(set-entry-grid-field 1 1 entry-group)
|
||||
(set-entry-grid-field 0 2 label-home-directory)
|
||||
(set-entry-grid-field 1 2 entry-home-directory)
|
||||
(set-entry-grid-field 0 1 label-home-directory)
|
||||
(set-entry-grid-field 1 1 entry-home-directory)
|
||||
|
||||
(set-grid-field button-grid 0 0 GRID-ELEMENT-COMPONENT ok-button)
|
||||
|
||||
|
@ -67,8 +62,8 @@ (define (pad-label label)
|
|||
(string-append "/home/" (entry-value entry-name)))))
|
||||
|
||||
(add-components-to-form form
|
||||
label-name label-group label-home-directory
|
||||
entry-name entry-group entry-home-directory
|
||||
label-name label-home-directory
|
||||
entry-name entry-home-directory
|
||||
ok-button)
|
||||
|
||||
(make-wrapped-grid-window (vertically-stacked-grid
|
||||
|
@ -88,17 +83,15 @@ (define (pad-label label)
|
|||
(cond
|
||||
((components=? argument ok-button)
|
||||
(let ((name (entry-value entry-name))
|
||||
(group (entry-value entry-group))
|
||||
(home-directory (entry-value entry-home-directory)))
|
||||
(if (or (string=? name "")
|
||||
(string=? group "")
|
||||
(string=? home-directory ""))
|
||||
(begin
|
||||
(error-page)
|
||||
(run-user-add-page))
|
||||
`((name . ,name)
|
||||
(group . ,group)
|
||||
(home-directory . ,home-directory))))))))
|
||||
(user
|
||||
(name name)
|
||||
(home-directory home-directory))))))))
|
||||
(lambda ()
|
||||
(destroy-form-and-pop form)))))))
|
||||
|
||||
|
@ -124,7 +117,7 @@ (define (run users)
|
|||
(list GRID-ELEMENT-COMPONENT del-button)))))
|
||||
(ok-button (make-button -1 -1 (G_ "Ok")))
|
||||
(cancel-button (make-button -1 -1 (G_ "Cancel")))
|
||||
(title "User selection")
|
||||
(title "User creation")
|
||||
(grid
|
||||
(vertically-stacked-grid
|
||||
GRID-ELEMENT-COMPONENT info-textbox
|
||||
|
@ -135,13 +128,13 @@ (define (run users)
|
|||
GRID-ELEMENT-COMPONENT ok-button
|
||||
GRID-ELEMENT-COMPONENT cancel-button)))
|
||||
(sorted-users (sort users (lambda (a b)
|
||||
(string<= (assoc-ref a 'name)
|
||||
(assoc-ref b 'name)))))
|
||||
(string<= (user-name a)
|
||||
(user-name b)))))
|
||||
(listbox-elements
|
||||
(map
|
||||
(lambda (user)
|
||||
`((key . ,(append-entry-to-listbox listbox
|
||||
(assoc-ref user 'name)))
|
||||
(user-name user)))
|
||||
(user . ,user)))
|
||||
sorted-users))
|
||||
(form (make-form)))
|
||||
|
@ -175,7 +168,8 @@ (define (run users)
|
|||
(when (null? users)
|
||||
(run-error-page (G_ "Please create at least one user.")
|
||||
(G_ "No user"))
|
||||
(run users))))))
|
||||
(run users))
|
||||
users))))
|
||||
(lambda ()
|
||||
(destroy-form-and-pop form))))))
|
||||
(run '()))
|
||||
|
|
Loading…
Reference in a new issue