reserve: update reserve.[ch] from upstream git

This commit is contained in:
Lennart Poettering 2009-06-05 19:00:12 +02:00
parent 3e10f3f4e3
commit 1748fd2a0d
2 changed files with 9 additions and 15 deletions

View file

@ -43,16 +43,15 @@ struct rd_device {
DBusConnection *connection;
int owning:1;
int registered:1;
int filtering:1;
int gave_up:1;
unsigned owning:1;
unsigned registered:1;
unsigned filtering:1;
unsigned gave_up:1;
rd_request_cb_t request_cb;
void *userdata;
};
#define SERVICE_PREFIX "org.freedesktop.ReserveDevice1."
#define OBJECT_PREFIX "/org/freedesktop/ReserveDevice1/"
@ -297,6 +296,7 @@ static DBusHandlerResult filter_handler(
dbus_error_init(&error);
d = userdata;
assert(d->ref >= 1);
if (dbus_message_is_signal(m, "org.freedesktop.DBus", "NameLost")) {
const char *name;
@ -560,7 +560,7 @@ void rd_release(
assert(d->ref > 0);
if (--d->ref)
if (--d->ref > 0)
return;
@ -575,17 +575,11 @@ void rd_release(
d->connection,
d->object_path);
if (d->owning) {
DBusError error;
dbus_error_init(&error);
if (d->owning)
dbus_bus_release_name(
d->connection,
d->service_name,
&error);
dbus_error_free(&error);
}
NULL);
free(d->device_name);
free(d->application_name);

View file

@ -45,7 +45,7 @@ typedef int (*rd_request_cb_t)(
* the error was caused D-Bus. */
int rd_acquire(
rd_device **d, /* On success a pointer to the newly allocated rd_device object will be filled in here */
DBusConnection *connection,
DBusConnection *connection, /* Session bus (when D-Bus learns about user busses we should switchg to user busses) */
const char *device_name, /* The device to lock, e.g. "Audio0" */
const char *application_name, /* A human readable name of the application, e.g. "PulseAudio Sound Server" */
int32_t priority, /* The priority for this application. If unsure use 0 */