Class FaviconDatabase

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public final class FaviconDatabase extends GObject

Provides access to the icons associated with web sites.

WebKit will automatically look for available icons in 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.

  • Constructor Details

    • FaviconDatabase

      public FaviconDatabase(MemorySegment address)
      Create a FaviconDatabase instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • FaviconDatabase

      public FaviconDatabase()
      Create a new FaviconDatabase.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the FaviconDatabase class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected FaviconDatabase asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • clear

      public void clear()
      Clears all icons from the database.
    • getFavicon

      public void getFavicon(String pageUri, @Nullable Cancellable cancellable, @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 favicon
      cancellable - A GCancellable or null.
      callback - A GAsyncReadyCallback to call when the request is satisfied or null if you don't care about the result.
    • getFaviconFinish

      public Texture getFaviconFinish(AsyncResult result) throws GErrorException
      Finishes an operation started with webkit_favicon_database_get_favicon().
      Parameters:
      result - A GAsyncResult obtained from the GAsyncReadyCallback passed to webkit_favicon_database_get_favicon()
      Returns:
      a new favicon image, or null in case of error.
      Throws:
      GErrorException - see GError
    • getFaviconUri

      public String getFaviconUri(String pageUri)
      Obtains the URI of the favicon for the given pageUri.
      Parameters:
      pageUri - URI of the page containing the icon
      Returns:
      a newly allocated URI for the favicon, or null if the database doesn't have a favicon for pageUri.
    • onFaviconChanged

      This signal is emitted when the favicon URI of pageUri has been changed to faviconUri 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 a WebKitWebView it's easier to use the WebKitWebView: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

      public void emitFaviconChanged(String pageUri, String faviconUri)
      Emits the "favicon-changed" signal. See onFaviconChanged(FaviconDatabase.FaviconChangedCallback).
    • builder

      public static FaviconDatabase.Builder<? extends FaviconDatabase.Builder> builder()
      A FaviconDatabase.Builder object constructs a FaviconDatabase with the specified properties. Use the various set...() methods to set properties, and finish construction with FaviconDatabase.Builder.build().
      Returns:
      the builder object