summaryrefslogtreecommitdiff
path: root/bus/test.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-08-31 03:25:24 +0000
committerHavoc Pennington <hp@redhat.com>2003-08-31 03:25:24 +0000
commit1dd3f1788f1b4c9af2f4fa744abdb7892d0a14b9 (patch)
tree9f928baa3e6205394044ce5f0c6f1aa3933bdf4f /bus/test.c
parent5fd1e389e1c1c12ad4a55c2af6abdc8e7a2f6d41 (diff)
2003-08-30 Havoc Pennington <hp@pobox.com>
* dbus/dbus-connection.c: purge DBusMessageHandler * dbus/dbus-message-handler.c: remove DBusMessageHandler, just use callbacks everywhere
Diffstat (limited to 'bus/test.c')
-rw-r--r--bus/test.c51
1 files changed, 10 insertions, 41 deletions
diff --git a/bus/test.c b/bus/test.c
index 1f13e4b67..b48ba0fee 100644
--- a/bus/test.c
+++ b/bus/test.c
@@ -102,10 +102,9 @@ remove_client_timeout (DBusTimeout *timeout,
}
static DBusHandlerResult
-client_disconnect_handler (DBusMessageHandler *handler,
- DBusConnection *connection,
- DBusMessage *message,
- void *user_data)
+client_disconnect_filter (DBusConnection *connection,
+ DBusMessage *message,
+ void *user_data)
{
if (!dbus_message_is_signal (message,
DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL,
@@ -128,35 +127,15 @@ client_disconnect_handler (DBusMessageHandler *handler,
return DBUS_HANDLER_RESULT_HANDLED;
}
-static dbus_int32_t handler_slot = -1;
-
-static void
-free_handler (void *data)
-{
- DBusMessageHandler *handler = data;
-
- dbus_message_handler_unref (handler);
- dbus_connection_free_data_slot (&handler_slot);
-}
-
dbus_bool_t
bus_setup_debug_client (DBusConnection *connection)
{
- DBusMessageHandler *disconnect_handler;
- dbus_bool_t retval;
-
- disconnect_handler = dbus_message_handler_new (client_disconnect_handler,
- NULL, NULL);
-
- if (disconnect_handler == NULL)
- return FALSE;
+ dbus_bool_t retval;
if (!dbus_connection_add_filter (connection,
- disconnect_handler))
- {
- dbus_message_handler_unref (disconnect_handler);
- return FALSE;
- }
+ client_disconnect_filter,
+ NULL, NULL))
+ return FALSE;
retval = FALSE;
@@ -184,25 +163,15 @@ bus_setup_debug_client (DBusConnection *connection)
if (!_dbus_list_append (&clients, connection))
goto out;
-
- if (!dbus_connection_allocate_data_slot (&handler_slot))
- goto out;
-
- /* Set up handler to be destroyed */
- if (!dbus_connection_set_data (connection, handler_slot,
- disconnect_handler,
- free_handler))
- {
- dbus_connection_free_data_slot (&handler_slot);
- goto out;
- }
retval = TRUE;
out:
if (!retval)
{
- dbus_message_handler_unref (disconnect_handler); /* unregisters it */
+ dbus_connection_remove_filter (connection,
+ client_disconnect_filter,
+ NULL);
dbus_connection_set_watch_functions (connection,
NULL, NULL, NULL, NULL, NULL);