guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

05/20: installer: New procedure: page-enter.


From: John Darrington
Subject: 05/20: installer: New procedure: page-enter.
Date: Thu, 12 Jan 2017 20:41:03 +0000 (UTC)

jmd pushed a commit to branch wip-installer
in repository guix.

commit 0335e73589ef50dbbfdbc5fdcd55edf66e1c3d1b
Author: John Darrington <address@hidden>
Date:   Fri Jan 6 21:17:47 2017 +0100

    installer: New procedure: page-enter.
    
    * gnu/system/installer/page.scm (page-enter): New procedure.
    * gnu/system/installer/file-browser.scm,
    gnu/system/installer/filesystems.scm,
    gnu/system/installer/guixsd-installer.scm,
    gnu/system/installer/network.scm,
    gnu/system/installer/time-zone.scm,
    gnu/system/installer/wireless.scm: Use it where appropriate.
---
 gnu/system/installer/file-browser.scm     |    3 +--
 gnu/system/installer/filesystems.scm      |    7 ++-----
 gnu/system/installer/guixsd-installer.scm |    6 ++----
 gnu/system/installer/network.scm          |   11 ++++-------
 gnu/system/installer/page.scm             |    6 ++++++
 gnu/system/installer/time-zone.scm        |    3 +--
 gnu/system/installer/wireless.scm         |    4 +---
 7 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/gnu/system/installer/file-browser.scm 
b/gnu/system/installer/file-browser.scm
index e0af0ec..f07b97c 100644
--- a/gnu/system/installer/file-browser.scm
+++ b/gnu/system/installer/file-browser.scm
@@ -65,8 +65,7 @@
        (if (eq? 'directory (stat:type (stat new-dir)))
            (let ((p (make-file-browser
                      page new-dir)))
-             (set! page-stack (cons p page-stack))
-             ((page-refresh p) p))
+              (page-enter p))
            (begin
               (system* "loadkeys" i)
               (set! key-map i)
diff --git a/gnu/system/installer/filesystems.scm 
b/gnu/system/installer/filesystems.scm
index 9631e7e..011c6f3 100644
--- a/gnu/system/installer/filesystems.scm
+++ b/gnu/system/installer/filesystems.scm
@@ -183,9 +183,7 @@
                               mount-point-page-key-handler)))
 
        (page-set-datum! next 'device name)
-       (set! page-stack (cons next page-stack))
-       ((page-refresh next) next)
-       ))
+        (page-enter next)))
 
      ((buttons-key-matches-symbol? nav ch 'back)
       (page-leave))
@@ -195,8 +193,7 @@
       (let ((errstr (filesystem-task-incomplete-reason)))
         (if errstr
             (let ((next (make-dialog page errstr)))
-              (set! page-stack (cons next page-stack))
-              ((page-refresh next) next))
+              (page-enter next))
             (begin
               (page-leave))
             ))))
diff --git a/gnu/system/installer/guixsd-installer.scm 
b/gnu/system/installer/guixsd-installer.scm
index c1a1cd1..b73839d 100644
--- a/gnu/system/installer/guixsd-installer.scm
+++ b/gnu/system/installer/guixsd-installer.scm
@@ -168,8 +168,7 @@
               (p (make-file-browser
                   page keymap-directory
                   page-stack)))
-         (set! page-stack (cons p page-stack))
-         ((page-refresh p) p)))))))
+         (page-enter p)))))))
 
 (define (do-task task-name page)
   "Queue the task whose name is TASK-NAME and any dependencies"
@@ -263,8 +262,7 @@
                    stdscr (gettext "GuixSD Installer")
                    main-page-refresh main-page-key-handler)))
 
-        (set! page-stack (cons page page-stack))
-        ((page-refresh page) (car page-stack))
+        (page-enter page)
         (let loop ((ch (getch stdscr)))
           (let ((current-page (car page-stack)))
             ((page-key-handler current-page) current-page ch)
diff --git a/gnu/system/installer/network.scm b/gnu/system/installer/network.scm
index d59bbda..4607a1d 100644
--- a/gnu/system/installer/network.scm
+++ b/gnu/system/installer/network.scm
@@ -92,10 +92,9 @@
            (eq? 'wireless (assq-ref (menu-get-current-item menu) 'class)))
 
       (let ((next (make-wireless-page page (N_ "Wireless interface setup")
-                                   (assq-ref (menu-get-current-item menu) 
'name))))
-        (set! page-stack (cons next page-stack))
-        ((page-refresh next) next)))
-
+                                      (assq-ref (menu-get-current-item menu) 
'name))))
+        (page-enter next)))
+     
      ((select-key? ch)
       (let ((item (menu-get-current-item menu)))
         (when (eq? (assq-ref item 'class) 'ethernet)
@@ -107,9 +106,7 @@
                                "Ping"
                                ping-page-refresh
                                ping-page-key-handler)))
-
-              (set! page-stack (cons next page-stack))
-              ((page-refresh next) next)))
+          (page-enter next)))
 
      ((buttons-key-matches-symbol? nav ch 'continue)
 
diff --git a/gnu/system/installer/page.scm b/gnu/system/installer/page.scm
index 59361d1..aaae044 100644
--- a/gnu/system/installer/page.scm
+++ b/gnu/system/installer/page.scm
@@ -23,6 +23,7 @@
   #:export (page-refresh)
   #:export (page-initialised?)
   #:export (page-set-initialised!)
+  #:export (page-enter)
   #:export (page-leave)
   #:export (page-set-wwin!)
   #:export (page-wwin)
@@ -58,3 +59,8 @@
 (define* (page-leave #:optional (return-point #f))
   (set! page-stack
     (or return-point (cdr page-stack))))
+
+(define (page-enter p)
+  (set! page-stack (cons p page-stack))
+  ((page-refresh p) p))
+
diff --git a/gnu/system/installer/time-zone.scm 
b/gnu/system/installer/time-zone.scm
index 00f2858..8b676ff 100644
--- a/gnu/system/installer/time-zone.scm
+++ b/gnu/system/installer/time-zone.scm
@@ -70,8 +70,7 @@
                               (if (page-datum page 'stem)
                                   (string-append (page-datum page 'stem) "/" i)
                                   i))
-             (set! page-stack (cons p page-stack))
-             ((page-refresh p) p))
+              (page-enter p))
            (begin
              (set! time-zone
                (if (page-datum page 'stem)
diff --git a/gnu/system/installer/wireless.scm 
b/gnu/system/installer/wireless.scm
index dda9195..c1e42a0 100644
--- a/gnu/system/installer/wireless.scm
+++ b/gnu/system/installer/wireless.scm
@@ -78,9 +78,7 @@
                    (N_ "Passphrase entry")
                    (page-datum page 'ifce)
                    (assq-ref (menu-get-current-item menu) 'essid))))
-        (set! page-stack (cons next page-stack))
-        ((page-refresh next) next))))
-
+        (page-enter next))))
 
     (std-menu-key-handler menu ch)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]