From b4911558384de9919a231c29d75d9560f81fad0a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 16 Apr 2009 12:58:32 +0100 Subject: [PATCH 4/5] fd.o #21219: implement unregistration of objects --- dbus/dbus-gobject.c | 25 ++++++++++++++++++++++++- doc/reference/dbus-glib-sections.txt | 1 + 2 files changed, 25 insertions(+), 1 deletions(-) diff --git a/dbus/dbus-gobject.c b/dbus/dbus-gobject.c index d689c24..9e09df2 100644 --- a/dbus/dbus-gobject.c +++ b/dbus/dbus-gobject.c @@ -2018,6 +2018,28 @@ object_registration_object_died (gpointer user_data, GObject *dead) } /** + * dbus_g_connection_unregister_g_object: + * @connection: the D-BUS connection + * @object: the object + * + * Removes @object from the bus. Properties, methods, and signals + * of the object can no longer be accessed remotely. + */ +void +dbus_g_connection_unregister_g_object (DBusGConnection *connection, + GObject *object) +{ + ObjectRegistration *o; + + o = g_object_get_data (object, "dbus_glib_object_registration"); + + g_return_if_fail (o != NULL); + + dbus_connection_unregister_object_path (DBUS_CONNECTION_FROM_G_CONNECTION (o->connection), + o->object_path); +} + +/** * dbus_g_connection_register_g_object: * @connection: the D-BUS connection * @at_path: the path where the object will live (the object's name) @@ -2029,7 +2051,8 @@ object_registration_object_died (gpointer user_data, GObject *dead) * with dbus_g_object_type_install_info(). * * The registration will be cancelled if either the #DBusConnection or - * the #GObject gets finalized. + * the #GObject gets finalized, or if dbus_g_connection_unregister_g_object() + * is used. */ void dbus_g_connection_register_g_object (DBusGConnection *connection, diff --git a/doc/reference/dbus-glib-sections.txt b/doc/reference/dbus-glib-sections.txt index b1ce190..3bdb5b8 100644 --- a/doc/reference/dbus-glib-sections.txt +++ b/doc/reference/dbus-glib-sections.txt @@ -10,6 +10,7 @@ dbus_g_connection_unref dbus_g_connection_flush dbus_g_connection_get_connection dbus_g_connection_register_g_object +dbus_g_connection_unregister_g_object dbus_g_connection_lookup_g_object DBUS_TYPE_G_CONNECTION -- 1.6.2.2