WebKit2.UserContentFilterStore

g GObject.Object GObject.Object WebKit2.UserContentFilterStore WebKit2.UserContentFilterStore GObject.Object->WebKit2.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)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class WebKit2.UserContentFilterStore(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

WebKit2.UserContentFilterStoreClass

Handles storage of user content filters on disk.

The WebKit2.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 WebKit2.UserContentFilter objects which represent them can be added to a WebKit2.UserContentManager with WebKit2.UserContentManager.add_filter().

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

Return type:

WebKit2.UserContentFilterStore

Create a new WebKit2.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 WebKit2.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 WebKit2.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 WebKit2.UserContentFilterStore.save().

When the operation is finished, callback will be invoked, which then can use WebKit2.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 WebKit2.UserContentFilter, or None if the load failed

Return type:

WebKit2.UserContentFilter

Finishes an asynchronous filter load previously started with WebKit2.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 WebKit2.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 WebKit2.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 WebKit2.UserContentFilterStore.remove() and WebKit2.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 WebKit2.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 WebKit2.UserContentFilter, or None if saving failed

Return type:

WebKit2.UserContentFilter

Finishes an asynchronous filter save previously started with WebKit2.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 WebKit2.UserContentFilterStore.save() for more details.

When the operation is finished, callback will be invoked, which then can use WebKit2.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 WebKit2.UserContentFilter, or None if saving failed.

Return type:

WebKit2.UserContentFilter

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

New in version 2.24.

Property Details

WebKit2.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.