:right-sidebar: True UserContentFilterStore =================================================================== .. currentmodule:: gi.repository.WebKit .. versionadded:: 2.24 .. class:: UserContentFilterStore(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` :Constructors: :: UserContentFilterStore(**properties) new(storage_path:str) -> WebKit.UserContentFilterStore Constructors ------------ .. rst-class:: interim-class .. class:: UserContentFilterStore :no-index: .. classmethod:: new(storage_path: str) -> ~gi.repository.WebKit.UserContentFilterStore Create a new :obj:`~gi.repository.WebKit.UserContentFilterStore` to manipulate filters stored at ``storage_path``. The path must point to a local filesystem, and will be created if needed. .. versionadded:: 2.24 :param storage_path: path where data for filters will be stored on disk Methods ------- .. rst-class:: interim-class .. class:: UserContentFilterStore :no-index: .. method:: fetch_identifiers(cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[...], None] | None = None, *user_data: ~typing.Any) -> None 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 :func:`~gi.repository.WebKit.UserContentFilterStore.fetch_identifiers_finish` to obtain the list of filter identifiers. .. versionadded:: 2.24 :param cancellable: a :obj:`~gi.repository.Gio.Cancellable` or :const:`None` to ignore :param callback: a :obj:`~gi.repository.Gio.AsyncReadyCallback` to call when the removal is completed :param user_data: the data to pass to the callback function .. method:: fetch_identifiers_finish(result: ~gi.repository.Gio.AsyncResult) -> list[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 :func:`~gi.repository.WebKit.UserContentFilterStore.fetch_identifiers`. .. versionadded:: 2.24 :param result: a :obj:`~gi.repository.Gio.AsyncResult` .. method:: get_path() -> str Gets the storage path for user content filters. .. versionadded:: 2.24 .. method:: load(identifier: str, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[...], None] | None = None, *user_data: ~typing.Any) -> None Asynchronously load a content filter given its ``identifier``. The filter must have been previously stored using :func:`~gi.repository.WebKit.UserContentFilterStore.save`. When the operation is finished, ``callback`` will be invoked, which then can use :func:`~gi.repository.WebKit.UserContentFilterStore.load_finish` to obtain the resulting filter. .. versionadded:: 2.24 :param identifier: a filter identifier :param cancellable: a :obj:`~gi.repository.Gio.Cancellable` or :const:`None` to ignore :param callback: a :obj:`~gi.repository.Gio.AsyncReadyCallback` to call when the load is completed :param user_data: the data to pass to the callback function .. method:: load_finish(result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.WebKit.UserContentFilter Finishes an asynchronous filter load previously started with :func:`~gi.repository.WebKit.UserContentFilterStore.load`. .. versionadded:: 2.24 :param result: a :obj:`~gi.repository.Gio.AsyncResult` .. method:: remove(identifier: str, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[...], None] | None = None, *user_data: ~typing.Any) -> None Asynchronously remove a content filter given its ``identifier``. When the operation is finished, ``callback`` will be invoked, which then can use :func:`~gi.repository.WebKit.UserContentFilterStore.remove_finish` to check whether the removal was successful. .. versionadded:: 2.24 :param identifier: a filter identifier :param cancellable: a :obj:`~gi.repository.Gio.Cancellable` or :const:`None` to ignore :param callback: a :obj:`~gi.repository.Gio.AsyncReadyCallback` to call when the removal is completed :param user_data: the data to pass to the callback function .. method:: remove_finish(result: ~gi.repository.Gio.AsyncResult) -> bool Finishes an asynchronous filter removal previously started with :func:`~gi.repository.WebKit.UserContentFilterStore.remove`. .. versionadded:: 2.24 :param result: a :obj:`~gi.repository.Gio.AsyncResult` .. method:: save(identifier: str, source: ~gi.repository.GLib.Bytes, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[...], None] | None = None, *user_data: ~typing.Any) -> None 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 :func:`~gi.repository.WebKit.UserContentFilterStore.remove` and :func:`~gi.repository.WebKit.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 :func:`~gi.repository.WebKit.UserContentFilterStore.save_finish` to obtain the resulting filter. .. versionadded:: 2.24 :param identifier: a string used to identify the saved filter :param source: :obj:`~gi.repository.GLib.Bytes` containing the rule set in JSON format :param cancellable: a :obj:`~gi.repository.Gio.Cancellable` or :const:`None` to ignore :param callback: a :obj:`~gi.repository.Gio.AsyncReadyCallback` to call when saving is completed :param user_data: the data to pass to the callback function .. method:: save_finish(result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.WebKit.UserContentFilter Finishes an asynchronous filter save previously started with :func:`~gi.repository.WebKit.UserContentFilterStore.save`. .. versionadded:: 2.24 :param result: a :obj:`~gi.repository.Gio.AsyncResult` .. method:: save_from_file(identifier: str, file: ~gi.repository.Gio.File, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[...], None] | None = None, *user_data: ~typing.Any) -> None 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 :func:`~gi.repository.Gio.File.is_native`. See :func:`~gi.repository.WebKit.UserContentFilterStore.save` for more details. When the operation is finished, ``callback`` will be invoked, which then can use :func:`~gi.repository.WebKit.UserContentFilterStore.save_finish` to obtain the resulting filter. .. versionadded:: 2.24 :param identifier: a string used to identify the saved filter :param file: a :obj:`~gi.repository.Gio.File` containing the rule set in JSON format :param cancellable: a :obj:`~gi.repository.Gio.Cancellable` or :const:`None` to ignore :param callback: a :obj:`~gi.repository.Gio.AsyncReadyCallback` to call when saving is completed :param user_data: the data to pass to the callback function .. method:: save_from_file_finish(result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.WebKit.UserContentFilter Finishes and asynchronous filter save previously started with :func:`~gi.repository.WebKit.UserContentFilterStore.save_from_file`. .. versionadded:: 2.24 :param result: a :obj:`~gi.repository.Gio.AsyncResult` Properties ---------- .. rst-class:: interim-class .. class:: UserContentFilterStore :no-index: .. attribute:: props.path :type: str The directory used for filter storage. This path is used as the base directory where user content filters are stored on disk. .. versionadded:: 2.24