WebKit2.UserContentFilterStore¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class WebKit2.UserContentFilterStore(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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, theWebKit2.UserContentFilter
objects which represent them can be added to aWebKit2.UserContentManager
withWebKit2.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 theWebKit2.UserContentFilterStore
: a list of all the stored filters can be obtained withWebKit2.UserContentFilterStore.fetch_identifiers
(),WebKit2.UserContentFilterStore.load
() can be used to retrieve a previously saved filter, and removed from the store withWebKit2.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:
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:
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the removal is completeduser_data (
object
orNone
) – the data to pass to the callback function
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
) – aGio.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:
Gets the storage path for user content filters.
New in version 2.24.
- load(identifier, cancellable, callback, *user_data)¶
- Parameters:
identifier (
str
) – a filter identifiercancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the load is completeduser_data (
object
orNone
) – the data to pass to the callback function
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
) – aGio.AsyncResult
- Raises:
- Returns:
a
WebKit2.UserContentFilter
, orNone
if the load failed- Return type:
Finishes an asynchronous filter load previously started with
WebKit2.UserContentFilterStore.load
().New in version 2.24.
- remove(identifier, cancellable, callback, *user_data)¶
- Parameters:
identifier (
str
) – a filter identifiercancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the removal is completeduser_data (
object
orNone
) – the data to pass to the callback function
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
) – aGio.AsyncResult
- Raises:
- Returns:
whether the removal was successful
- Return type:
Finishes an asynchronous filter removal previously started with
WebKit2.UserContentFilterStore.remove
().New in version 2.24.
- save(identifier, source, cancellable, callback, *user_data)¶
- Parameters:
identifier (
str
) – a string used to identify the saved filtersource (
GLib.Bytes
) –GLib.Bytes
containing the rule set in JSON formatcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when saving is completeduser_data (
object
orNone
) – the data to pass to the callback function
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
() andWebKit2.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
) – aGio.AsyncResult
- Raises:
- Returns:
a
WebKit2.UserContentFilter
, orNone
if saving failed- Return type:
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:
identifier (
str
) – a string used to identify the saved filterfile (
Gio.File
) – aGio.File
containing the rule set in JSON formatcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when saving is completeduser_data (
object
orNone
) – the data to pass to the callback function
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
(). SeeWebKit2.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
) – aGio.AsyncResult
- Raises:
- Returns:
a
WebKit2.UserContentFilter
, orNone
if saving failed.- Return type:
Finishes and asynchronous filter save previously started with
WebKit2.UserContentFilterStore.save_from_file
().New in version 2.24.