guix-commits
[Top][All Lists]
Advanced

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

01/01: installer: Handle mouse in "passphrase" page.


From: Danny Milosavljevic
Subject: 01/01: installer: Handle mouse in "passphrase" page.
Date: Wed, 12 Jul 2017 20:32:45 -0400 (EDT)

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

commit 111701a04be0a289b5261eded1d62c7e8b323022
Author: Danny Milosavljevic <address@hidden>
Date:   Thu Jul 13 02:31:37 2017 +0200

    installer: Handle mouse in "passphrase" page.
    
    * gnu/system/installer/passphrase.scm (passphrase-mouse-handler): Delete
    variable.
    (passphrase-key-handler): Delete variable.
    (passphrase-activate-item): New variable.
    (make-passphrase-page): Use it here.
---
 gnu/system/installer/passphrase.scm | 50 +++++++++++--------------------------
 1 file changed, 15 insertions(+), 35 deletions(-)

diff --git a/gnu/system/installer/passphrase.scm 
b/gnu/system/installer/passphrase.scm
index 8a9bd86..44e15e8 100644
--- a/gnu/system/installer/passphrase.scm
+++ b/gnu/system/installer/passphrase.scm
@@ -42,8 +42,7 @@
                     title
                     passphrase-refresh
                     1
-                    passphrase-key-handler
-                    passphrase-mouse-handler)))
+                    #:activator passphrase-activate-item)))
     (page-set-datum! page 'access-point access-point)
     (page-set-datum! page 'ifce ifce)
     page))
@@ -63,42 +62,23 @@
       (format #f "Enter the passphrase for the network ~a."
               (assq-ref access-point 'essid))))))
 
-(define (passphrase-mouse-handler page device-id x y z button-state)
-  'ignored)
-
-(define (passphrase-key-handler page ch)
-  (let ((form  (page-datum page 'form))
-        (nav   (page-datum page 'navigation))
-        (access-point (page-datum page 'access-point))
-        (dev   (page-datum page 'device)))
-
-    (cond
-     ((buttons-key-matches-symbol? nav ch 'cancel)
-      (page-leave))
-
-     ((eq? ch #\tab)
-      (form-set-enabled! form #f)
-      (buttons-select-next nav))
-
-     ((eq? ch KEY_UP)
-      (buttons-unselect-all nav)
-      (form-set-enabled! form #t))
-
-     ((eq? ch KEY_DOWN)
-      (buttons-unselect-all nav)
-      (form-set-enabled! form #t))
-
-     ((select-key? ch)
+(define (passphrase-activate-item page item)
+  (match item
+   ('cancel
+    (page-leave)
+    'handled)
+   ('default
+    (let ((access-point (page-datum page 'access-point))
+          (form (page-datum page 'form)))
       (wireless-connect
        (page-datum page 'ifce)
        access-point
-       (form-get-value form 'passphrase))
-      (page-pop)
-      (page-leave))
-
-     (else
-      (form-enter form ch)))
-    #f))
+       (form-get-value form 'passphrase)))
+    (page-pop)
+    (page-leave)
+    'handled)
+   (_
+    'ignored)))
 
 (define my-buttons `((cancel ,(M_ "Cancel") #f)))
 



reply via email to

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