chiark / gitweb /
Renamed to ff.lisp
[clg] / glib / gcallback.lisp
index a5751476c53500d2423db7caeee0116ec4b04434..27f6fbcf6b36f98c3d0ff9e59243c1074683a93f 100644 (file)
@@ -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
 
 ;; 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.6 2002/03/19 17:09:15 espen Exp $
+;; $Id: gcallback.lisp,v 1.9 2004/10/27 14:58:59 espen Exp $
 
 (in-package "GLIB")
 
 
 (in-package "GLIB")
 
@@ -54,7 +54,7 @@ (defun callback-trampoline (callback-id params return-value)
                   (unwind-protect
                       (let ((result (apply callback-function (reverse args))))
                         (when return-type
                   (unwind-protect
                       (let ((result (apply callback-function (reverse args))))
                         (when return-type
-                          (gvalue-set (print return-value) result))))
+                          (gvalue-set return-value result))))
                
                 (continue nil :report "Return from callback function"
                  (when return-type
                
                 (continue nil :report "Return from callback function"
                  (when return-type
@@ -105,9 +105,6 @@ (defbinding (idle-add "g_idle_add_full")
 
 ;;;; Signals
 
 
 ;;;; Signals
 
-(defun signal-name-to-string (name)
-  (substitute #\_ #\- (string-downcase (string name))))
-
 (defbinding signal-lookup (name itype) unsigned-int
   ((signal-name-to-string name) string)
   (itype type-number))
 (defbinding signal-lookup (name itype) unsigned-int
   ((signal-name-to-string name) string)
   (itype type-number))
@@ -162,18 +159,18 @@ (defbinding signal-handler-disconnect () nil
   (handler unsigned-int))
 
 
   (handler unsigned-int))
 
 
-(defmethod signal-connect ((gobject gobject) signal function &rest args &key after object)
-  (declare (ignore signal args after))
-  (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))))))
-
-
-(defmethod signal-connect :around ((gobject gobject) signal function
-                                  &key after object)
-  (declare (ignore object))
-  (let ((callback-id (make-callback-closure (call-next-method))))
+(defmethod signal-connect ((gobject gobject) signal function &key after object)
+"Connects a callback function to a signal for a particular object. If :OBJECT 
+ 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)))
     (signal-connect-closure gobject signal callback-id :after after)))