atoms.lisp: Rewrite `update-undo-redo-sensitivity'.
[atoms] / atoms.lisp
index eac69bc..c68a667 100644 (file)
          (unless (cell-played cell player-index)
            (return-from escape))
          (setf (player-state player) :playing)
-         (changed game :processing-move)
-         (perform-explosions game (list cell)))))))
+         (changed game :processing-move))
+       (perform-explosions game (list cell))))))
 
 (defmethod restart-game ((game atom-game) &key grid players)
   (game-cancel-timeout game)
 
 (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)
   (case aspect
-    ((:undo :redo :refresh :processing-move)
+    ((:undo :redo :refresh :start-turn)
      (update-undo-redo-sensitivity window))))
 
 (defun action-undo (window)