libmalcontent: Rename flags types

If we have a flag type for getting and for setting every type of value
which can be stored on an `MctManager`, that will lead to a load of flag
types which all look identical.

Refactor the types so we only have one shared flags type for getters,
and one for setters.

Add compatibility defines so that this doesn’t break API. It’s not an
ABI break because the flag member values don’t change.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2019-12-11 15:29:12 +00:00
parent 282cf9c66b
commit acf2738d56
4 changed files with 67 additions and 57 deletions

View file

@ -38,9 +38,9 @@ def __get_app_filter(user_id, interactive):
If `interactive` is `True`, interactive polkit authorisation dialogues will
be allowed. An exception will be raised on failure."""
if interactive:
flags = Malcontent.GetAppFilterFlags.INTERACTIVE
flags = Malcontent.ManagerGetValueFlags.INTERACTIVE
else:
flags = Malcontent.GetAppFilterFlags.NONE
flags = Malcontent.ManagerGetValueFlags.NONE
connection = Gio.bus_get_sync(Gio.BusType.SYSTEM)
manager = Malcontent.Manager.new(connection)
@ -66,9 +66,9 @@ def __set_app_filter(user_id, app_filter, interactive):
If `interactive` is `True`, interactive polkit authorisation dialogues will
be allowed. An exception will be raised on failure."""
if interactive:
flags = Malcontent.SetAppFilterFlags.INTERACTIVE
flags = Malcontent.ManagerSetValueFlags.INTERACTIVE
else:
flags = Malcontent.SetAppFilterFlags.NONE
flags = Malcontent.ManagerSetValueFlags.NONE
connection = Gio.bus_get_sync(Gio.BusType.SYSTEM)
manager = Malcontent.Manager.new(connection)