diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-05-06 22:23:42 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-05-06 23:21:33 +0200 |
commit | 46c102ca5e76ffc1daa42edba439eee9fd0f102c (patch) | |
tree | cad356abc78a17780a4b40b74042dde2c0c11420 | |
parent | d1e5f758e128a3c1042c98563c5b87b81b2f187a (diff) | |
download | patches-46c102ca5e76ffc1daa42edba439eee9fd0f102c.tar patches-46c102ca5e76ffc1daa42edba439eee9fd0f102c.tar.gz |
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.
-rw-r--r-- | gnu/installer/newt/ethernet.scm | 49 | ||||
-rw-r--r-- | gnu/installer/newt/network.scm | 57 |
2 files changed, 59 insertions, 47 deletions
diff --git a/gnu/installer/newt/ethernet.scm b/gnu/installer/newt/ethernet.scm index 0161888aea..ba5e222a37 100644 --- a/gnu/installer/newt/ethernet.scm +++ b/gnu/installer/newt/ethernet.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. ;;; @@ -23,6 +24,7 @@ #:use-module (gnu installer newt page) #:use-module (guix i18n) #:use-module (ice-9 format) + #:use-module (ice-9 match) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) #:use-module (newt) @@ -58,25 +60,28 @@ connection is pending." service)) (define (run-ethernet-page) - (let ((services (ethernet-services))) - (if (null? services) - (begin - (run-error-page - (G_ "No ethernet service available, please try again.") - (G_ "No service")) - (raise - (condition - (&installer-step-abort)))) - (run-listbox-selection-page - #:info-text (G_ "Please select an ethernet network.") - #:title (G_ "Ethernet connection") - #:listbox-items services - #:listbox-item->text ethernet-service->text - #:listbox-height (min (+ (length services) 2) 10) - #:button-text (G_ "Exit") - #:button-callback-procedure - (lambda _ - (raise - (condition - (&installer-step-abort)))) - #:listbox-callback-procedure connect-ethernet-service)))) + (match (ethernet-services) + (() + (run-error-page + (G_ "No ethernet service available, please try again.") + (G_ "No service")) + (raise + (condition + (&installer-step-abort)))) + ((service) + ;; Only one service is available so return it directly. + service) + ((services ...) + (run-listbox-selection-page + #:info-text (G_ "Please select an ethernet network.") + #:title (G_ "Ethernet connection") + #:listbox-items services + #:listbox-item->text ethernet-service->text + #:listbox-height (min (+ (length services) 2) 10) + #:button-text (G_ "Exit") + #:button-callback-procedure + (lambda _ + (raise + (condition + (&installer-step-abort)))) + #:listbox-callback-procedure connect-ethernet-service)))) diff --git a/gnu/installer/newt/network.scm b/gnu/installer/newt/network.scm index 93fc19aecd..0a938db103 100644 --- a/gnu/installer/newt/network.scm +++ b/gnu/installer/newt/network.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. ;;; @@ -28,6 +29,7 @@ #:use-module (srfi srfi-11) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) + #:use-module (ice-9 match) #:use-module (newt) #:export (run-network-page)) @@ -53,33 +55,38 @@ Internet and return the selected technology. For now, only technologies with (string=? type "wifi")))) (connman-technologies))) - (let ((items (technology-items))) - (if (null? items) - (case (choice-window - (G_ "Internet access") - (G_ "Continue") - (G_ "Exit") - (G_ "The install process requires Internet access but no \ + (match (technology-items) + (() + (case (choice-window + (G_ "Internet access") + (G_ "Continue") + (G_ "Exit") + (G_ "The install process requires Internet access but no \ network device were found. Do you want to continue anyway?")) - ((1) (raise - (condition - (&installer-step-break)))) - ((2) (raise - (condition - (&installer-step-abort))))) - (run-listbox-selection-page - #:info-text (G_ "The install process requires Internet access.\ + ((1) (raise + (condition + (&installer-step-break)))) + ((2) (raise + (condition + (&installer-step-abort)))))) + ((technology) + ;; 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.") - #:title (G_ "Internet access") - #:listbox-items items - #:listbox-item->text technology->text - #:listbox-height (min (+ (length items) 2) 10) - #:button-text (G_ "Exit") - #:button-callback-procedure - (lambda _ - (raise - (condition - (&installer-step-abort)))))))) + #:title (G_ "Internet access") + #:listbox-items items + #:listbox-item->text technology->text + #:listbox-height (min (+ (length items) 2) 10) + #:button-text (G_ "Exit") + #:button-callback-procedure + (lambda _ + (raise + (condition + (&installer-step-abort)))))))) (define (find-technology-by-type technologies type) "Find and return a technology with the given TYPE in TECHNOLOGIES list." |