GDBusObjectManagerServer: Allow setting :connection property

.. and add a C setter to do this. Also make the C getter return a
reference since the property may be set from another thread. Also
change the constructor to _not_ take a GDBusConnection since this is
something you almost always want to do _after_ creating it. The
API/ABI break is fine as there has never been a GLib release with this
type.

https://bugzilla.gnome.org/show_bug.cgi?id=648959

Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
David Zeuthen
2011-05-04 03:37:46 -04:00
parent 542215b78a
commit 1ab29b6c4a
6 changed files with 217 additions and 75 deletions

View File

@@ -68,7 +68,7 @@ on_bus_acquired (GDBusConnection *connection,
g_print ("Acquired a message bus connection\n");
/* Create a new org.freedesktop.DBus.ObjectManager rooted at /example/Animals */
manager = g_dbus_object_manager_server_new (connection, "/example/Animals");
manager = g_dbus_object_manager_server_new ("/example/Animals");
for (n = 0; n < 10; n++)
{
@@ -111,6 +111,9 @@ on_bus_acquired (GDBusConnection *connection,
g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
g_object_unref (object);
}
/* Export all objects */
g_dbus_object_manager_server_set_connection (manager, connection);
}
static void