Class FaviconDatabase
- All Implemented Interfaces:
Proxy
WebKit will automatically look for available icons in <link> elements on opened pages as well as an existing favicon.ico and load the images found into a memory cache if possible. That cache is frozen to an on-disk database for persistence.
If WebKitSettings
:enable-private-browsing is true
, new icons
won't be added to the on-disk database and no existing icons will
be deleted from it. Nevertheless, WebKit will still store them in
the in-memory cache during the current execution.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
FaviconDatabase.Builder<B extends FaviconDatabase.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theFaviconChangedCallback
callback.static class
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionFaviconDatabase
(MemorySegment address) Create a FaviconDatabase proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected FaviconDatabase
asParent()
Returns this instance as if it were its parent type.static FaviconDatabase.Builder
<? extends FaviconDatabase.Builder> builder()
AFaviconDatabase.Builder
object constructs aFaviconDatabase
with the specified properties.void
clear()
Clears all icons from the database.void
emitFaviconChanged
(String pageUri, String faviconUri) Emits the "favicon-changed" signal.void
getFavicon
(String pageUri, @Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Asynchronously obtains a favicon image.getFaviconFinish
(AsyncResult result) Finishes an operation started with webkit_favicon_database_get_favicon().getFaviconUri
(String pageUri) Obtains the URI of the favicon for the givenpageUri
.static Type
getType()
Get the GType of the FaviconDatabase classThis signal is emitted when the favicon URI ofpageUri
has been changed tofaviconUri
in the database.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
-
FaviconDatabase
Create a FaviconDatabase proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
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. -
clear
public void clear()Clears all icons from the database. -
getFavicon
public void getFavicon(String pageUri, @Nullable @Nullable Cancellable cancellable, @Nullable @Nullable AsyncReadyCallback callback) Asynchronously obtains a favicon image.Asynchronously obtains an image of the favicon for the given page URI. It returns the cached icon if it's in the database asynchronously waiting for the icon to be read from the database.
This is an asynchronous method. When the operation is finished, callback will be invoked. You can then call webkit_favicon_database_get_favicon_finish() to get the result of the operation.
- Parameters:
pageUri
- URI of the page for which we want to retrieve the faviconcancellable
- AGCancellable
ornull
.callback
- AGAsyncReadyCallback
to call when the request is satisfied ornull
if you don't care about the result.
-
getFaviconFinish
Finishes an operation started with webkit_favicon_database_get_favicon().- Parameters:
result
- AGAsyncResult
obtained from theGAsyncReadyCallback
passed to webkit_favicon_database_get_favicon()- Returns:
- a new favicon image, or
null
in case of error. - Throws:
GErrorException
- seeGError
-
getFaviconUri
-
onFaviconChanged
public SignalConnection<FaviconDatabase.FaviconChangedCallback> onFaviconChanged(FaviconDatabase.FaviconChangedCallback handler) This signal is emitted when the favicon URI ofpageUri
has been changed tofaviconUri
in the database. You can connect to this signal and call webkit_favicon_database_get_favicon() to get the favicon. If you are interested in the favicon of aWebKitWebView
it's easier to use theWebKitWebView
:favicon property. See webkit_web_view_get_favicon() for more details.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitFaviconChanged
Emits the "favicon-changed" signal. SeeonFaviconChanged(org.gnome.webkit.FaviconDatabase.FaviconChangedCallback)
. -
builder
AFaviconDatabase.Builder
object constructs aFaviconDatabase
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withFaviconDatabase.Builder.build()
.
-