X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=gtk%2Fgtk.assistant.lisp;h=013567a151e04c23d17f8777a96c8a6734b6fd4f;hb=e8e2d1cad48f9b6f1d607651f93cc51387c60216;hp=97fa483670c71d923468e8699c07820cdd512d25;hpb=443a49501d16653d96a884fc062c678ea1b59ead;p=cl-gtk2.git diff --git a/gtk/gtk.assistant.lisp b/gtk/gtk.assistant.lisp index 97fa483..013567a 100644 --- a/gtk/gtk.assistant.lisp +++ b/gtk/gtk.assistant.lisp @@ -25,39 +25,20 @@ (export 'assistant-insert-page) -(defcstruct assistant-page-func-ref - (object :pointer) - (fn-id :int)) - -(defcallback assistant-page-func-cb :int - ((current-page :int) (data :pointer)) - (let* ((object (convert-from-foreign (foreign-slot-value data 'assistant-page-func-ref 'object) '(g-object assistant))) - (fn-id (foreign-slot-value data 'assistant-page-func-ref 'fn-id)) - (fn (retrieve-handler-from-object object fn-id))) - (funcall fn current-page))) - -(defcallback assistant-page-func-destroy-notify-cb :void - ((data :pointer)) - (let* ((object (convert-from-foreign (foreign-slot-value data 'assistant-page-func-ref 'object) '(g-object assistant))) - (fn-id (foreign-slot-value data 'assistant-page-func-ref 'fn-id))) - (delete-handler-from-object object fn-id))) - (defcfun gtk-assistant-set-forward-page-func :void (assistant (g-object assistant)) (page-func :pointer) (data :pointer) (destroy-notify :pointer)) +(define-cb-methods assistant-page-func :int ((current-page :int))) + (defun set-assistant-forward-page-function (assistant function) (if function - (let ((ref (foreign-alloc 'assistant-page-func-ref)) - (fn-id (save-handler-to-object assistant function))) - (setf (foreign-slot-value ref 'assistant-page-func-ref 'object) - (pointer assistant) - (foreign-slot-value ref 'assistant-page-func-ref 'fn-id) - fn-id) - (gtk-assistant-set-forward-page-func assistant (callback assistant-page-func-cb) - ref (callback assistant-page-func-destroy-notify-cb))) + (gtk-assistant-set-forward-page-func assistant + (callback assistant-page-func-cb) + (create-fn-ref assistant function) + (callback assistant-page-func-destroy-notify)) (gtk-assistant-set-forward-page-func assistant (null-pointer) (null-pointer) (null-pointer)))) (defcfun (assistant-add-action-widget "gtk_assistant_add_action_widget") :void