glib/gio/gdbus-2.0/codegen
Matthew Leeds 2a605f6e15 gdbus-codegen: Add call_flags and timeout_msec args
Currently the code generated by gdbus-codegen uses
G_DBUS_CALL_FLAGS_NONE in its D-Bus calls, which occur for each method
defined by the input XML, and for proxy_set_property functions. This
means that if the daemon which implements the methods checks for
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION and only does interactive
authorization if that flag is present, users of the generated code have
no way to cause the daemon to use interactive authorization (e.g. polkit
dialogs).

If we simply changed the generated code to always use
G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, its users would have no
way to disallow interactive authorization (except for manually calling
the D-Bus method themselves).

So instead, this commit adds a GDBusCallFlags argument to method call
functions. Since this is an API break which will require changes in
projects using gdbus-codegen code, the change is conditional on the
command line argument --glib-min-version having the value 2.64 or
higher.

The impetus for this change is that I'm changing accountsservice to
properly respect G_DBUS_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION, and
libaccountsservice uses generated code for D-Bus method calls. So
these changes will allow libaccountsservice to continue allowing
interactive authorization, and avoid breaking any users of it which
expect that. See
https://gitlab.freedesktop.org/accountsservice/accountsservice/merge_requests/46

It might make sense to also let GDBusCallFlags be specified for property
set operations, but that is not needed in the case of accountsservice,
and would require significant work and breaking API in multiple places.

Similarly, the generated code currently hard codes -1 as the timeout
value when calling g_dbus_proxy_call*(). Add a timeout_msec argument so
the user of the generated code can specify the timeout as well.

Also, test this new API. In gio/tests/codegen.py we test that the new
arguments are generated if and only of --glib-min-version is used with a
value greater than or equal to 2.64, and in gio/tests/meson.build we
test that the generated code with the new API can be linked against.

The test_unix_fd_list() test also needed modification to continue
working now that we're using gdbus-test-codegen.c with code generated
with --glib-min-version=2.64 in one test.

Finally, update the docs for gdbus-codegen to explain the effect of
using --glib-min-version 2.64, both from this commit and from
"gdbus-codegen: Emit GUnixFDLists if an arg has type `h` w/
min-version".
2020-01-15 09:37:41 -08:00
..
__init__.py gio/gdbus-2.0/codegen/: LGPLv2+ -> LGPLv2.1+ 2017-05-29 19:53:34 +02:00
.gitignore Git should ignore generated config.py file 2017-11-20 10:17:01 +00:00
codegen_docbook.py gdbus-codegen: Remove unnecessary parameters from the constructor 2018-01-15 16:10:12 +01:00
codegen_main.py gdbus-codegen: Emit GUnixFDLists if an arg has type h w/ min-version 2019-12-11 10:40:07 +00:00
codegen.py gdbus-codegen: Add call_flags and timeout_msec args 2020-01-15 09:37:41 -08:00
config.py.in meson: Improve MSVC and MinGW support and fix dependencies everywhere 2017-07-13 19:03:39 -04:00
dbustypes.py gdbus-codegen: Emit GUnixFDLists if an arg has type h w/ min-version 2019-12-11 10:40:07 +00:00
gdbus-codegen.in gdbus-codegen: Call abspath() earlier 2017-11-06 11:57:52 +00:00
meson.build build: Remove unsupported install directives 2019-07-24 12:45:02 +01:00
parser.py gdbus-codegen: Emit GUnixFDLists if an arg has type h w/ min-version 2019-12-11 10:40:07 +00:00
utils.py python: avoid equality check for None 2018-07-12 23:48:41 +02:00