1.37 <WebKitUserContentFilterStore>

Class: <WebKitUserContentFilterStore>

It derives from <GObject>.

Handles storage of user content filters on disk.

The WebKitUserContentFilterStore provides the means to import and save JSON rule sets, which can be loaded later in an efficient manner. Once filters are stored, the <WebKitUserContentFilter> objects which represent them can be added to a <WebKitUserContentManager> with user-content-manager:add-filter.

JSON rule sets are imported using user-content-filter-store:save and stored on disk in an implementation defined format. The contents of a filter store must be managed using the #WebKitUserContentFilterStore: a list of all the stored filters can be obtained with user-content-filter-store:fetch-identifiers, user-content-filter-store:load can be used to retrieve a previously saved filter, and removed from the store with user-content-filter-store:remove.

Properties

Property: user-content-filter-store:path self

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

Its value is a string, or #f.

It can only be set when the object is made, with #:path.

Procedures

Method: user-content-filter-store:fetch-identifiers self [cancellable] [callback]
Method: fetch-identifiers self [cancellable] [callback]

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 user-content-filter-store:fetch-identifiers-finish to obtain the list of filter identifiers.

self

Passed: a <WebKitUserContentFilterStore>.

a <WebKitUserContentFilterStore>

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable> or #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the removal is completed

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to the callback function

Method: user-content-filter-store:fetch-identifiers-finish self result ⇒ %return
Method: fetch-identifiers-finish self result ⇒ %return

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 user-content-filter-store:fetch-identifiers.

self

Passed: a <WebKitUserContentFilterStore>.

a <WebKitUserContentFilterStore>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a vector, each a string.

a #f-terminated list of filter identifiers.

Method: user-content-filter-store:get-path self ⇒ %return
Method: get-path self ⇒ %return

Gets the storage path for user content filters.

self

Passed: a <WebKitUserContentFilterStore>.

a <WebKitUserContentFilterStore>

%return

Returned: a string.

path, as a string.

Method: user-content-filter-store:load self identifier [cancellable] [callback]

Asynchronously load a content filter given its identifier.

The filter must have been previously stored using user-content-filter-store:save.

When the operation is finished, callback will be invoked, which then can use user-content-filter-store:load-finish to obtain the resulting filter.

self

Passed: a <WebKitUserContentFilterStore>.

a <WebKitUserContentFilterStore>

identifier

Passed: a string.

a filter identifier

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable> or #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the load is completed

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to the callback function

Method: user-content-filter-store:load-finish self result ⇒ %return
Method: load-finish self result ⇒ %return

Finishes an asynchronous filter load previously started with user-content-filter-store:load.

self

Passed: a <WebKitUserContentFilterStore>.

a <WebKitUserContentFilterStore>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <WebKitUserContentFilter>.

a <WebKitUserContentFilter>, or #f if the load failed

Procedure: user-content-filter-store:new storage-path ⇒ %return

Create a new <WebKitUserContentFilterStore> to manipulate filters stored at storage-path.

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

storage-path

Passed: a string.

path where data for filters will be stored on disk

%return

Returned: a <WebKitUserContentFilterStore>.

a newly created <WebKitUserContentFilterStore>

Method: user-content-filter-store:remove self identifier [cancellable] [callback]
Method: remove self identifier [cancellable] [callback]

Asynchronously remove a content filter given its identifier.

When the operation is finished, callback will be invoked, which then can use user-content-filter-store:remove-finish? to check whether the removal was successful.

self

Passed: a <WebKitUserContentFilterStore>.

a <WebKitUserContentFilterStore>

identifier

Passed: a string.

a filter identifier

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable> or #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the removal is completed

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to the callback function

Method: user-content-filter-store:remove-finish? self result ⇒ %return
Method: remove-finish? self result ⇒ %return

Finishes an asynchronous filter removal previously started with user-content-filter-store:remove.

self

Passed: a <WebKitUserContentFilterStore>.

a <WebKitUserContentFilterStore>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a boolean.

whether the removal was successful

Method: user-content-filter-store:save self identifier source [cancellable] [callback]
Method: save self identifier source [cancellable] [callback]

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 user-content-filter-store:remove and user-content-filter-store: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 user-content-filter-store:save-finish to obtain the resulting filter.

self

Passed: a <WebKitUserContentFilterStore>.

a <WebKitUserContentFilterStore>

identifier

Passed: a string.

a string used to identify the saved filter

source

Passed: a <GBytes>.

<GBytes> containing the rule set in JSON format

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable> or #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when saving is completed

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to the callback function

Method: user-content-filter-store:save-finish self result ⇒ %return
Method: save-finish self result ⇒ %return

Finishes an asynchronous filter save previously started with user-content-filter-store:save.

self

Passed: a <WebKitUserContentFilterStore>.

a <WebKitUserContentFilterStore>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <WebKitUserContentFilter>.

a <WebKitUserContentFilter>, or #f if saving failed

Method: user-content-filter-store:save-from-file self identifier file [cancellable] [callback]
Method: save-from-file self identifier file [cancellable] [callback]

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 file:is-native?. See user-content-filter-store:save for more details.

When the operation is finished, callback will be invoked, which then can use user-content-filter-store:save-finish to obtain the resulting filter.

self

Passed: a <WebKitUserContentFilterStore>.

a <WebKitUserContentFilterStore>

identifier

Passed: a string.

a string used to identify the saved filter

file

Passed: a <GFile>.

a <GFile> containing the rule set in JSON format

cancellable

Passed, or left out: a <GCancellable>, or #f.

a <GCancellable> or #f to ignore

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when saving is completed

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to the callback function

Method: user-content-filter-store:save-from-file-finish self result ⇒ %return
Method: save-from-file-finish self result ⇒ %return

Finishes and asynchronous filter save previously started with user-content-filter-store:save-from-file.

self

Passed: a <WebKitUserContentFilterStore>.

a <WebKitUserContentFilterStore>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <WebKitUserContentFilter>.

a <WebKitUserContentFilter>, or #f if saving failed.