[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/08: installer: Ask for confirmation before formatting partitions.
From: |
guix-commits |
Subject: |
03/08: installer: Ask for confirmation before formatting partitions. |
Date: |
Wed, 27 Mar 2019 06:54:18 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit c73e554c3fe609ee2d66628f7f09cf7fa6c8d4a6
Author: Ludovic Courtès <address@hidden>
Date: Wed Mar 27 09:50:24 2019 +0100
installer: Ask for confirmation before formatting partitions.
* gnu/installer/newt/page.scm (run-confirmation-page): New procedure.
* gnu/installer/newt/partition.scm (draw-formatting-page): Call it.
---
gnu/installer/newt/page.scm | 38 ++++++++++++++++++++++++++++++++++++++
gnu/installer/newt/partition.scm | 8 +++++++-
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/gnu/installer/newt/page.scm b/gnu/installer/newt/page.scm
index 23fbfcc..8b3fd48 100644
--- a/gnu/installer/newt/page.scm
+++ b/gnu/installer/newt/page.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Mathieu Othacehe <address@hidden>
+;;; Copyright © 2019 Ludovic Courtès <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -29,6 +30,7 @@
draw-connecting-page
run-input-page
run-error-page
+ run-confirmation-page
run-listbox-selection-page
run-scale-page
run-checkbox-tree-page
@@ -141,6 +143,42 @@ of the page is set to TITLE."
(newt-set-color COLORSET-ROOT "white" "blue")
(destroy-form-and-pop form)))
+(define* (run-confirmation-page text title
+ #:key (exit-button-procedure (const #f)))
+ "Run a page to inform the user of an error. The page contains the given TEXT
+to explain the error and an \"OK\" button to acknowledge the error. The title
+of the page is set to TITLE."
+ (let* ((text-box
+ (make-reflowed-textbox -1 -1 text 40
+ #:flags FLAG-BORDER))
+ (ok-button (make-button -1 -1 (G_ "Continue")))
+ (exit-button (make-button -1 -1 (G_ "Exit")))
+ (grid (vertically-stacked-grid
+ GRID-ELEMENT-COMPONENT text-box
+ GRID-ELEMENT-SUBGRID
+ (horizontal-stacked-grid
+ GRID-ELEMENT-COMPONENT ok-button
+ GRID-ELEMENT-COMPONENT exit-button)))
+ (form (make-form)))
+
+ (add-form-to-grid grid form #t)
+ (make-wrapped-grid-window grid title)
+
+ (receive (exit-reason argument)
+ (run-form form)
+ (dynamic-wind
+ (const #t)
+ (lambda ()
+ (case exit-reason
+ ((exit-component)
+ (cond
+ ((components=? argument ok-button)
+ #t)
+ ((components=? argument exit-button)
+ (exit-button-procedure))))))
+ (lambda ()
+ (destroy-form-and-pop form))))))
+
(define* (run-listbox-selection-page #:key
info-text
title
diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm
index d4c91ed..373aedd 100644
--- a/gnu/installer/newt/partition.scm
+++ b/gnu/installer/newt/partition.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Mathieu Othacehe <address@hidden>
+;;; Copyright © 2019 Ludovic Courtès <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -53,7 +54,12 @@
(car result)))
(define (draw-formatting-page)
- "Draw a page to indicate partitions are being formated."
+ "Draw a page asking for confirmation, and then indicating that partitions
+are being formatted."
+ (run-confirmation-page (G_ "We are about to format your hard disk. All \
+its data will be lost. Do you wish to continue?")
+ (G_ "Format disk?")
+ #:exit-button-procedure button-exit-action)
(draw-info-page
(format #f (G_ "Partition formatting is in progress, please wait."))
(G_ "Preparing partitions")))
- branch master updated (37099f5 -> 9e5f206), guix-commits, 2019/03/27
- 01/08: installer: Emit 'bootloader' field before 'swap-devices'., guix-commits, 2019/03/27
- 04/08: installer: Use the (service …) form for MATE., guix-commits, 2019/03/27
- 08/08: scripts: Skip 'guix pull' suggestion when running code from a checkout., guix-commits, 2019/03/27
- 02/08: installer: Produce an 'initrd-modules' field if needed., guix-commits, 2019/03/27
- 03/08: installer: Ask for confirmation before formatting partitions.,
guix-commits <=
- 07/08: vm: Ask QEMU for more RAM in the VM that makes ISO9660 images., guix-commits, 2019/03/27
- 05/08: services: Deprecate 'gnome-desktop-service'., guix-commits, 2019/03/27
- 06/08: services: Deprecate 'xfce-desktop-service'., guix-commits, 2019/03/27