guix-commits
[Top][All Lists]
Advanced

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

01/01: installer: Use default event handlers for "filesystem" page.


From: Danny Milosavljevic
Subject: 01/01: installer: Use default event handlers for "filesystem" page.
Date: Tue, 4 Jul 2017 18:59:28 -0400 (EDT)

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

commit 10bc011416859a1d2390061a2a3891f00dfe8495
Author: Danny Milosavljevic <address@hidden>
Date:   Wed Jul 5 00:57:48 2017 +0200

    installer: Use default event handlers for "filesystem" page.
    
    * gnu/system/installer/filesystems.scm (filesystem-page-mouse-handler): 
Delete
    variable.
    (filesystem-page-key-handler): Delete variable.
    (make-filesystem-page): Use default event handlers.
---
 gnu/system/installer/filesystems.scm | 101 ++++++++++-------------------------
 1 file changed, 29 insertions(+), 72 deletions(-)

diff --git a/gnu/system/installer/filesystems.scm 
b/gnu/system/installer/filesystems.scm
index 66c3755..7881e3a 100644
--- a/gnu/system/installer/filesystems.scm
+++ b/gnu/system/installer/filesystems.scm
@@ -131,13 +131,10 @@
              title
              filesystem-page-refresh
              0
-             filesystem-page-key-handler
-             filesystem-page-mouse-handler))
+             #:activator filesystem-page-activate-focused-item))
 
 (define my-buttons `((continue ,(M_ "_Continue") #t)
-                    (cancel     ,(M_ "Canc_el") #t)))
-
-
+                     (cancel     ,(M_ "Canc_el") #t)))
 
 (define (filesystem-page-refresh page)
   (when (not (page-initialised? page))
@@ -173,73 +170,33 @@
      p)))
 
 (define (filesystem-page-activate-focused-item page)
-  (let* ((menu (page-datum page 'menu))
-         (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
-                           mount-point-page-mouse-handler)))
-
-    (page-set-datum! next 'device name)
-    (page-enter next)))
-
-(define (filesystem-page-mouse-handler page device-id x y z button-state)
-  (let* ((menu (page-datum page 'menu))
-         (status (std-menu-mouse-handler menu device-id x y z button-state)))
-    (if (eq? status 'activated)
-      (filesystem-page-activate-focused-item page))
-    status))
-
-(define (filesystem-page-key-handler page ch)
-  (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))
-
-                ((select-key? ch)
-                 (filesystem-page-activate-focused-item page))
-
-                ((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))
+  (let* ((menu (page-datum page 'menu)))
+    (cond
+      ((menu-active menu)
+       (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
+                                #:activator 
mount-point-page-activate-focused-item)))
+         (page-set-datum! next 'device name)
+         (page-enter next)
+         'handled))
+      (else ; buttons
+        (match (buttons-selected-symbol (page-datum page 'navigation))
+          ('cancel
+           (page-leave)
+           'cancelled)
+          ('continue
+           (let ((errstr (filesystem-task-incomplete-reason)))
+                 (if errstr
+                   (let ((next (make-dialog page errstr)))
+                     (page-enter next))
+                     (page-leave)))
+           'handled)
+          (_ 'ignored))))))
 
 (define (filesystem-page-init p)
   (let* ((s (page-surface p))



reply via email to

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