summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-connection.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-09-06 18:21:00 +0000
committerHavoc Pennington <hp@redhat.com>2003-09-06 18:21:00 +0000
commit666fe95480c14d7cbf5143b1a4e1bf0558403d4d (patch)
treeb625219774e2dbf4418b1aa10480c2f949074d04 /dbus/dbus-connection.c
parentd7f8a9510f0987245a7473151dff7bfdd318d7fd (diff)
2003-09-06 Havoc Pennington <hp@pobox.com>
* dbus/dbus-connection.c (dbus_connection_register_fallback): add this (dbus_connection_register_object_path): make this not handle messages to paths below the given path
Diffstat (limited to 'dbus/dbus-connection.c')
-rw-r--r--dbus/dbus-connection.c46
1 files changed, 43 insertions, 3 deletions
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index 608634d2..b8e67c14 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -3049,8 +3049,8 @@ dbus_connection_remove_filter (DBusConnection *connection,
}
/**
- * Registers a handler for a given subsection of the object hierarchy.
- * The given vtable handles messages at or below the given path.
+ * Registers a handler for a given path in the object hierarchy.
+ * The given vtable handles messages sent to exactly the given path.
*
*
* @param connection the connection
@@ -3074,7 +3074,47 @@ dbus_connection_register_object_path (DBusConnection *connection,
CONNECTION_LOCK (connection);
- retval = _dbus_object_tree_register (connection->objects, path, vtable,
+ retval = _dbus_object_tree_register (connection->objects,
+ FALSE,
+ path, vtable,
+ user_data);
+
+ CONNECTION_UNLOCK (connection);
+
+ return retval;
+}
+
+/**
+ * Registers a fallback handler for a given subsection of the object
+ * hierarchy. The given vtable handles messages at or below the given
+ * path. You can use this to establish a default message handling
+ * policy for a whole "subdirectory."
+ *
+ *
+ * @param connection the connection
+ * @param path #NULL-terminated array of path elements
+ * @param vtable the virtual table
+ * @param user_data data to pass to functions in the vtable
+ * @returns #FALSE if not enough memory
+ */
+dbus_bool_t
+dbus_connection_register_fallback (DBusConnection *connection,
+ const char **path,
+ const DBusObjectPathVTable *vtable,
+ void *user_data)
+{
+ dbus_bool_t retval;
+
+ _dbus_return_val_if_fail (connection != NULL, FALSE);
+ _dbus_return_val_if_fail (path != NULL, FALSE);
+ _dbus_return_val_if_fail (path[0] != NULL, FALSE);
+ _dbus_return_val_if_fail (vtable != NULL, FALSE);
+
+ CONNECTION_LOCK (connection);
+
+ retval = _dbus_object_tree_register (connection->objects,
+ TRUE,
+ path, vtable,
user_data);
CONNECTION_UNLOCK (connection);