[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
188/197: installer: Go back to main menu after "cancel"
From: |
Danny Milosavljevic |
Subject: |
188/197: installer: Go back to main menu after "cancel" |
Date: |
Mon, 3 Jul 2017 20:37:23 -0400 (EDT) |
dannym pushed a commit to branch wip-installer-2
in repository guix.
commit 61060c4a0abe7d5c1d55831d76f2c03831aa40ad
Author: John Darrington <address@hidden>
Date: Mon Feb 20 17:11:05 2017 +0100
installer: Go back to main menu after "cancel"
* gnu/system/installer/guixsd-installer.scm: (guixsd-installer): Perform
a "major" pop when a cancelled page is encountered.
* gnu/system/installer/levelled-stack.scm (page-pop, page-ppop):
Do not remove the first #f in the stack.
* gnu/system/installer/configure.scm,
gnu/system/installer/filesystems.scm,
gnu/system/installer/format.scm,
gnu/system/installer/hostname.scm,
gnu/system/installer/role.scm,
gnu/system/installer/time-zone.scm: Return the symbol 'cancelled when a
page's
cancel button is activated.
---
gnu/system/installer/configure.scm | 9 +--
gnu/system/installer/filesystems.scm | 113 +++++++++++++++---------------
gnu/system/installer/format.scm | 8 +--
gnu/system/installer/guixsd-installer.scm | 6 +-
gnu/system/installer/hostname.scm | 6 +-
gnu/system/installer/levelled-stack.scm | 11 +--
gnu/system/installer/role.scm | 15 ++--
gnu/system/installer/time-zone.scm | 14 ++--
8 files changed, 85 insertions(+), 97 deletions(-)
diff --git a/gnu/system/installer/configure.scm
b/gnu/system/installer/configure.scm
index f176edf..90ad45a 100644
--- a/gnu/system/installer/configure.scm
+++ b/gnu/system/installer/configure.scm
@@ -101,9 +101,8 @@
((buttons-key-matches-symbol? nav ch 'cancel)
;; Close the menu and return
- (page-leave))
-
-
+ (page-leave)
+ 'cancelled)
((buttons-key-matches-symbol? nav ch 'save)
@@ -116,9 +115,7 @@
;; Close the menu and return
(page-leave))
- )
-
- #f))
+ )))
(define (configure-page-refresh page)
(when (not (page-initialised? page))
diff --git a/gnu/system/installer/filesystems.scm
b/gnu/system/installer/filesystems.scm
index 2ec7d3e..02573e2 100644
--- a/gnu/system/installer/filesystems.scm
+++ b/gnu/system/installer/filesystems.scm
@@ -174,64 +174,61 @@
(define (filesystem-page-key-handler page ch)
- (let ((menu (page-datum page 'menu))
- (nav (page-datum page 'navigation)))
-
- (cond
- ((eq? ch KEY_RIGHT)
- (menu-set-active! menu #f)
- (buttons-select-next nav))
-
- ((eq? ch #\tab)
- (cond
- ((menu-active menu)
- (menu-set-active! menu #f)
- (buttons-select nav 0))
-
- ((eqv? (buttons-selected nav) (1- (buttons-n-buttons nav)))
- (menu-set-active! menu #t)
- (buttons-unselect-all nav))
-
- (else
- (buttons-select-next nav))))
-
- ((eq? ch KEY_LEFT)
- (menu-set-active! menu #f)
- (buttons-select-prev nav))
-
- ((eq? ch KEY_UP)
- (buttons-unselect-all nav)
- (menu-set-active! menu #t))
-
- ((eq? ch #\newline)
- (let* ((dev (list-ref (menu-items menu) (menu-current-item menu)))
- (name (partition-name (car dev)))
- (next (make-page (page-surface page)
- (format #f
- (gettext "Choose the mount point for
device ~s") name)
- mount-point-refresh
- 1
- mount-point-page-key-handler)))
-
- (page-set-datum! next 'device name)
- (page-enter next)))
-
- ((buttons-key-matches-symbol? nav ch 'cancel)
- (page-leave))
-
-
- ((buttons-key-matches-symbol? nav ch 'continue)
- (let ((errstr (filesystem-task-incomplete-reason)))
- (if errstr
- (let ((next (make-dialog page errstr)))
- (page-enter next))
- (begin
- (page-leave))
- ))))
-
- (std-menu-key-handler menu ch))
- #f
- )
+ (let* ((menu (page-datum page 'menu))
+ (nav (page-datum page 'navigation))
+ (result (cond
+ ((eq? ch KEY_RIGHT)
+ (menu-set-active! menu #f)
+ (buttons-select-next nav))
+
+ ((eq? ch #\tab)
+ (cond
+ ((menu-active menu)
+ (menu-set-active! menu #f)
+ (buttons-select nav 0))
+
+ ((eqv? (buttons-selected nav) (1- (buttons-n-buttons nav)))
+ (menu-set-active! menu #t)
+ (buttons-unselect-all nav))
+
+ (else
+ (buttons-select-next nav))))
+
+ ((eq? ch KEY_LEFT)
+ (menu-set-active! menu #f)
+ (buttons-select-prev nav))
+
+ ((eq? ch KEY_UP)
+ (buttons-unselect-all nav)
+ (menu-set-active! menu #t))
+
+ ((eq? ch #\newline)
+ (let* ((dev (list-ref (menu-items menu) (menu-current-item
menu)))
+ (name (partition-name (car dev)))
+ (next (make-page (page-surface page)
+ (format #f
+ (gettext "Choose the mount
point for device ~s") name)
+ mount-point-refresh
+ 1
+ mount-point-page-key-handler)))
+
+ (page-set-datum! next 'device name)
+ (page-enter next)))
+
+ ((buttons-key-matches-symbol? nav ch 'cancel)
+ (page-leave)
+ 'cancelled)
+
+ ((buttons-key-matches-symbol? nav ch 'continue)
+ (let ((errstr (filesystem-task-incomplete-reason)))
+ (if errstr
+ (let ((next (make-dialog page errstr)))
+ (page-enter next))
+ (page-leave)
+ ))))))
+
+ (std-menu-key-handler menu ch)
+ result))
(define (filesystem-page-init p)
(let* ((s (page-surface p))
diff --git a/gnu/system/installer/format.scm b/gnu/system/installer/format.scm
index b8c5f5e..99e1d02 100644
--- a/gnu/system/installer/format.scm
+++ b/gnu/system/installer/format.scm
@@ -74,7 +74,6 @@ match those uuids read from the respective partitions"
(define (format-page-key-handler page ch)
-
(let ((nav (page-datum page 'navigation))
(config-window (page-datum page 'config-window)))
@@ -99,7 +98,8 @@ match those uuids read from the respective partitions"
((buttons-key-matches-symbol? nav ch 'cancel)
;; Close the menu and return
- (page-leave))
+ (page-leave)
+ 'cancelled)
((buttons-key-matches-symbol? nav ch 'format)
@@ -143,9 +143,7 @@ match those uuids read from the respective partitions"
(when (filesystems-are-current?)
(page-leave))
- ))
-
- #f))
+ ))))
(define (format-page-refresh page)
(when (not (page-initialised? page))
diff --git a/gnu/system/installer/guixsd-installer.scm
b/gnu/system/installer/guixsd-installer.scm
index 6529d1a..7bfb060 100644
--- a/gnu/system/installer/guixsd-installer.scm
+++ b/gnu/system/installer/guixsd-installer.scm
@@ -316,8 +316,10 @@
(page-enter page)
(page-push #f)
(let loop ((ch (getch stdscr)))
- (let ((current-page (page-top)))
- ((page-key-handler current-page) current-page ch)
+ (let* ((current-page (page-top))
+ (ret ((page-key-handler current-page) current-page ch)))
+ (when (eq? ret 'cancelled)
+ (page-ppop))
(base-page-key-handler current-page ch))
((page-refresh (page-top)) (page-top))
(loop (getch stdscr)))
diff --git a/gnu/system/installer/hostname.scm
b/gnu/system/installer/hostname.scm
index 957f108..151f3b0 100644
--- a/gnu/system/installer/hostname.scm
+++ b/gnu/system/installer/hostname.scm
@@ -75,7 +75,8 @@
(cond
((buttons-key-matches-symbol? nav ch 'cancel)
- (page-leave))
+ (page-leave)
+ 'cancelled)
((select-key? ch)
(set! host-name (form-get-value form 0))
@@ -111,8 +112,7 @@
(positive? (field-cursor-position (get-current-field form)))))
(else
- (form-enter form ch)))
- #f))
+ (form-enter form ch)))))
(define my-buttons `((cancel ,(M_ "Cancel") #f)))
diff --git a/gnu/system/installer/levelled-stack.scm
b/gnu/system/installer/levelled-stack.scm
index 3057300..be1ec3b 100644
--- a/gnu/system/installer/levelled-stack.scm
+++ b/gnu/system/installer/levelled-stack.scm
@@ -59,11 +59,7 @@ tail of the list."
(define (page-pop)
- (set! stack (cdr stack))
- (when (and (not (null? stack))
- (not (car stack)))
- ;; If the top item is #f then page-pop again
- (page-pop)))
+ (set! stack (cdr stack)))
(define (page-top)
(if (car stack)
@@ -74,6 +70,5 @@ tail of the list."
(set! stack (cdr stack))
(when (not (null? stack))
(let ((head (car stack)))
- (if head
- (page-ppop)
- (page-pop)))))
+ (when head
+ (page-ppop)))))
diff --git a/gnu/system/installer/role.scm b/gnu/system/installer/role.scm
index 09ebcc0..37f30aa 100644
--- a/gnu/system/installer/role.scm
+++ b/gnu/system/installer/role.scm
@@ -57,11 +57,9 @@
(define my-buttons `((cancel ,(M_ "Canc_el") #t)))
(define (role-page-key-handler page ch)
- (let ((menu (page-datum page 'menu))
- (nav (page-datum page 'navigation)))
-
- (cond
- ((eq? ch KEY_RIGHT)
+ (let* ((menu (page-datum page 'menu))
+ (nav (page-datum page 'navigation))
+ (result (cond ((eq? ch KEY_RIGHT)
(menu-set-active! menu #f)
(buttons-select-next nav))
@@ -93,10 +91,11 @@
(page-leave))
((buttons-key-matches-symbol? nav ch 'cancel)
- (page-leave)))
+ (page-leave)
+ 'cancelled))))
- (std-menu-key-handler menu ch))
- #f)
+ (std-menu-key-handler menu ch)
+ result))
(define (role-page-refresh page)
diff --git a/gnu/system/installer/time-zone.scm
b/gnu/system/installer/time-zone.scm
index ff7fbc7..6ad33d1 100644
--- a/gnu/system/installer/time-zone.scm
+++ b/gnu/system/installer/time-zone.scm
@@ -42,11 +42,10 @@
(define my-buttons `((cancel ,(M_ "Canc_el") #t)))
(define (time-zone-page-key-handler page ch)
- (let ((nav (page-datum page 'navigation))
+ (let* ((nav (page-datum page 'navigation))
(menu (page-datum page 'menu))
- (directory (page-datum page 'directory)))
-
- (cond
+ (directory (page-datum page 'directory))
+ (result (cond
((eq? ch #\tab)
(cond
((eqv? (buttons-selected nav) (1- (buttons-n-buttons nav)))
@@ -56,7 +55,8 @@
(buttons-select-next nav))))
((buttons-key-matches-symbol? nav ch 'cancel)
- (page-leave))
+ (page-leave)
+ 'cancelled)
((and (eqv? ch #\newline)
(menu-active menu))
@@ -79,9 +79,9 @@
i))
(page-leave)
#f)))
- ))
+ ))))
(std-menu-key-handler menu ch)
- #f))
+ result))
(define (time-zone-page-refresh page)
- 135/197: installer: Use a "hard" method of rebooting. Do not rely on shepherd., (continued)
- 135/197: installer: Use a "hard" method of rebooting. Do not rely on shepherd., Danny Milosavljevic, 2017/07/03
- 148/197: installer: Support WEP encrypted wireless., Danny Milosavljevic, 2017/07/03
- 176/197: installer: Fix incorrect symbol in generated config file., Danny Milosavljevic, 2017/07/03
- 177/197: installer: Remove non-existant supplementary group., Danny Milosavljevic, 2017/07/03
- 182/197: installer: Kill old dhclient instance before starting new one., Danny Milosavljevic, 2017/07/03
- 189/197: installer: Fix buglet where keys were sometimes ignored in users page., Danny Milosavljevic, 2017/07/03
- 179/197: installer: Mount all partitions instead of just the root., Danny Milosavljevic, 2017/07/03
- 190/197: gurses: forms: Minor refactor., Danny Milosavljevic, 2017/07/03
- 194/197: guix system: Remove outdated (gnu system grub) import., Danny Milosavljevic, 2017/07/03
- 197/197: installer: Use "G_" instead of "_"., Danny Milosavljevic, 2017/07/03
- 188/197: installer: Go back to main menu after "cancel",
Danny Milosavljevic <=
- 184/197: installer: Create dedicated module to maintainer the page stack., Danny Milosavljevic, 2017/07/03
- 126/197: installer: mount-points page: Enlarge the forms window., Danny Milosavljevic, 2017/07/03
- 96/197: installer: Changed N_ to M_ since N_ is used for another purpose in guix/ui.scm, Danny Milosavljevic, 2017/07/03
- 142/197: gurses: xchar->char: New procedure., Danny Milosavljevic, 2017/07/03
- 85/197: installer: Use "lspci -mm" instead of "lspci -m"., Danny Milosavljevic, 2017/07/03
- 88/197: installer: Use a cleaner method of detecting wireless capability for ethernet interfaces., Danny Milosavljevic, 2017/07/03
- 93/197: installer: Add a dedicated make to format filesystems., Danny Milosavljevic, 2017/07/03
- 100/197: installer: Do not perform tasks more than once., Danny Milosavljevic, 2017/07/03
- 106/197: installer: Properly handle swap partitions when generating the configuration., Danny Milosavljevic, 2017/07/03
- 114/197: installer: Check that swap spaces have not been assigned mount points, Danny Milosavljevic, 2017/07/03