chiark / gitweb /
atoms.lisp: Rewrite `update-undo-redo-sensitivity'.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 22 Mar 2013 22:54:09 +0000 (22:54 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 22 Mar 2013 22:54:09 +0000 (22:54 +0000)
Less duplication, and no hideous line-breaks.

atoms.lisp

index af9a21c..c68a667 100644 (file)
@@ -1000,12 +1000,11 @@ (defun action-new-game (window)
 
 (defun update-undo-redo-sensitivity (window)
   (with-slots (actions game) window
-    (setf (gtk:action-sensitive-p
-          (gtk:action-group-get-action actions "undo"))
-         (undo-list game)
-         (gtk:action-sensitive-p
-          (gtk:action-group-get-action actions "redo"))
-         (redo-list game))))
+    (flet ((set-sensitive (act-name sensitivep)
+            (let ((act (gtk:action-group-get-action actions act-name)))
+              (setf (gtk:action-sensitive-p act) sensitivep))))
+      (set-sensitive "undo" (undo-list game))
+      (set-sensitive "redo" (redo-list game)))))
 
 (defmethod notify progn
     ((window atom-game-window) (game atom-game) aspect &key)