diff -urN dbus-glib-0.80-orig/dbus/dbus-glib.h dbus-glib-0.80-patched/dbus/dbus-glib.h --- dbus-glib-0.80-orig/dbus/dbus-glib.h 2008-12-04 15:27:07.000000000 -0500 +++ dbus-glib-0.80-patched/dbus/dbus-glib.h 2009-09-21 16:48:06.765031189 -0400 @@ -105,6 +105,9 @@ GError **error); DBusGConnection* dbus_g_bus_get (DBusBusType type, GError **error); +DBusGConnection* dbus_g_bus_get_private (DBusBusType type, + GMainContext *context, + GError **error); typedef struct _DBusGObjectInfo DBusGObjectInfo; typedef struct _DBusGMethodInfo DBusGMethodInfo; diff -urN dbus-glib-0.80-orig/dbus/dbus-gmain.c dbus-glib-0.80-patched/dbus/dbus-gmain.c --- dbus-glib-0.80-orig/dbus/dbus-gmain.c 2008-12-04 15:27:07.000000000 -0500 +++ dbus-glib-0.80-patched/dbus/dbus-gmain.c 2009-09-21 16:47:19.699421350 -0400 @@ -765,6 +765,49 @@ return DBUS_G_CONNECTION_FROM_CONNECTION (connection); } +/** + * dbus_g_bus_get_private: + * @type: bus type + * @context: the mainloop context to attach to + * @error: address where an error can be returned. + * + * Returns a connection to the given bus. The connection is private. + * Callers are responsible for closing the connection before + * the reference count reaches 0. + * + * (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, + GMainContext *context, + 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, context); + + return DBUS_G_CONNECTION_FROM_CONNECTION (connection); +} + /** @} */ /* end of public API */ #ifdef DBUS_BUILD_TESTS