diff options
author | John (J5) Palmieri <johnp@redhat.com> | 2005-09-26 18:49:53 +0000 |
---|---|---|
committer | John (J5) Palmieri <johnp@redhat.com> | 2005-09-26 18:49:53 +0000 |
commit | 1c2ef37f3522d47bcbe5a835d26178445b50b2e8 (patch) | |
tree | 2afd7a22c27b16911f0a1cbd982f2526f9ef0aaa | |
parent | f82a49e829b99904e6394747975ab876e05d7c28 (diff) |
* Integrate patches from Lennart Poettering <mzsqb at 0pointer.de>:
- dbus/dbus-bus.c
(internal_bus_get): new method that take over the heavy lifting
of dbus_bus_get and adds the ability to get a private connection
to the bus
(dbus_bus_get): wrapper to internal_bus_get that provides the same
interface as in previous versions
(dbus_bus_get_private): new method that is a wrapper to
internal_bus_get to get a private connection to the bus
- dbus/dbus-bus.h
(dbus_bus_get_private): add as a public libdbus interface
- dbus-1.pc.in: output system_bus_default_address and
sysconfdir variables so apps can use them when compiling
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | dbus-1.pc.in | 2 | ||||
-rw-r--r-- | dbus/dbus-bus.c | 75 | ||||
-rw-r--r-- | dbus/dbus-bus.h | 3 |
4 files changed, 74 insertions, 24 deletions
@@ -1,3 +1,21 @@ +2005-09-26 John (J5) Palmieri <johnp@redhat.com> + + * Integrate patches from Lennart Poettering <mzsqb at 0pointer.de>: + - dbus/dbus-bus.c + (internal_bus_get): new method that take over the heavy lifting + of dbus_bus_get and adds the ability to get a private connection + to the bus + (dbus_bus_get): wrapper to internal_bus_get that provides the same + interface as in previous versions + (dbus_bus_get_private): new method that is a wrapper to + internal_bus_get to get a private connection to the bus + + - dbus/dbus-bus.h + (dbus_bus_get_private): add as a public libdbus interface + + - dbus-1.pc.in: output system_bus_default_address and + sysconfdir variables so apps can use them when compiling + 2005-09-23 Harald Fernengel <harry@kdevelop.org> * dbus/qt: New Qt bindings diff --git a/dbus-1.pc.in b/dbus-1.pc.in index 1b535ba..e243ec9 100644 --- a/dbus-1.pc.in +++ b/dbus-1.pc.in @@ -2,6 +2,8 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ +system_bus_default_address=@DBUS_SYSTEM_BUS_DEFAULT_ADDRESS@ +sysconfdir=@EXPANDED_SYSCONFDIR@ Name: dbus Description: Free desktop message bus diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c index bc9ebfb..107fde9 100644 --- a/dbus/dbus-bus.c +++ b/dbus/dbus-bus.c @@ -302,27 +302,9 @@ ensure_bus_data (DBusConnection *connection) return bd; } -/** @} */ /* end of implementation details docs */ - -/** - * @addtogroup DBusBus - * @{ - */ - -/** - * Connects to a bus daemon and registers the client with it. If a - * connection to the bus already exists, then that connection is - * returned. Caller owns a reference to the bus. - * - * @todo alex thinks we should nullify the connection when we get a disconnect-message. - * - * @param type bus type - * @param error address where an error can be returned. - * @returns a DBusConnection with new ref - */ -DBusConnection * -dbus_bus_get (DBusBusType type, - DBusError *error) +static DBusConnection * +internal_bus_get (DBusBusType type, + DBusError *error, dbus_bool_t private) { const char *address; DBusConnection *connection; @@ -356,7 +338,7 @@ dbus_bus_get (DBusBusType type, bus_connection_addresses[activation_bus_type] != NULL) type = activation_bus_type; - if (bus_connections[type] != NULL) + if (!private && bus_connections[type] != NULL) { connection = bus_connections[type]; dbus_connection_ref (connection); @@ -374,7 +356,10 @@ dbus_bus_get (DBusBusType type, return NULL; } - connection = dbus_connection_open (address, error); + if (private) + connection = dbus_connection_open_private(address, error); + else + connection = dbus_connection_open (address, error); if (!connection) { @@ -399,7 +384,9 @@ dbus_bus_get (DBusBusType type, return NULL; } - bus_connections[type] = connection; + if (!private) + bus_connections[type] = connection; + bd = ensure_bus_data (connection); _dbus_assert (bd != NULL); @@ -410,6 +397,46 @@ dbus_bus_get (DBusBusType type, } +/** @} */ /* end of implementation details docs */ + +/** + * @addtogroup DBusBus + * @{ + */ + +/** + * Connects to a bus daemon and registers the client with it. If a + * connection to the bus already exists, then that connection is + * returned. Caller owns a reference to the bus. + * + * @todo alex thinks we should nullify the connection when we get a disconnect-message. + * + * @param type bus type + * @param error address where an error can be returned. + * @returns a DBusConnection with new ref + */ +DBusConnection * +dbus_bus_get (DBusBusType type, + DBusError *error) { + return internal_bus_get(type, error, FALSE); +} + +/** + * Connects to a bus daemon and registers the client with it. Unlike + * dbus_bus_get(), always creates a new connection. This connection + * will not be saved or recycled by libdbus. Caller owns a reference + * to the bus. + * + * @param type bus type + * @param error address where an error can be returned. + * @returns a DBusConnection with new ref + */ +DBusConnection * +dbus_bus_get_private (DBusBusType type, + DBusError *error) { + return internal_bus_get(type, error, TRUE); +} + /** * Registers a connection with the bus. This must be the first * thing an application does when connecting to the message bus. diff --git a/dbus/dbus-bus.h b/dbus/dbus-bus.h index 7843c7e..2447067 100644 --- a/dbus/dbus-bus.h +++ b/dbus/dbus-bus.h @@ -33,6 +33,9 @@ DBUS_BEGIN_DECLS DBusConnection *dbus_bus_get (DBusBusType type, DBusError *error); +DBusConnection *dbus_bus_get_private (DBusBusType type, + DBusError *error); + dbus_bool_t dbus_bus_register (DBusConnection *connection, DBusError *error); dbus_bool_t dbus_bus_set_unique_name (DBusConnection *connection, |