Malcontent.AppFilterBuilder

Fields

Name

Type

Access

Description

b0

bool

r

b1

bool

r

p0

object

r

p1

object

r

p2

object

r

p3

object

r

Methods

class

new ()

blocklist_content_type (content_type)

blocklist_flatpak_ref (app_ref)

blocklist_path (path)

clear ()

copy ()

end ()

free ()

init ()

set_allow_system_installation (allow_system_installation)

set_allow_user_installation (allow_user_installation)

set_oars_value (oars_section, value)

Details

class Malcontent.AppFilterBuilder

Malcontent.AppFilterBuilder is a stack-allocated mutable structure used to build an Malcontent.AppFilter instance. Use Malcontent.AppFilterBuilder.init(), various method calls to set properties of the app filter, and then Malcontent.AppFilterBuilder.end(), to construct an Malcontent.AppFilter.

New in version 0.2.0.

classmethod new()
Returns:

a new heap-allocated Malcontent.AppFilterBuilder

Return type:

Malcontent.AppFilterBuilder

Construct a new Malcontent.AppFilterBuilder on the heap. This is intended for language bindings. The returned builder must eventually be freed with Malcontent.AppFilterBuilder.free(), but can be cleared zero or more times with Malcontent.AppFilterBuilder.clear() first.

New in version 0.2.0.

blocklist_content_type(content_type)
Parameters:

content_type (str) – a content type to blocklist

Add content_type to the blocklist of content types in the filter under construction. The content_type will not be added again if it’s already been added.

Note that this method doesn’t handle content subtypes. For example, if application/xml is added to the blocklist but application/xspf+xml is not, a check for whether application/xspf+xml is blocklisted would return false.

New in version 0.4.0.

blocklist_flatpak_ref(app_ref)
Parameters:

app_ref (str) – a flatpak app ref to blocklist

Add app_ref to the blocklist of flatpak refs in the filter under construction. The app_ref will not be added again if it’s already been added.

New in version 0.2.0.

blocklist_path(path)
Parameters:

path (str) – an absolute path to blocklist

Add path to the blocklist of app paths in the filter under construction. It will be canonicalised (without doing any I/O) before being added. The canonicalised path will not be added again if it’s already been added.

New in version 0.2.0.

clear()

Clear self, freeing any internal state in it. This will not free the top-level storage for self itself, which is assumed to be allocated on the stack.

If called on an already-cleared Malcontent.AppFilterBuilder, this function is idempotent.

New in version 0.2.0.

copy()
Returns:

a copy of self

Return type:

Malcontent.AppFilterBuilder

Copy the given self to a newly-allocated Malcontent.AppFilterBuilder on the heap. This is safe to use with cleared, stack-allocated Malcontent.AppFilterBuilders.

New in version 0.2.0.

end()
Returns:

a newly constructed Malcontent.AppFilter

Return type:

Malcontent.AppFilter

Finish constructing an Malcontent.AppFilter with the given self, and return it. The Malcontent.AppFilterBuilder will be cleared as if Malcontent.AppFilterBuilder.clear() had been called.

New in version 0.2.0.

free()

Free an Malcontent.AppFilterBuilder originally allocated using Malcontent.AppFilterBuilder.new(). This must not be called on stack-allocated builders initialised using Malcontent.AppFilterBuilder.init().

New in version 0.2.0.

init()

Initialise the given self so it can be used to construct a new Malcontent.AppFilter. self must have been allocated on the stack, and must not already be initialised.

Construct the Malcontent.AppFilter by calling methods on self, followed by Malcontent.AppFilterBuilder.end(). To abort construction, use Malcontent.AppFilterBuilder.clear().

New in version 0.2.0.

set_allow_system_installation(allow_system_installation)
Parameters:

allow_system_installation (bool) – True to allow app installation; False to unconditionally disallow it

Set whether the user is allowed to install to the flatpak system repository. If this is True, app installation is still subject to the OARS values (Malcontent.AppFilterBuilder.set_oars_value()). If it is False, app installation is unconditionally disallowed for this user.

New in version 0.2.0.

set_allow_user_installation(allow_user_installation)
Parameters:

allow_user_installation (bool) – True to allow app installation; False to unconditionally disallow it

Set whether the user is allowed to install to their flatpak user repository. If this is True, app installation is still subject to the OARS values (Malcontent.AppFilterBuilder.set_oars_value()). If it is False, app installation is unconditionally disallowed for this user.

New in version 0.2.0.

set_oars_value(oars_section, value)
Parameters:

Set the OARS value for the given oars_section, indicating the intensity of content covered by that section which the user is allowed to see (inclusive). Any apps which have more intense content in this section should not be usable by the user.

New in version 0.2.0.