WebKit.UserContentFilterStore

g GObject.Object GObject.Object WebKit.UserContentFilterStore WebKit.UserContentFilterStore GObject.Object->WebKit.UserContentFilterStore

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (storage_path)

fetch_identifiers (cancellable, callback, *user_data)

fetch_identifiers_finish (result)

get_path ()

load (identifier, cancellable, callback, *user_data)

load_finish (result)

remove (identifier, cancellable, callback, *user_data)

remove_finish (result)

save (identifier, source, cancellable, callback, *user_data)

save_finish (result)

save_from_file (identifier, file, cancellable, callback, *user_data)

save_from_file_finish (result)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

path

str

r/w/co

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class WebKit.UserContentFilterStore(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

WebKit.UserContentFilterStoreClass

Handles storage of user content filters on disk.

The WebKit.UserContentFilterStore provides the means to import and save JSON rule sets, which can be loaded later in an efficient manner. Once filters are stored, the WebKit.UserContentFilter objects which represent them can be added to a WebKit.UserContentManager with WebKit.UserContentManager.add_filter().

JSON rule sets are imported using WebKit.UserContentFilterStore.save() and stored on disk in an implementation defined format. The contents of a filter store must be managed using the WebKit.UserContentFilterStore: a list of all the stored filters can be obtained with WebKit.UserContentFilterStore.fetch_identifiers(), WebKit.UserContentFilterStore.load() can be used to retrieve a previously saved filter, and removed from the store with WebKit.UserContentFilterStore.remove().

New in version 2.24.

classmethod new(storage_path)
Parameters:

storage_path (str) – path where data for filters will be stored on disk

Returns:

a newly created WebKit.UserContentFilterStore

Return type:

WebKit.UserContentFilterStore

Create a new WebKit.UserContentFilterStore to manipulate filters stored at storage_path.

The path must point to a local filesystem, and will be created if needed.

New in version 2.24.

fetch_identifiers(cancellable, callback, *user_data)
Parameters:

Asynchronously retrieve a list of the identifiers for all the stored filters.

When the operation is finished, callback will be invoked, which then can use WebKit.UserContentFilterStore.fetch_identifiers_finish() to obtain the list of filter identifiers.

New in version 2.24.

fetch_identifiers_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Returns:

a None-terminated list of filter identifiers.

Return type:

[str]

Finishes an asynchronous fetch of the list of stored filters.

Finishes an asynchronous fetch of the list of identifiers for the stored filters previously started with WebKit.UserContentFilterStore.fetch_identifiers().

New in version 2.24.

get_path()
Returns:

path, as a string.

Return type:

str

Gets the storage path for user content filters.

New in version 2.24.

load(identifier, cancellable, callback, *user_data)
Parameters:

Asynchronously load a content filter given its identifier.

The filter must have been previously stored using WebKit.UserContentFilterStore.save().

When the operation is finished, callback will be invoked, which then can use WebKit.UserContentFilterStore.load_finish() to obtain the resulting filter.

New in version 2.24.

load_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

a WebKit.UserContentFilter, or None if the load failed

Return type:

WebKit.UserContentFilter

Finishes an asynchronous filter load previously started with WebKit.UserContentFilterStore.load().

New in version 2.24.

remove(identifier, cancellable, callback, *user_data)
Parameters:

Asynchronously remove a content filter given its identifier.

When the operation is finished, callback will be invoked, which then can use WebKit.UserContentFilterStore.remove_finish() to check whether the removal was successful.

New in version 2.24.

remove_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

whether the removal was successful

Return type:

bool

Finishes an asynchronous filter removal previously started with WebKit.UserContentFilterStore.remove().

New in version 2.24.

save(identifier, source, cancellable, callback, *user_data)
Parameters:

Asynchronously save a content filter from a set source rule.

Asynchronously save a content filter from a source rule set in the WebKit content extesions JSON format.

The identifier can be used afterwards to refer to the filter when using WebKit.UserContentFilterStore.remove() and WebKit.UserContentFilterStore.load(). When the identifier has been used in the past, the new filter source will replace the one saved beforehand for the same identifier.

When the operation is finished, callback will be invoked, which then can use WebKit.UserContentFilterStore.save_finish() to obtain the resulting filter.

New in version 2.24.

save_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

a WebKit.UserContentFilter, or None if saving failed

Return type:

WebKit.UserContentFilter

Finishes an asynchronous filter save previously started with WebKit.UserContentFilterStore.save().

New in version 2.24.

save_from_file(identifier, file, cancellable, callback, *user_data)
Parameters:

Asynchronously save a content filter from the contents of a file.

Asynchronously save a content filter from the contents of a file, which must be native to the platform, as checked by Gio.File.is_native(). See WebKit.UserContentFilterStore.save() for more details.

When the operation is finished, callback will be invoked, which then can use WebKit.UserContentFilterStore.save_finish() to obtain the resulting filter.

New in version 2.24.

save_from_file_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

a WebKit.UserContentFilter, or None if saving failed.

Return type:

WebKit.UserContentFilter

Finishes and asynchronous filter save previously started with WebKit.UserContentFilterStore.save_from_file().

New in version 2.24.

Property Details

WebKit.UserContentFilterStore.props.path
Name:

path

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The directory used for filter storage. This path is used as the base directory where user content filters are stored on disk.

New in version 2.24.