} CData;
static dbus_bool_t
-connection_watch_callback (DBusWatch *watch,
- unsigned int condition,
- void *data)
-{
- return dbus_watch_handle (watch, condition);
-}
-
-static dbus_bool_t
add_watch (DBusWatch *watch,
void *data)
{
CData *cd = data;
- return _dbus_loop_add_watch (cd->loop,
- watch,
- connection_watch_callback,
- cd, NULL);
+ return _dbus_loop_add_watch (cd->loop, watch);
}
static void
{
CData *cd = data;
- _dbus_loop_remove_watch (cd->loop,
- watch, connection_watch_callback, cd);
+ _dbus_loop_remove_watch (cd->loop, watch);
}
static void
-connection_timeout_callback (DBusTimeout *timeout,
- void *data)
+toggle_watch (DBusWatch *watch,
+ void *data)
{
- /* Can return FALSE on OOM but we just let it fire again later */
- dbus_timeout_handle (timeout);
+ CData *cd = data;
+
+ _dbus_loop_toggle_watch (cd->loop, watch);
}
static dbus_bool_t
{
CData *cd = data;
- return _dbus_loop_add_timeout (cd->loop,
- timeout, connection_timeout_callback, cd, NULL);
+ return _dbus_loop_add_timeout (cd->loop, timeout);
}
static void
{
CData *cd = data;
- _dbus_loop_remove_timeout (cd->loop,
- timeout, connection_timeout_callback, cd);
+ _dbus_loop_remove_timeout (cd->loop, timeout);
}
static void
if (cd == NULL)
goto nomem;
- /* Because dbus-mainloop.c checks dbus_timeout_get_enabled(),
- * dbus_watch_get_enabled() directly, we don't have to provide
- * "toggled" callbacks.
- */
-
if (!dbus_connection_set_watch_functions (connection,
add_watch,
remove_watch,
- NULL,
+ toggle_watch,
cd, cdata_free))
goto nomem;
}
static dbus_bool_t
-server_watch_callback (DBusWatch *watch,
- unsigned int condition,
- void *data)
-{
- /* FIXME this can be done in dbus-mainloop.c
- * if the code in activation.c for the babysitter
- * watch handler is fixed.
- */
-
- return dbus_watch_handle (watch, condition);
-}
-
-static dbus_bool_t
add_server_watch (DBusWatch *watch,
void *data)
{
ServerData *context = data;
- return _dbus_loop_add_watch (context->loop,
- watch, server_watch_callback, context,
- NULL);
+ return _dbus_loop_add_watch (context->loop, watch);
}
static void
-remove_server_watch (DBusWatch *watch,
+toggle_server_watch (DBusWatch *watch,
void *data)
{
ServerData *context = data;
-
- _dbus_loop_remove_watch (context->loop,
- watch, server_watch_callback, context);
+
+ _dbus_loop_toggle_watch (context->loop, watch);
}
static void
-server_timeout_callback (DBusTimeout *timeout,
- void *data)
+remove_server_watch (DBusWatch *watch,
+ void *data)
{
- /* can return FALSE on OOM but we just let it fire again later */
- dbus_timeout_handle (timeout);
+ ServerData *context = data;
+
+ _dbus_loop_remove_watch (context->loop, watch);
}
static dbus_bool_t
{
ServerData *context = data;
- return _dbus_loop_add_timeout (context->loop,
- timeout, server_timeout_callback, context, NULL);
+ return _dbus_loop_add_timeout (context->loop, timeout);
}
static void
{
ServerData *context = data;
- _dbus_loop_remove_timeout (context->loop,
- timeout, server_timeout_callback, context);
+ _dbus_loop_remove_timeout (context->loop, timeout);
}
dbus_bool_t
if (!dbus_server_set_watch_functions (server,
add_server_watch,
remove_server_watch,
- NULL,
+ toggle_server_watch,
sd,
serverdata_free))
{
goto nomem;
}
+ sd = serverdata_new (loop, server);
+ if (sd == NULL)
+ goto nomem;
+
if (!dbus_server_set_timeout_functions (server,
add_server_timeout,
remove_server_timeout,
test_server_shutdown (DBusLoop *loop,
DBusServer *server)
{
+ dbus_server_disconnect (server);
+
if (!dbus_server_set_watch_functions (server,
NULL, NULL, NULL,
NULL,