diff -urN dbus-glib-0.82-orig/dbus/dbus-glib.h dbus-glib-0.82-patched/dbus/dbus-glib.h --- dbus-glib-0.82-orig/dbus/dbus-glib.h 2009-09-04 12:47:36.000000000 -0400 +++ dbus-glib-0.82-patched/dbus/dbus-glib.h 2009-09-04 13:09:07.000000000 -0400 @@ -105,6 +105,9 @@ GError **error); DBusGConnection* dbus_g_bus_get (DBusBusType type, GError **error); +DBusGConnection* dbus_g_bus_get_private (DBusBusType type, + GError **error); + typedef struct _DBusGObjectInfo DBusGObjectInfo; typedef struct _DBusGMethodInfo DBusGMethodInfo; diff -urN dbus-glib-0.82-orig/dbus/dbus-gmain.c dbus-glib-0.82-patched/dbus/dbus-gmain.c --- dbus-glib-0.82-orig/dbus/dbus-gmain.c 2009-09-04 12:47:36.000000000 -0400 +++ dbus-glib-0.82-patched/dbus/dbus-gmain.c 2009-09-04 16:48:55.000000000 -0400 @@ -765,6 +765,47 @@ return DBUS_G_CONNECTION_FROM_CONNECTION (connection); } +/** + * dbus_g_bus_get_private: + * @type: bus type + * @error: address where an error can be returned. + * + * Returns a new, private connection to the given bus. The the + * creater of this connection must call dbus_connection_close() + * before releasing the last reference. + * + * (Internally, calls dbus_bus_get() then calls + * dbus_connection_setup_with_g_main() on the result.) + * + * Returns: a DBusConnection + */ +DBusGConnection* +dbus_g_bus_get_private (DBusBusType type, + GError **error) +{ + DBusConnection *connection; + DBusError derror; + + g_return_val_if_fail (error == NULL || *error == NULL, NULL); + + _dbus_g_value_types_init (); + + dbus_error_init (&derror); + + connection = dbus_bus_get_private (type, &derror); + if (connection == NULL) + { + dbus_set_g_error (error, &derror); + dbus_error_free (&derror); + return NULL; + } + + /* does nothing if it's already been done */ + dbus_connection_setup_with_g_main (connection, NULL); + + return DBUS_G_CONNECTION_FROM_CONNECTION (connection); +} + /** @} */ /* end of public API */ #ifdef DBUS_BUILD_TESTS