Skip to content
Snippets Groups Projects
Commit 3a652551 authored by Guillaume Desmottes's avatar Guillaume Desmottes
Browse files

mock-service: fix signature of 'handle-' signals


Callback implementing the 'handle-' signals are supposed to return TRUE
if they actually handled the D-Bus method call (even in case of errors).

Signed-off-by: default avatarGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Reviewed-by: default avatarPhilip Withnall <philip.withnall@collabora.co.uk>
Differential Revision: https://phabricator.apertis.org/D4700
parent 9933826b
No related branches found
No related tags found
No related merge requests found
......@@ -141,7 +141,7 @@ route_set_segments_desc (TrpRoute *route,
}
}
static void
static gboolean
on_handle_add_route (Trp1Mock *mock,
GDBusMethodInvocation *invocation,
GVariant *title,
......@@ -168,13 +168,14 @@ on_handle_add_route (Trp1Mock *mock,
goto error;
trp_1_mock_complete_add_route (mock, invocation, res);
return;
return TRUE;
error:
g_dbus_method_invocation_take_error (invocation, error);
return TRUE;
}
static void
static gboolean
on_handle_remove_route (Trp1Mock *mock,
GDBusMethodInvocation *invocation,
guint index,
......@@ -191,19 +192,20 @@ on_handle_remove_route (Trp1Mock *mock,
G_DBUS_ERROR_INVALID_ARGS,
"Invalid index, service contains only %d routes",
n_routes);
return;
return TRUE;
}
if (!trp_service_navigation_remove_route (self->service, index, &error))
{
g_dbus_method_invocation_take_error (invocation, error);
return;
return TRUE;
}
trp_1_mock_complete_remove_route (mock, invocation);
return TRUE;
}
static void
static gboolean
on_handle_set_current_route (Trp1Mock *mock,
GDBusMethodInvocation *invocation,
guint index,
......@@ -220,19 +222,20 @@ on_handle_set_current_route (Trp1Mock *mock,
G_DBUS_ERROR_INVALID_ARGS,
"Invalid index, service contains only %d routes",
n_routes);
return;
return TRUE;
}
if (!trp_service_navigation_set_current_route (self->service, index, &error))
{
g_dbus_method_invocation_take_error (invocation, error);
return;
return TRUE;
}
trp_1_mock_complete_set_current_route (mock, invocation);
return TRUE;
}
static void
static gboolean
on_handle_clear_routes (Trp1Mock *mock,
GDBusMethodInvocation *invocation,
gpointer user_data)
......@@ -246,16 +249,17 @@ on_handle_clear_routes (Trp1Mock *mock,
if (!trp_service_navigation_set_routes (self->service, routes, &error))
{
g_dbus_method_invocation_take_error (invocation, error);
return;
return TRUE;
}
if (!trp_service_navigation_set_current_route (self->service, -1, &error))
{
g_dbus_method_invocation_take_error (invocation, error);
return;
return TRUE;
}
trp_1_mock_complete_set_current_route (mock, invocation);
return TRUE;
}
static void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment