X-Git-Url: https://git.distorted.org.uk/~mdw/clg/blobdiff_plain/3b8e5eb03e50ab6c83407de042c1134bf3702484..ff8fa451e6afb4e223240b34836c0d8a5a5b8f4b:/glib/gcallback.lisp diff --git a/glib/gcallback.lisp b/glib/gcallback.lisp index 66fd169..23fa0bd 100644 --- a/glib/gcallback.lisp +++ b/glib/gcallback.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: gcallback.lisp,v 1.17 2005/01/03 16:37:16 espen Exp $ +;; $Id: gcallback.lisp,v 1.21 2005/02/14 00:41:54 espen Exp $ (in-package "GLIB") @@ -28,9 +28,6 @@ (check-type function (or null symbol function)) (register-user-data function)) -(defcallback %destroy-user-data (nil (id unsigned-int)) - (destroy-user-data id)) - ;; Callback marshal for regular signal handlers (defcallback closure-marshal (nil (gclosure pointer) @@ -92,7 +89,7 @@ (interval unsigned-int) ((callback source-callback-marshal) pointer) ((register-callback-function function) unsigned-long) - ((callback %destroy-user-data) pointer)) + ((callback user-data-destroy-func) pointer)) (defun timeout-remove (timeout) (source-remove timeout)) @@ -102,7 +99,7 @@ (priority int) ((callback source-callback-marshal) pointer) ((register-callback-function function) unsigned-long) - ((callback %destroy-user-data) pointer)) + ((callback user-data-destroy-func) pointer)) (defun idle-remove (idle) (source-remove idle)) @@ -203,7 +200,7 @@ (detail quark) ((callback signal-emission-hook) pointer) ((register-callback-function function) unsigned-int) - ((callback %destroy-user-data) pointer)) + ((callback user-data-destroy-func) pointer)) (defbinding signal-remove-emission-hook (type signal hook-id) nil ((ensure-signal-id-from-type signal type) unsigned-int) @@ -215,7 +212,7 @@ (instance ginstance) ((ensure-signal-id signal-id instance) unsigned-int) ((or detail 0) quark) - (may-be-blocked boolean)) + (blocked boolean)) (defbinding %signal-connect-closure-by-id () unsigned-int (instance ginstance) @@ -240,7 +237,9 @@ (instance ginstance) (handler-id unsigned-int)) -(defbinding (callback-closure-new "clg_callback_closure_new") () pointer +(deftype gclosure () 'pointer) + +(defbinding (callback-closure-new "clg_callback_closure_new") () gclosure (callback-id unsigned-int) (callback pointer) (destroy-notify pointer)) @@ -250,9 +249,11 @@ (values (callback-closure-new callback-id (callback closure-marshal) - (callback %destroy-user-data)) + (callback user-data-destroy-func)) callback-id))) +(defgeneric create-callback-function (gobject function arg1)) + (defmethod create-callback-function ((gobject gobject) function arg1) (cond ((or (eq arg1 t) (eq arg1 gobject)) function) @@ -261,6 +262,8 @@ (t #'(lambda (&rest args) (apply function arg1 (rest args)))))) +(defgeneric signal-connect (gobject signal function &key)) + (defmethod signal-connect ((gobject gobject) signal function &key (detail 0) after object remove) "Connects a callback function to a signal for a particular object. If @@ -344,19 +347,6 @@ once." (apply #'signal-emit-with-detail object signal 0 args)) - -;;; Message logging - -;; TODO: define and signal conditions based on log-level - -(def-callback log-handler (c-call:void (domain c-call:c-string) - (log-level c-call:int) - (message c-call:c-string)) - (error "~A: ~A" domain message)) - -(setf (extern-alien "log_handler" system-area-pointer) (callback log-handler)) - - ;;;; Convenient macros (defmacro def-callback-marshal (name (return-type &rest args))