WebKit.UserContentFilterStore¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class WebKit.UserContentFilterStore(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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, theWebKit.UserContentFilter
objects which represent them can be added to aWebKit.UserContentManager
withWebKit.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 theWebKit.UserContentFilterStore
: a list of all the stored filters can be obtained withWebKit.UserContentFilterStore.fetch_identifiers
(),WebKit.UserContentFilterStore.load
() can be used to retrieve a previously saved filter, and removed from the store withWebKit.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:
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:
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
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
) – 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
WebKit.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
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
) – aGio.AsyncResult
- Raises:
- Returns:
a
WebKit.UserContentFilter
, orNone
if the load failed- Return type:
Finishes an asynchronous filter load previously started with
WebKit.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
WebKit.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
WebKit.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
WebKit.UserContentFilterStore.remove
() andWebKit.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
) – aGio.AsyncResult
- Raises:
- Returns:
a
WebKit.UserContentFilter
, orNone
if saving failed- Return type:
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:
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
(). SeeWebKit.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
) – aGio.AsyncResult
- Raises:
- Returns:
a
WebKit.UserContentFilter
, orNone
if saving failed.- Return type:
Finishes and asynchronous filter save previously started with
WebKit.UserContentFilterStore.save_from_file
().New in version 2.24.