Commit 40b5dc82 authored by Simon McVittie's avatar Simon McVittie

Add a stub _dbus_loop_toggle_watch and call it where needed

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33337
Bug-NB: NB#197191
parent f567a7f7
......@@ -1426,6 +1426,16 @@ remove_babysitter_watch (DBusWatch *watch,
watch);
}
static void
toggle_babysitter_watch (DBusWatch *watch,
void *data)
{
BusPendingActivation *pending_activation = data;
_dbus_loop_toggle_watch (bus_context_get_loop (pending_activation->activation->context),
watch);
}
static dbus_bool_t
pending_activation_timed_out (void *data)
{
......@@ -2110,7 +2120,7 @@ bus_activation_activate_service (BusActivation *activation,
if (!_dbus_babysitter_set_watch_functions (pending_activation->babysitter,
add_babysitter_watch,
remove_babysitter_watch,
NULL,
toggle_babysitter_watch,
pending_activation,
NULL))
{
......
......@@ -126,6 +126,18 @@ remove_server_watch (DBusWatch *watch,
_dbus_loop_remove_watch (context->loop, watch);
}
static void
toggle_server_watch (DBusWatch *watch,
void *data)
{
DBusServer *server = data;
BusContext *context;
context = server_get_context (server);
_dbus_loop_toggle_watch (context->loop, watch);
}
static dbus_bool_t
add_server_timeout (DBusTimeout *timeout,
void *data)
......@@ -228,7 +240,7 @@ setup_server (BusContext *context,
if (!dbus_server_set_watch_functions (server,
add_server_watch,
remove_server_watch,
NULL,
toggle_server_watch,
server,
NULL))
{
......
......@@ -312,6 +312,15 @@ remove_connection_watch (DBusWatch *watch,
_dbus_loop_remove_watch (connection_get_loop (connection), watch);
}
static void
toggle_connection_watch (DBusWatch *watch,
void *data)
{
DBusConnection *connection = data;
_dbus_loop_toggle_watch (connection_get_loop (connection), watch);
}
static dbus_bool_t
add_connection_timeout (DBusTimeout *timeout,
void *data)
......@@ -624,7 +633,7 @@ bus_connections_setup_connection (BusConnections *connections,
if (!dbus_connection_set_watch_functions (connection,
add_connection_watch,
remove_connection_watch,
NULL,
toggle_connection_watch,
connection,
NULL))
goto out;
......
......@@ -54,6 +54,13 @@ remove_client_watch (DBusWatch *watch,
_dbus_loop_remove_watch (client_loop, watch);
}
static void
toggle_client_watch (DBusWatch *watch,
void *data)
{
_dbus_loop_toggle_watch (client_loop, watch);
}
static dbus_bool_t
add_client_timeout (DBusTimeout *timeout,
void *data)
......@@ -120,7 +127,7 @@ bus_setup_debug_client (DBusConnection *connection)
if (!dbus_connection_set_watch_functions (connection,
add_client_watch,
remove_client_watch,
NULL,
toggle_client_watch,
connection,
NULL))
goto out;
......
......@@ -288,6 +288,13 @@ _dbus_loop_add_watch (DBusLoop *loop,
return TRUE;
}
void
_dbus_loop_toggle_watch (DBusLoop *loop,
DBusWatch *watch)
{
/* stub */
}
void
_dbus_loop_remove_watch (DBusLoop *loop,
DBusWatch *watch)
......
......@@ -41,6 +41,8 @@ dbus_bool_t _dbus_loop_add_watch (DBusLoop *loop,
DBusWatch *watch);
void _dbus_loop_remove_watch (DBusLoop *loop,
DBusWatch *watch);
void _dbus_loop_toggle_watch (DBusLoop *loop,
DBusWatch *watch);
dbus_bool_t _dbus_loop_add_timeout (DBusLoop *loop,
DBusTimeout *timeout);
void _dbus_loop_remove_timeout (DBusLoop *loop,
......
......@@ -26,6 +26,15 @@ remove_watch (DBusWatch *watch,
_dbus_loop_remove_watch (cd->loop, watch);
}
static void
toggle_watch (DBusWatch *watch,
void *data)
{
CData *cd = data;
_dbus_loop_toggle_watch (cd->loop, watch);
}
static dbus_bool_t
add_timeout (DBusTimeout *timeout,
void *data)
......@@ -103,15 +112,10 @@ test_connection_setup (DBusLoop *loop,
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;
......@@ -212,6 +216,15 @@ add_server_watch (DBusWatch *watch,
return _dbus_loop_add_watch (context->loop, watch);
}
static void
toggle_server_watch (DBusWatch *watch,
void *data)
{
ServerData *context = data;
_dbus_loop_toggle_watch (context->loop, watch);
}
static void
remove_server_watch (DBusWatch *watch,
void *data)
......@@ -252,7 +265,7 @@ test_server_setup (DBusLoop *loop,
if (!dbus_server_set_watch_functions (server,
add_server_watch,
remove_server_watch,
NULL,
toggle_server_watch,
sd,
serverdata_free))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment