WebKitUserContentFilterStore

WebKitUserContentFilterStore — Handles storage of user content filters on disk.

Functions

Properties

gchar * path Read / Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ╰── WebKitUserContentFilterStore

Description

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 webkit_user_content_manager_add_filter().

JSON rule sets are imported using webkit_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 webkit_user_content_filter_store_fetch_identifiers(), webkit_user_content_filter_store_load() can be used to retrieve a previously saved filter, and removed from the store with webkit_user_content_filter_store_remove().

Functions

webkit_user_content_filter_store_new ()

WebKitUserContentFilterStore *
webkit_user_content_filter_store_new (const gchar *storage_path);

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.

Parameters

storage_path

path where data for filters will be stored on disk

 

Returns

a newly created WebKitUserContentFilterStore.

[transfer full]

Since: 2.24


webkit_user_content_filter_store_get_path ()

const gchar *
webkit_user_content_filter_store_get_path
                               (WebKitUserContentFilterStore *store);

Parameters

Returns

The storage path for user content filters.

[transfer none]

Since: 2.24


webkit_user_content_filter_store_save ()

void
webkit_user_content_filter_store_save (WebKitUserContentFilterStore *store,
                                       const gchar *identifier,
                                       GBytes *source,
                                       GCancellable *cancellable,
                                       GAsyncReadyCallback callback,
                                       gpointer user_data);

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_user_content_filter_store_remove() and webkit_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 webkit_user_content_filter_store_save_finish() to obtain the resulting filter.

Parameters

store

a WebKitUserContentFilterStore

 

identifier

a string used to identify the saved filter

 

source

GBytes containing the rule set in JSON format

 

cancellable

a GCancellable or NULL to ignore.

[allow-none]

callback

a GAsyncReadyCallback to call when saving is completed.

[scope async]

user_data

the data to pass to the callback function.

[closure]

Since: 2.24


webkit_user_content_filter_store_save_finish ()

WebKitUserContentFilter *
webkit_user_content_filter_store_save_finish
                               (WebKitUserContentFilterStore *store,
                                GAsyncResult *result,
                                GError **error);

Finishes an asynchronous filter save previously started with webkit_user_content_filter_store_save().

Parameters

store

a WebKitUserContentFilterStore

 

result

a GAsyncResult

 

error

return location for error or NULL to ignore

 

Returns

a WebKitUserContentFilter, or NULL if saving failed.

[transfer full]

Since: 2.24


webkit_user_content_filter_store_save_from_file ()

void
webkit_user_content_filter_store_save_from_file
                               (WebKitUserContentFilterStore *store,
                                const gchar *identifier,
                                GFile *file,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Asynchronously save a content filter from the contents of a file, which must be native to the platform, as checked by g_file_is_native(). See webkit_user_content_filter_store_save() for more details.

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

Parameters

store

a WebKitUserContentFilterStore

 

identifier

a string used to identify the saved filter

 

file

a GFile containing the rule set in JSON format

 

cancellable

a GCancellable or NULL to ignore.

[allow-none]

callback

a GAsyncReadyCallback to call when saving is completed.

[scope async]

user_data

the data to pass to the callback function.

[closure]

Since: 2.24


webkit_user_content_filter_store_save_from_file_finish ()

WebKitUserContentFilter *
webkit_user_content_filter_store_save_from_file_finish
                               (WebKitUserContentFilterStore *store,
                                GAsyncResult *result,
                                GError **error);

Finishes and asynchronous filter save previously started with webkit_user_content_filter_store_save_from_file().

Parameters

store

a WebKitUserContentFilterStore

 

result

a GAsyncResult

 

error

return location for error or NULL to ignore

 

Returns

a WebKitUserContentFilter, or NULL if saving failed.

[transfer full]

Since: 2.24


webkit_user_content_filter_store_load ()

void
webkit_user_content_filter_store_load (WebKitUserContentFilterStore *store,
                                       const gchar *identifier,
                                       GCancellable *cancellable,
                                       GAsyncReadyCallback callback,
                                       gpointer user_data);

Asynchronously load a content filter given its identifier . The filter must have been previously stored using webkit_user_content_filter_store_save().

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

Parameters

store

a WebKitUserContentFilterStore

 

identifier

a filter identifier

 

cancellable

a GCancellable or NULL to ignore.

[allow-none]

callback

a GAsyncReadyCallback to call when the load is completed.

[scope async]

user_data

the data to pass to the callback function.

[closure]

Since: 2.24


webkit_user_content_filter_store_load_finish ()

WebKitUserContentFilter *
webkit_user_content_filter_store_load_finish
                               (WebKitUserContentFilterStore *store,
                                GAsyncResult *result,
                                GError **error);

Finishes an asynchronous filter load previously started with webkit_user_content_filter_store_load().

Parameters

store

a WebKitUserContentFilterStore

 

result

a GAsyncResult

 

error

return location for error or NULL to ignore

 

Returns

a WebKitUserContentFilter, or NULL if the load failed.

[transfer full]

Since: 2.24


webkit_user_content_filter_store_remove ()

void
webkit_user_content_filter_store_remove
                               (WebKitUserContentFilterStore *store,
                                const gchar *identifier,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Asynchronously remove a content filter given its identifier .

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

Parameters

store

a WebKitUserContentFilterStore

 

identifier

a filter identifier

 

cancellable

a GCancellable or NULL to ignore.

[allow-none]

callback

a GAsyncReadyCallback to call when the removal is completed.

[scope async]

user_data

the data to pass to the callback function.

[closure]

Since: 2.24


webkit_user_content_filter_store_remove_finish ()

gboolean
webkit_user_content_filter_store_remove_finish
                               (WebKitUserContentFilterStore *store,
                                GAsyncResult *result,
                                GError **error);

Finishes an asynchronous filter removal previously started with webkit_user_content_filter_store_remove().

Parameters

store

a WebKitUserContentFilterStore

 

result

a GAsyncResult

 

error

return location for error or NULL to ignore

 

Returns

whether the removal was successful

Since: 2.24


webkit_user_content_filter_store_fetch_identifiers ()

void
webkit_user_content_filter_store_fetch_identifiers
                               (WebKitUserContentFilterStore *store,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

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_user_content_filter_store_fetch_identifiers_finish() to obtain the list of filter identifiers.

Parameters

store

a WebKitUserContentFilterStore

 

cancellable

a GCancellable or NULL to ignore.

[allow-none]

callback

a GAsyncReadyCallback to call when the removal is completed.

[scope async]

user_data

the data to pass to the callback function.

[closure]

Since: 2.24


webkit_user_content_filter_store_fetch_identifiers_finish ()

gchar **
webkit_user_content_filter_store_fetch_identifiers_finish
                               (WebKitUserContentFilterStore *store,
                                GAsyncResult *result);

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

Parameters

Returns

a NULL-terminated list of filter identifiers.

[transfer full][array zero-terminated=1][element-type utf8]

Since: 2.24

Types and Values

struct WebKitUserContentFilterStore

struct WebKitUserContentFilterStore;

Property Details

The “path” property

  “path”                     gchar *

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

Flags: Read / Write / Construct Only

Default value: NULL

Since: 2.24