Question on C code - any programmatic way of setting DBUS_BUS_SESSION address?
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Apr 23 04:18:57 PDT 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, 23 Apr 2008 at 08:58:58 +0300, Andrejus Chaliapinas wrote:
> dbus_bus_get (DBusBusType type,
> const char* address,
> DBusError *error)
If you want to connect to a bus at a non-standard address, you shouldn't
be using "the" shared session-bus connection as returned by dbus_bus_get.
dbus_bus_get sets up and returns a shared connection - just because *you*
want to connect to a non-standard address for the session bus doesn't mean
that any other libraries or components in your process want to do the same.
For a bus at a non-standard location, instead of calling dbus_bus_get(), use
dbus_connection_open() (or possibly dbus_connection_open_private()) followed
by dbus_bus_register().
If you really do want to manipulate the global state of your process
(this is only appropriate if you are writing the program, rather than a
library), manipulate the environment before any D-Bus API is called
(e.g. in main() or in a wrapper script).
Simon
-----BEGIN PGP SIGNATURE-----
iD8DBQFIDxshWSc8zVUw7HYRAr56AJ4oQMdoen55DrhO0FHCPFA97XKhdgCgzs3R
gjA9XJVxrlZ7mIHycCL8ikM=
=xxTf
-----END PGP SIGNATURE-----
More information about the dbus
mailing list