X-Git-Url: https://git.distorted.org.uk/~mdw/clg/blobdiff_plain/fd1e4a399fc26f5a40c2e7fe705aa7d9aa56e7b1..a8cb9408e054abf38cc2777ed133e002fffc9a46:/glib/gcallback.lisp diff --git a/glib/gcallback.lisp b/glib/gcallback.lisp index 5255221..ca406e9 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.14 2004-11-07 16:04:21 espen Exp $ +;; $Id: gcallback.lisp,v 1.16 2004-12-05 13:54:10 espen Exp $ (in-package "GLIB") @@ -78,24 +78,38 @@ ;;;; Timeouts and idle functions +(defconstant +priority-high+ -100) +(defconstant +priority-default+ 0) +(defconstant +priority-high-idle+ 100) +(defconstant +priority-default-idle+ 200) +(defconstant +priority-low+ 300) + +(defbinding source-remove () boolean + (tag unsigned-int)) + (defcallback source-callback-marshal (nil (callback-id unsigned-int)) (callback-trampoline callback-id 0 nil (make-pointer 0))) (defbinding (timeout-add "g_timeout_add_full") - (function interval &optional (priority 0)) unsigned-int + (interval function &optional (priority +priority-default+)) unsigned-int (priority int) (interval unsigned-int) - (*source-callback-marshal* pointer) + ((callback source-callback-marshal) pointer) ((register-callback-function function) unsigned-long) ((callback %destroy-user-data) pointer)) +(defun timeout-remove (timeout) + (source-remove timeout)) + (defbinding (idle-add "g_idle_add_full") - (function &optional (priority 0)) unsigned-int + (function &optional (priority +priority-default-idle+)) unsigned-int (priority int) - (*source-callback-marshal* pointer) + ((callback source-callback-marshal) pointer) ((register-callback-function function) unsigned-long) ((callback %destroy-user-data) pointer)) +(defun idle-remove (idle) + (source-remove idle)) ;;;; Signals @@ -159,16 +173,17 @@ is T, the object connected to is passed as the first argument to the callback function, or if :OBJECT is any other non NIL value, it is passed as the first argument instead. If :AFTER is non NIL, the handler will be called after the - default handler of the signal." - (let ((callback-id - (make-callback-closure - (cond - ((or (eq object t) (eq object gobject)) function) - ((not object) - #'(lambda (&rest args) (apply function (cdr args)))) - (t - #'(lambda (&rest args) (apply function object (rest args)))))))) - (signal-connect-closure gobject signal callback-id :after after))) + default handler for the signal." + (when function + (let ((callback-id + (make-callback-closure + (cond + ((or (eq object t) (eq object gobject)) function) + ((not object) + #'(lambda (&rest args) (apply function (cdr args)))) + (t + #'(lambda (&rest args) (apply function object (rest args)))))))) + (signal-connect-closure gobject signal callback-id :after after)))) ;;; Message logging