how to be notified when an application with dbus service lauchs or quits?
cbx
bnucbx at gmail.com
Sat Sep 12 20:52:04 PDT 2009
Yeah.Till now things seem to be fine:-)
I will let you know if some problem occurs.
On Sat, Sep 12, 2009 at 8:48 PM, Kaustubh Atrawalkar
<kaustubh.ra at gmail.com>wrote:
> You are welcome cbx. I was about to write a program for you :)
> Anyway, let me know if u stuck somewhere still.
>
> --
> Regards
> Kaustubh
>
>
>
> On Sat, Sep 12, 2009 at 6:15 PM, cbx <bnucbx at gmail.com> wrote:
>
>> I got it!
>> I use the wrong object path, so i can't get the signal
>> the correct one is /org/freedesktop/DBus,as follows
>> proxy = sessionBus.get_object('org.freedesktop.DBus',
>> '/org/freedesktop/DBus')
>>
>> Thank you!
>>
>>
>>
>> _______________________________
>> quoted text:
>>
>> Thanks.Maybe i don't totally get what you mean.
>> i tried the following code.When rhythmbox lauches or quits,nothing is
>> printed.
>> Code in python:
>>
>> import dbus
>> from dbus.mainloop.glib import DBusGMainLoop
>> import gobject
>> import glib
>>
>> class Test:
>> def __init__(self):
>> DBusGMainLoop(set_as_default=
>> True)
>> sessionBus = dbus.SessionBus()
>>
>> proxy = sessionBus.get_object('org.freedesktop.DBus',
>> '/')#this object path is wrong
>> self.interface = dbus.Interface(proxy,
>> 'org.freedesktop.DBus')
>> self.interface.connect_to_signal('NameOwnerChanged',
>> self.callback)
>>
>> gobject.MainLoop().run()
>>
>> def callback(self, s1, s2, s3):
>> print s1, s2, s3
>>
>> if __name__ == '__main__':
>> Test()
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20090913/b205f063/attachment.htm
More information about the dbus
mailing list