How to know when D-Bus interfaces and methods are available

Kevin Krammer kevin.krammer at gmx.at
Wed Aug 5 09:09:40 BST 2009


On Wednesday, 2009-08-05, Thiago Macieira wrote:
> David Jarvie wrote:
> >There has been some discussion on the kde-pim list about how to
> > successfully call D-Bus methods immediately after starting an
> > application. The problem is that initially, only the D-Bus service for
> > the application exists, and it is necessary to wait until first its
> > interfaces and then its methods are ready to be used. Unfortunately
> > there seems to be no clean way to know when the D-Bus methods are ready
> > to be called.
> >
> >As pointed out by Ingo Klöcker, this is likely to be a problem
> > encountered by others, so I'm forwarding the discussion to core-devel.
>
> The solution is simple:
>
> Don't register the service name until your objects are set up. Or, at the
> latest, make sure that they will be created before the next event loop
> run.
>
> That's Thomas's solution. It's the correct way to go.

What about dynamically created objects, e.g. something created later on as a 
result of a resource becoming available or a user interaction?

How about creating a QDBusInterface without specifying an object path and let 
the adapter emit a signal with the object path. Then creating a QDBusInterface 
for that specific object.

Cheers,
Kevin
-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090805/3a1dd1af/attachment.sig>


More information about the kde-core-devel mailing list