Convenience API for unique apps

Mike Hearn mike at navi.cx
Wed Jul 21 16:58:44 PDT 2004


Hi,

A common use case for activation systems is to make apps single
instance.

It would be nice if libdbus had a simple API to automate this common
task.
For instance:

DBusConnection *connection =
dbus_exit_if_not_unique("org.myprogram.myprogram");

Which connects to the bus, checks if the given service name has been
acquired and disconnects + exit(0) if so, otherwise it's up to you to
release the connection.

Avoiding the need to have magic files and lots of boilerplate code would
be a useful thing, I think. I know this isn't really a part of the DBUS
core
mission but as it'd be simple code and commonly used IMHO it should be a
part 
of libdbus anyway.

Writing it wouldn't be hard but if nobody has time I can try my hand at
a patch.

thanks -mike



More information about the dbus mailing list