guix-commits
[Top][All Lists]
Advanced

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

01/01: installer: Make the timezone selector nicer.


From: Danny Milosavljevic
Subject: 01/01: installer: Make the timezone selector nicer.
Date: Wed, 5 Jul 2017 06:36:30 -0400 (EDT)

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

commit 6998c5cfe23abbe879857bd1caf5b6c90f14b3b7
Author: Danny Milosavljevic <address@hidden>
Date:   Wed Jul 5 12:35:19 2017 +0200

    installer: Make the timezone selector nicer.
    
    * gnu/system/installer/time-zone.scm (time-zone-page-init): Modify.
---
 gnu/system/installer/time-zone.scm | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/gnu/system/installer/time-zone.scm 
b/gnu/system/installer/time-zone.scm
index e2aa0e2..3f2f622 100644
--- a/gnu/system/installer/time-zone.scm
+++ b/gnu/system/installer/time-zone.scm
@@ -24,6 +24,8 @@
   #:use-module (gurses menu)
   #:use-module (gurses buttons)
   #:use-module (ncurses curses)
+  #:use-module (ice-9 ftw)
+  #:use-module (ice-9 match)
 
   #:export (make-tz-browser))
 
@@ -100,22 +102,20 @@
                              (getmaxx (inner frame))
                              (getmaxy text-window) 0 #:panel #f))
 
-        (menu (make-menu
-               (let nn ((ds (opendir (page-datum p 'directory)))
-                        (ll '()))
-                 (let ((o (readdir ds)))
-                   (if (eof-object? o)
-                       (begin
-                         (closedir ds)
-                         (sort ll string< ))
-                       (nn ds
-                           (cond
-                            ((equal? "." o) ll)
-                            ((equal? ".." o) ll)
-                            ((>= (string-suffix-length o ".tab") 4) ll)
-                            (else
-                             (cons o ll)))))))))
-        )
+         (menu (make-menu
+                (let* ((dir (page-datum p 'directory))
+                       (all-names (scandir dir))
+                       (useful-names (filter (lambda (name)
+                                               (and
+                                                 (not (string=? "." name))
+                                                 (not (string-suffix? ".tab" 
name))))
+                                             all-names))
+                       (marked-useful-names (map (lambda (name)
+                                                   (match (stat:type (stat 
(string-append dir "/" name)))
+                                                    ('directory (string-append 
name "/"))
+                                                    (_ name)))
+                                                 useful-names)))
+                  (sort marked-useful-names string<)))))
 
     (menu-post menu menu-window)
 



reply via email to

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