Matching signals in Python

Robert McQueen robert.mcqueen at collabora.co.uk
Mon Apr 17 09:22:35 PDT 2006


Include dbus.glib in your program. Whoever fixes and completes the
attached patch to warn people when they make this mistake (*everyone
does*) will receive several beers (or equivalent) from me at the next
conference or pub they find me at. :)

Regards,
Rob

Sam Morris wrote:
> I'm trying to write a simple python program to listen for Evolution's new
> mail signal. The code I have is as follows:
> 
> ---
> import gobject
> import dbus
> 
> def print_mail (mailbox):
> 	print 'mail: ', mailbox
> 
> bus = dbus.SessionBus ()
> bus.add_signal_receiver (print_mail,
>                          signal_name='Newmail',
>                          dbus_interface='org.gnome.evolution.mail.dbus.Signal')
> 
> loop = gobject.MainLoop ()
> loop.run ()
> ---
> 
> But print_mail is never called. The messages going over the bus look like
> this:
> 
> signal sender=:1.24 -> dest=(null destination)
> interface=org.gnome.evolution.mail.dbus.Signal; member=Newmail
>  string "spool:///var/mail/sam#INBOX"
> 
> This is with Dbus 0.61. Could someone please point me in the right
> direction?
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: require-mainloop.patch
Type: text/x-patch
Size: 6479 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20060417/765b03f4/require-mainloop.bin


More information about the dbus mailing list