me
/
guix
Archived
1
0
Fork 0

installer: Skip network selection dialogs when there is no choice.

Previously, for a machine that only has wired networking, and only one
such network, we'd have to go through two selection boxes.  Now we just
skip both.

* gnu/installer/newt/ethernet.scm (run-ethernet-page): When
'ethernet-services' returns one element, return it directly without
opening a listbox selection.
* gnu/installer/newt/network.scm (run-technology-page): Likewise.
master
Ludovic Courtès 2019-05-06 22:23:42 +02:00
parent d1e5f758e1
commit 46c102ca5e
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 59 additions and 47 deletions

View File

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -23,6 +24,7 @@
#:use-module (gnu installer newt page) #:use-module (gnu installer newt page)
#:use-module (guix i18n) #:use-module (guix i18n)
#:use-module (ice-9 format) #:use-module (ice-9 format)
#:use-module (ice-9 match)
#:use-module (srfi srfi-34) #:use-module (srfi srfi-34)
#:use-module (srfi srfi-35) #:use-module (srfi srfi-35)
#:use-module (newt) #:use-module (newt)
@ -58,25 +60,28 @@ connection is pending."
service)) service))
(define (run-ethernet-page) (define (run-ethernet-page)
(let ((services (ethernet-services))) (match (ethernet-services)
(if (null? services) (()
(begin (run-error-page
(run-error-page (G_ "No ethernet service available, please try again.")
(G_ "No ethernet service available, please try again.") (G_ "No service"))
(G_ "No service")) (raise
(raise (condition
(condition (&installer-step-abort))))
(&installer-step-abort)))) ((service)
(run-listbox-selection-page ;; Only one service is available so return it directly.
#:info-text (G_ "Please select an ethernet network.") service)
#:title (G_ "Ethernet connection") ((services ...)
#:listbox-items services (run-listbox-selection-page
#:listbox-item->text ethernet-service->text #:info-text (G_ "Please select an ethernet network.")
#:listbox-height (min (+ (length services) 2) 10) #:title (G_ "Ethernet connection")
#:button-text (G_ "Exit") #:listbox-items services
#:button-callback-procedure #:listbox-item->text ethernet-service->text
(lambda _ #:listbox-height (min (+ (length services) 2) 10)
(raise #:button-text (G_ "Exit")
(condition #:button-callback-procedure
(&installer-step-abort)))) (lambda _
#:listbox-callback-procedure connect-ethernet-service)))) (raise
(condition
(&installer-step-abort))))
#:listbox-callback-procedure connect-ethernet-service))))

View File

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -28,6 +29,7 @@
#:use-module (srfi srfi-11) #:use-module (srfi srfi-11)
#:use-module (srfi srfi-34) #:use-module (srfi srfi-34)
#:use-module (srfi srfi-35) #:use-module (srfi srfi-35)
#:use-module (ice-9 match)
#:use-module (newt) #:use-module (newt)
#:export (run-network-page)) #:export (run-network-page))
@ -53,33 +55,38 @@ Internet and return the selected technology. For now, only technologies with
(string=? type "wifi")))) (string=? type "wifi"))))
(connman-technologies))) (connman-technologies)))
(let ((items (technology-items))) (match (technology-items)
(if (null? items) (()
(case (choice-window (case (choice-window
(G_ "Internet access") (G_ "Internet access")
(G_ "Continue") (G_ "Continue")
(G_ "Exit") (G_ "Exit")
(G_ "The install process requires Internet access but no \ (G_ "The install process requires Internet access but no \
network device were found. Do you want to continue anyway?")) network device were found. Do you want to continue anyway?"))
((1) (raise ((1) (raise
(condition (condition
(&installer-step-break)))) (&installer-step-break))))
((2) (raise ((2) (raise
(condition (condition
(&installer-step-abort))))) (&installer-step-abort))))))
(run-listbox-selection-page ((technology)
#:info-text (G_ "The install process requires Internet access.\ ;; Since there's only one technology available, skip the selection
;; screen.
technology)
((items ...)
(run-listbox-selection-page
#:info-text (G_ "The install process requires Internet access.\
Please select a network device.") Please select a network device.")
#:title (G_ "Internet access") #:title (G_ "Internet access")
#:listbox-items items #:listbox-items items
#:listbox-item->text technology->text #:listbox-item->text technology->text
#:listbox-height (min (+ (length items) 2) 10) #:listbox-height (min (+ (length items) 2) 10)
#:button-text (G_ "Exit") #:button-text (G_ "Exit")
#:button-callback-procedure #:button-callback-procedure
(lambda _ (lambda _
(raise (raise
(condition (condition
(&installer-step-abort)))))))) (&installer-step-abort))))))))
(define (find-technology-by-type technologies type) (define (find-technology-by-type technologies type)
"Find and return a technology with the given TYPE in TECHNOLOGIES list." "Find and return a technology with the given TYPE in TECHNOLOGIES list."