Class UserContentFilterStore
- All Implemented Interfaces:
Proxy
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().
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Inner class implementing a builder pattern to construct a GObject with properties.static class
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionUserContentFilterStore
(MemorySegment address) Create a UserContentFilterStore proxy instance for the provided memory address.UserContentFilterStore
(String storagePath) Create a newWebKitUserContentFilterStore
to manipulate filters stored atstoragePath
. -
Method Summary
Modifier and TypeMethodDescriptionprotected UserContentFilterStore
asParent()
Returns this instance as if it were its parent type.static UserContentFilterStore.Builder
<? extends UserContentFilterStore.Builder> builder()
AUserContentFilterStore.Builder
object constructs aUserContentFilterStore
with the specified properties.void
fetchIdentifiers
(@Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Asynchronously retrieve a list of the identifiers for all the stored filters.String[]
fetchIdentifiersFinish
(AsyncResult result) Finishes an asynchronous fetch of the list of stored filters.getPath()
Gets the storage path for user content filters.static Type
getType()
Get the GType of the UserContentFilterStore classvoid
load
(String identifier, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Asynchronously load a content filter given itsidentifier
.loadFinish
(AsyncResult result) Finishes an asynchronous filter load previously started with webkit_user_content_filter_store_load().void
remove
(String identifier, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Asynchronously remove a content filter given itsidentifier
.boolean
removeFinish
(AsyncResult result) Finishes an asynchronous filter removal previously started with webkit_user_content_filter_store_remove().void
save
(String identifier, Bytes source, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Asynchronously save a content filter from a set source rule.saveFinish
(AsyncResult result) Finishes an asynchronous filter save previously started with webkit_user_content_filter_store_save().void
saveFromFile
(String identifier, File file, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Asynchronously save a content filter from the contents of a file.saveFromFileFinish
(AsyncResult result) Finishes and asynchronous filter save previously started with webkit_user_content_filter_store_save_from_file().Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
UserContentFilterStore
Create a UserContentFilterStore proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
UserContentFilterStore
Create a newWebKitUserContentFilterStore
to manipulate filters stored atstoragePath
.The path must point to a local filesystem, and will be created if needed.
- Parameters:
storagePath
- path where data for filters will be stored on disk- Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
fetchIdentifiers
public void fetchIdentifiers(@Nullable @Nullable Cancellable cancellable, @Nullable @Nullable AsyncReadyCallback 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 webkit_user_content_filter_store_fetch_identifiers_finish() to obtain the list of filter identifiers.- Parameters:
cancellable
- aGCancellable
ornull
to ignorecallback
- aGAsyncReadyCallback
to call when the removal is completed
-
fetchIdentifiersFinish
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_user_content_filter_store_fetch_identifiers().
- Parameters:
result
- aGAsyncResult
- Returns:
- a
null
-terminated list of filter identifiers.
-
getPath
-
load
public void load(String identifier, @Nullable @Nullable Cancellable cancellable, @Nullable @Nullable AsyncReadyCallback callback) Asynchronously load a content filter given itsidentifier
.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:
identifier
- a filter identifiercancellable
- aGCancellable
ornull
to ignorecallback
- aGAsyncReadyCallback
to call when the load is completed
-
loadFinish
Finishes an asynchronous filter load previously started with webkit_user_content_filter_store_load().- Parameters:
result
- aGAsyncResult
- Returns:
- a
WebKitUserContentFilter
, ornull
if the load failed - Throws:
GErrorException
- seeGError
-
remove
public void remove(String identifier, @Nullable @Nullable Cancellable cancellable, @Nullable @Nullable AsyncReadyCallback callback) Asynchronously remove a content filter given itsidentifier
.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:
identifier
- a filter identifiercancellable
- aGCancellable
ornull
to ignorecallback
- aGAsyncReadyCallback
to call when the removal is completed
-
removeFinish
Finishes an asynchronous filter removal previously started with webkit_user_content_filter_store_remove().- Parameters:
result
- aGAsyncResult
- Returns:
- whether the removal was successful
- Throws:
GErrorException
- seeGError
-
save
public void save(String identifier, Bytes source, @Nullable @Nullable Cancellable cancellable, @Nullable @Nullable AsyncReadyCallback 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 webkit_user_content_filter_store_remove() and webkit_user_content_filter_store_load(). When theidentifier
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:
identifier
- a string used to identify the saved filtersource
-GBytes
containing the rule set in JSON formatcancellable
- aGCancellable
ornull
to ignorecallback
- aGAsyncReadyCallback
to call when saving is completed
-
saveFinish
Finishes an asynchronous filter save previously started with webkit_user_content_filter_store_save().- Parameters:
result
- aGAsyncResult
- Returns:
- a
WebKitUserContentFilter
, ornull
if saving failed - Throws:
GErrorException
- seeGError
-
saveFromFile
public void saveFromFile(String identifier, File file, @Nullable @Nullable Cancellable cancellable, @Nullable @Nullable AsyncReadyCallback 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 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:
identifier
- a string used to identify the saved filterfile
- aGFile
containing the rule set in JSON formatcancellable
- aGCancellable
ornull
to ignorecallback
- aGAsyncReadyCallback
to call when saving is completed
-
saveFromFileFinish
Finishes and asynchronous filter save previously started with webkit_user_content_filter_store_save_from_file().- Parameters:
result
- aGAsyncResult
- Returns:
- a
WebKitUserContentFilter
, ornull
if saving failed. - Throws:
GErrorException
- seeGError
-
builder
AUserContentFilterStore.Builder
object constructs aUserContentFilterStore
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withUserContentFilterStore.Builder.build()
.
-