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) | |
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 0161888aea8..ba5e222a372 100644 --- a/gnu/installer/newt/ethernet.scm +++ b/gnu/installer/newt/ethernet.scm | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com> | 2 | ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com> |
| 3 | ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org> | ||
| 3 | ;;; | 4 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 5 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 6 | ;;; |
| @@ -23,6 +24,7 @@ | |||
| 23 | #:use-module (gnu installer newt page) | 24 | #:use-module (gnu installer newt page) |
| 24 | #:use-module (guix i18n) | 25 | #:use-module (guix i18n) |
| 25 | #:use-module (ice-9 format) | 26 | #:use-module (ice-9 format) |
| 27 | #:use-module (ice-9 match) | ||
| 26 | #:use-module (srfi srfi-34) | 28 | #:use-module (srfi srfi-34) |
| 27 | #:use-module (srfi srfi-35) | 29 | #:use-module (srfi srfi-35) |
| 28 | #:use-module (newt) | 30 | #:use-module (newt) |
| @@ -58,25 +60,28 @@ connection is pending." | |||
| 58 | service)) | 60 | service)) |
| 59 | 61 | ||
| 60 | (define (run-ethernet-page) | 62 | (define (run-ethernet-page) |
| 61 | (let ((services (ethernet-services))) | 63 | (match (ethernet-services) |
| 62 | (if (null? services) | 64 | (() |
| 63 | (begin | 65 | (run-error-page |
| 64 | (run-error-page | 66 | (G_ "No ethernet service available, please try again.") |
| 65 | (G_ "No ethernet service available, please try again.") | 67 | (G_ "No service")) |
| 66 | (G_ "No service")) | 68 | (raise |
| 67 | (raise | 69 | (condition |
| 68 | (condition | 70 | (&installer-step-abort)))) |
| 69 | (&installer-step-abort)))) | 71 | ((service) |
| 70 | (run-listbox-selection-page | 72 | ;; Only one service is available so return it directly. |
| 71 | #:info-text (G_ "Please select an ethernet network.") | 73 | service) |
| 72 | #:title (G_ "Ethernet connection") | 74 | ((services ...) |
| 73 | #:listbox-items services | 75 | (run-listbox-selection-page |
| 74 | #:listbox-item->text ethernet-service->text | 76 | #:info-text (G_ "Please select an ethernet network.") |
| 75 | #:listbox-height (min (+ (length services) 2) 10) | 77 | #:title (G_ "Ethernet connection") |
| 76 | #:button-text (G_ "Exit") | 78 | #:listbox-items services |
| 77 | #:button-callback-procedure | 79 | #:listbox-item->text ethernet-service->text |
| 78 | (lambda _ | 80 | #:listbox-height (min (+ (length services) 2) 10) |
| 79 | (raise | 81 | #:button-text (G_ "Exit") |
| 80 | (condition | 82 | #:button-callback-procedure |
| 81 | (&installer-step-abort)))) | 83 | (lambda _ |
| 82 | #:listbox-callback-procedure connect-ethernet-service)))) | 84 | (raise |
| 85 | (condition | ||
| 86 | (&installer-step-abort)))) | ||
| 87 | #:listbox-callback-procedure connect-ethernet-service)))) | ||
diff --git a/gnu/installer/newt/network.scm b/gnu/installer/newt/network.scm index 93fc19aecdf..0a938db1035 100644 --- a/gnu/installer/newt/network.scm +++ b/gnu/installer/newt/network.scm | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com> | 2 | ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com> |
| 3 | ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org> | ||
| 3 | ;;; | 4 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 5 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 6 | ;;; |
| @@ -28,6 +29,7 @@ | |||
| 28 | #:use-module (srfi srfi-11) | 29 | #:use-module (srfi srfi-11) |
| 29 | #:use-module (srfi srfi-34) | 30 | #:use-module (srfi srfi-34) |
| 30 | #:use-module (srfi srfi-35) | 31 | #:use-module (srfi srfi-35) |
| 32 | #:use-module (ice-9 match) | ||
| 31 | #:use-module (newt) | 33 | #:use-module (newt) |
| 32 | #:export (run-network-page)) | 34 | #:export (run-network-page)) |
| 33 | 35 | ||
| @@ -53,33 +55,38 @@ Internet and return the selected technology. For now, only technologies with | |||
| 53 | (string=? type "wifi")))) | 55 | (string=? type "wifi")))) |
| 54 | (connman-technologies))) | 56 | (connman-technologies))) |
| 55 | 57 | ||
| 56 | (let ((items (technology-items))) | 58 | (match (technology-items) |
| 57 | (if (null? items) | 59 | (() |
| 58 | (case (choice-window | 60 | (case (choice-window |
| 59 | (G_ "Internet access") | 61 | (G_ "Internet access") |
| 60 | (G_ "Continue") | 62 | (G_ "Continue") |
| 61 | (G_ "Exit") | 63 | (G_ "Exit") |
| 62 | (G_ "The install process requires Internet access but no \ | 64 | (G_ "The install process requires Internet access but no \ |
| 63 | network device were found. Do you want to continue anyway?")) | 65 | network device were found. Do you want to continue anyway?")) |
| 64 | ((1) (raise | 66 | ((1) (raise |
| 65 | (condition | 67 | (condition |
| 66 | (&installer-step-break)))) | 68 | (&installer-step-break)))) |
| 67 | ((2) (raise | 69 | ((2) (raise |
| 68 | (condition | 70 | (condition |
| 69 | (&installer-step-abort))))) | 71 | (&installer-step-abort)))))) |
| 70 | (run-listbox-selection-page | 72 | ((technology) |
| 71 | #:info-text (G_ "The install process requires Internet access.\ | 73 | ;; Since there's only one technology available, skip the selection |
| 74 | ;; screen. | ||
| 75 | technology) | ||
| 76 | ((items ...) | ||
| 77 | (run-listbox-selection-page | ||
| 78 | #:info-text (G_ "The install process requires Internet access.\ | ||
| 72 | Please select a network device.") | 79 | Please select a network device.") |
| 73 | #:title (G_ "Internet access") | 80 | #:title (G_ "Internet access") |
| 74 | #:listbox-items items | 81 | #:listbox-items items |
| 75 | #:listbox-item->text technology->text | 82 | #:listbox-item->text technology->text |
| 76 | #:listbox-height (min (+ (length items) 2) 10) | 83 | #:listbox-height (min (+ (length items) 2) 10) |
| 77 | #:button-text (G_ "Exit") | 84 | #:button-text (G_ "Exit") |
| 78 | #:button-callback-procedure | 85 | #:button-callback-procedure |
| 79 | (lambda _ | 86 | (lambda _ |
| 80 | (raise | 87 | (raise |
| 81 | (condition | 88 | (condition |
| 82 | (&installer-step-abort)))))))) | 89 | (&installer-step-abort)))))))) |
| 83 | 90 | ||
| 84 | (define (find-technology-by-type technologies type) | 91 | (define (find-technology-by-type technologies type) |
| 85 | "Find and return a technology with the given TYPE in TECHNOLOGIES list." | 92 | "Find and return a technology with the given TYPE in TECHNOLOGIES list." |
