GDBus: Add G_DBUS_METHOD_INVOCATION_HANDLED, _UNHANDLED

Like G_SOURCE_REMOVE and G_SOURCE_CONTINUE, these make it clearer what
it means to return TRUE or FALSE.

In particular, in GDBus methods that fail, the failure case still needs
to return TRUE (unlike the typical GError pattern), leading to comments
like this:

    g_dbus_method_invocation_return_error (invocation, ...);
    return TRUE;    /* handled */

which can now be replaced by:

    g_dbus_method_invocation_return_error (invocation, ...);
    return G_DUS_METHOD_INVOCATION_HANDLED;

G_DBUS_METHOD_INVOCATION_UNHANDLED is added for symmetry, but is very
rarely (perhaps never?) useful in practice.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie
2020-08-03 16:04:12 +01:00
committed by Philip Withnall
parent 500d065f3d
commit d65c8c30a9
3 changed files with 38 additions and 1 deletions

View File

@@ -3026,6 +3026,8 @@ g_dbus_method_invocation_return_gerror
g_dbus_method_invocation_return_dbus_error
g_dbus_method_invocation_take_error
g_dbus_method_invocation_return_value_with_unix_fd_list
G_DBUS_METHOD_INVOCATION_HANDLED
G_DBUS_METHOD_INVOCATION_UNHANDLED
<SUBSECTION Standard>
G_DBUS_METHOD_INVOCATION
G_IS_DBUS_METHOD_INVOCATION