Changeset 31086 in project for release/4/dbus/trunk/dbus.scm


Ignore:
Timestamp:
07/04/14 08:39:01 (6 years ago)
Author:
ecloud
Message:

default-signal-handler takes 5 args: bus path svc iface mber

However maybe it's a bad idea because a dbus_message has more stuff, so
the handler doesn't get enough info to actually handle the signal.
But what kind of interface is that even if it could? The idea is this
egg is to be a nice high-level abstraction, not a way of digging around
in the bowels of how libdbus does things. And if we pass the whole message
to this handler, it's a C object, so what if the handler tries to keep it
for too long. Have never addressed GC yet anyway.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/dbus/trunk/dbus.scm

    r31085 r31086  
    2121                unsupported-type-signature
    2222                default-signal-handler
     23                printing-signal-handler
     24                dump-callback-table
    2325
    2426                make-variant
     
    187189
    188190(define default-signal-handler (make-parameter #f))
     191
     192(define (printing-signal-handler #!optional port)
     193        (lambda (bus path svc iface mber)
     194                (let ([str (format "failed to find callback for ~a ~a ~a ~a on ~a~%" path svc iface mber (bus-name bus))])
     195                        (if port
     196                                (display str port)
     197                                (display str)))))
     198
     199(define dump-callback-table)
    189200
    190201(define-foreign-type error-ptr c-pointer) ;; DBusError*
     
    317328                                                (car rem-keys)
    318329                                                subtree )))))
     330
     331        (set! dump-callback-table (lambda ()
     332                (for-each (lambda (bus)
     333                        (printf "~a:~%" (bus-name (car bus)))
     334                        (if (cdr bus)
     335                                (for-each (lambda (path)
     336                                        (printf "   ~a~%" (car path))
     337                                        (for-each (lambda (iface)
     338                                                (printf "    ~a~%" (car iface)) (pp (cdr iface))) (cdr path)))
     339                                        (cdr bus))
     340                                (printf "   no callbacks registered~%")
     341                        ))
     342                        callbacks-table)))
    319343
    320344        (define (next-context-ID) (set! context-count (+ 1 context-count)) context-count)
     
    684708                                (unless ret
    685709                                        (when (default-signal-handler)
    686                                                 ((default-signal-handler) (format "failed to find callback for ~a ~a ~a ~a on ~a" path svc iface mber (bus-name bus)))))
    687                                 ret
    688                         ))))
     710                                                ((default-signal-handler) bus path svc iface mber)))
     711                                ret))))
    689712
    690713        (set! make-context (lambda (#!key (bus session-bus) service interface (path "/"))
Note: See TracChangeset for help on using the changeset viewer.