summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbus/dbus-glib.h1
-rw-r--r--dbus/dbus-gmain.c4
-rw-r--r--test/core/test-dbus-glib.c21
3 files changed, 25 insertions, 1 deletions
diff --git a/dbus/dbus-glib.h b/dbus/dbus-glib.h
index 66eebba..d2d2046 100644
--- a/dbus/dbus-glib.h
+++ b/dbus/dbus-glib.h
@@ -106,6 +106,7 @@ DBusGConnection* dbus_g_connection_open (const gchar *address,
DBusGConnection* dbus_g_bus_get (DBusBusType type,
GError **error);
DBusGConnection* dbus_g_bus_get_private (DBusBusType type,
+ GMainContext *context,
GError **error);
diff --git a/dbus/dbus-gmain.c b/dbus/dbus-gmain.c
index 25a9742..7496c65 100644
--- a/dbus/dbus-gmain.c
+++ b/dbus/dbus-gmain.c
@@ -768,6 +768,7 @@ dbus_g_bus_get (DBusBusType type,
/**
* dbus_g_bus_get_private:
* @type: bus type
+ * @context: Mainloop context to attach to
* @error: address where an error can be returned.
*
* Returns a connection to the given bus. The connection will be a private
@@ -781,6 +782,7 @@ dbus_g_bus_get (DBusBusType type,
*/
DBusGConnection*
dbus_g_bus_get_private (DBusBusType type,
+ GMainContext *context,
GError **error)
{
DBusConnection *connection;
@@ -801,7 +803,7 @@ dbus_g_bus_get_private (DBusBusType type,
}
/* does nothing if it's already been done */
- dbus_connection_setup_with_g_main (connection, NULL);
+ dbus_connection_setup_with_g_main (connection, context);
return DBUS_G_CONNECTION_FROM_CONNECTION (connection);
}
diff --git a/test/core/test-dbus-glib.c b/test/core/test-dbus-glib.c
index 288606f..0e3c12f 100644
--- a/test/core/test-dbus-glib.c
+++ b/test/core/test-dbus-glib.c
@@ -2123,6 +2123,27 @@ main (int argc, char **argv)
lose ("Duplicate proxy wasn'tdestroyed");
g_print ("Proxy and duplicate destroyed successfully\n");
+
+ g_print ("Beginning private connection tests\n");
+
+ {
+ DBusGConnection *privconn = dbus_g_bus_get_private (DBUS_BUS_SESSION, NULL, &error);
+
+ if (privconn == NULL)
+ lose_gerror ("Failed to open private connection to bus", error);
+ g_assert (privconn != connection);
+
+ proxy = dbus_g_proxy_new_for_name (privconn,
+ "org.freedesktop.DBus.GLib.TestService",
+ "/org/freedesktop/DBus/GLib/Tests/MyTestObject",
+ "org.freedesktop.DBus.GLib.Tests.MyObject");
+
+ g_print ("[private connection] Calling (wrapped) do_nothing\n");
+ if (!org_freedesktop_DBus_GLib_Tests_MyObject_do_nothing (proxy, &error))
+ lose_gerror ("Failed to complete (wrapped) DoNothing call", error);
+
+ g_object_unref (G_OBJECT (proxy));
+ }
g_object_unref (G_OBJECT (driver));