diff -ur dbus-glib-0.76/dbus/dbus-glib.h dbus-glib-0.76-private/dbus/dbus-glib.h --- dbus-glib-0.76/dbus/dbus-glib.h 2008-05-14 12:21:15.000000000 +0200 +++ dbus-glib-0.76-private/dbus/dbus-glib.h 2009-01-17 00:01:13.000000000 +0100 @@ -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 -ur dbus-glib-0.76/dbus/dbus-gmain.c dbus-glib-0.76-private/dbus/dbus-gmain.c --- dbus-glib-0.76/dbus/dbus-gmain.c 2008-05-14 12:21:15.000000000 +0200 +++ dbus-glib-0.76-private/dbus/dbus-gmain.c 2009-01-17 00:02:01.000000000 +0100 @@ -765,6 +765,46 @@ 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 connection to the given bus. The connection is a global variable + * shared with other callers of this function. + * + * (Internally, calls dbus_bus_get_private() 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