Top |
WebKitUserContentFilterStoreWebKitUserContentFilterStore — 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 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()
.
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.
Since: 2.24
const gchar *
webkit_user_content_filter_store_get_path
(WebKitUserContentFilterStore *store
);
Since: 2.24
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.
store |
||
identifier |
a string used to identify the saved filter |
|
source |
GBytes containing the rule set in JSON format |
|
cancellable |
a GCancellable or |
[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
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()
.
Since: 2.24
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.
store |
||
identifier |
a string used to identify the saved filter |
|
file |
a GFile containing the rule set in JSON format |
|
cancellable |
a GCancellable or |
[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
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()
.
Since: 2.24
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.
store |
||
identifier |
a filter identifier |
|
cancellable |
a GCancellable or |
[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
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()
.
Since: 2.24
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.
store |
||
identifier |
a filter identifier |
|
cancellable |
a GCancellable or |
[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
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()
.
Since: 2.24
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.
store |
||
cancellable |
a GCancellable or |
[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
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()
.
a NULL
-terminated list of filter identifiers.
[transfer full][array zero-terminated=1][element-type utf8]
Since: 2.24
“path”
property “path” char *
The directory used for filter storage. This path is used as the base directory where user content filters are stored on disk.
Owner: WebKitUserContentFilterStore
Flags: Read / Write / Construct Only
Default value: NULL
Since: 2.24