summaryrefslogtreecommitdiff
path: root/telepathy-glib/dbus-daemon.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2010-04-19 17:38:07 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2010-04-19 17:44:12 +0100
commit629216d9a7b5bbdad4ab78c6fd76140d725b9579 (patch)
treefbc6cfcc7df1188720a6c7243ab4dd78f30e34cf /telepathy-glib/dbus-daemon.c
parent59f88dcd28bac12d7bbe9a90c63e880a2e65612b (diff)
downloadtelepathy-glib-629216d9a7b5bbdad4ab78c6fd76140d725b9579.tar.gz
tp_dbus_daemon_register_object, tp_dbus_daemon_unregister_object: add
Not having to extract the DBusGConnection from the TpDBusDaemon turns out to be a significant win in terms of amount of code.
Diffstat (limited to 'telepathy-glib/dbus-daemon.c')
-rw-r--r--telepathy-glib/dbus-daemon.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/telepathy-glib/dbus-daemon.c b/telepathy-glib/dbus-daemon.c
index 320a1a571..6e28f7caa 100644
--- a/telepathy-glib/dbus-daemon.c
+++ b/telepathy-glib/dbus-daemon.c
@@ -915,6 +915,51 @@ tp_dbus_daemon_release_name (TpDBusDaemon *self,
}
/**
+ * tp_dbus_daemon_register_object:
+ * @self: object representing a connection to a bus
+ * @object_path: an object path
+ * @object: (type Object) (transfer none): an object to export
+ *
+ * Export @object at @object_path. This is a convenience wrapper around
+ * dbus_g_connection_register_g_object(), and behaves similarly.
+ */
+void
+tp_dbus_daemon_register_object (TpDBusDaemon *self,
+ const gchar *object_path,
+ gpointer object)
+{
+ TpProxy *as_proxy = (TpProxy *) self;
+
+ g_return_if_fail (TP_IS_DBUS_DAEMON (self));
+ g_return_if_fail (tp_dbus_check_valid_object_path (object_path, NULL));
+ g_return_if_fail (G_IS_OBJECT (object));
+
+ dbus_g_connection_register_g_object (as_proxy->dbus_connection,
+ object_path, object);
+}
+
+/**
+ * tp_dbus_daemon_unregister_object:
+ * @self: object representing a connection to a bus
+ * @object: (type Object) (transfer none): an object previously exported with
+ * tp_dbus_daemon_register_object()
+ *
+ * Stop exporting @object on D-Bus. This is a convenience wrapper around
+ * dbus_g_connection_unregister_g_object(), and behaves similarly.
+ */
+void
+tp_dbus_daemon_unregister_object (TpDBusDaemon *self,
+ gpointer object)
+{
+ TpProxy *as_proxy = (TpProxy *) self;
+
+ g_return_if_fail (TP_IS_DBUS_DAEMON (self));
+ g_return_if_fail (G_IS_OBJECT (object));
+
+ dbus_g_connection_unregister_g_object (as_proxy->dbus_connection, object);
+}
+
+/**
* tp_dbus_daemon_get_unique_name:
* @self: object representing a connection to a bus
*