From: espen Date: Fri, 17 Dec 2004 00:34:01 +0000 (+0000) Subject: Callback parameters to CREATE-ACTION and CREATE-TOGGLE-ACTION may now be lists X-Git-Tag: clg-0-90~167 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/clg/commitdiff_plain/966afe676395a5adba2c4e75fd28713ce871c025 Callback parameters to CREATE-ACTION and CREATE-TOGGLE-ACTION may now be lists --- diff --git a/gtk/gtkutils.lisp b/gtk/gtkutils.lisp index 388e352..020e60e 100644 --- a/gtk/gtkutils.lisp +++ b/gtk/gtkutils.lisp @@ -15,7 +15,7 @@ ;; License along with this library; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -;; $Id: gtkutils.lisp,v 1.4 2004/12/04 18:24:01 espen Exp $ +;; $Id: gtkutils.lisp,v 1.5 2004/12/17 00:34:01 espen Exp $ (in-package "GTK") @@ -97,7 +97,7 @@ (defun create-action (name &optional stock-id label accelerator tooltip :name (string name) :stock-id stock-id :label label :tooltip tooltip :accelerator accelerator initargs))) (when callback - (signal-connect action 'activate callback)) + (apply #'signal-connect action 'activate (mklist callback))) action)) (defun create-toggle-action (name &optional stock-id label accelerator @@ -107,10 +107,17 @@ (defun create-toggle-action (name &optional stock-id label accelerator :tooltip tooltip :active active :accelerator accelerator initargs))) (when callback - (signal-connect action 'activate - #'(lambda () - (funcall callback (toggle-action-active-p action)))) - (funcall callback active)) + (destructuring-bind (function &key object after) (mklist callback) + (signal-connect action 'activate + (if object + #'(lambda (object) + (funcall function object (toggle-action-active-p action))) + #'(lambda () + (funcall function (toggle-action-active-p action)))) + :object object :after after) + ;(funcall callback active) + (when active + (action-activate action)))) action)) (defun create-radio-actions (specs &optional active callback &rest initargs)