WebKit2.FaviconDatabase

g GObject.Object GObject.Object WebKit2.FaviconDatabase WebKit2.FaviconDatabase GObject.Object->WebKit2.FaviconDatabase

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

clear ()

get_favicon (page_uri, cancellable, callback, *user_data)

get_favicon_finish (result)

get_favicon_uri (page_uri)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Name

Short Description

favicon-changed

This signal is emitted when the favicon URI of page_uri has been changed to favicon_uri in the database.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class WebKit2.FaviconDatabase(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

WebKit2.FaviconDatabaseClass

Provides access to the icons associated with web sites.

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 WebKit2.Settings :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.

clear()

Clears all icons from the database.

get_favicon(page_uri, cancellable, callback, *user_data)
Parameters:

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 WebKit2.FaviconDatabase.get_favicon_finish() to get the result of the operation.

get_favicon_finish(result)
Parameters:

result (Gio.AsyncResult) – A Gio.AsyncResult obtained from the Gio.AsyncReadyCallback passed to WebKit2.FaviconDatabase.get_favicon()

Raises:

GLib.Error

Returns:

a new favicon image, or None in case of error.

Return type:

cairo.Surface

Finishes an operation started with WebKit2.FaviconDatabase.get_favicon().

get_favicon_uri(page_uri)
Parameters:

page_uri (str) – URI of the page containing the icon

Returns:

a newly allocated URI for the favicon, or None if the database doesn’t have a favicon for page_uri.

Return type:

str

Obtains the URI of the favicon for the given page_uri.

Signal Details

WebKit2.FaviconDatabase.signals.favicon_changed(favicon_database, page_uri, favicon_uri)
Signal Name:

favicon-changed

Flags:

RUN_LAST

Parameters:
  • favicon_database (WebKit2.FaviconDatabase) – The object which received the signal

  • page_uri (str) – the URI of the Web page containing the icon

  • favicon_uri (str) – the URI of the favicon

This signal is emitted when the favicon URI of page_uri has been changed to favicon_uri in the database. You can connect to this signal and call WebKit2.FaviconDatabase.get_favicon() to get the favicon. If you are interested in the favicon of a WebKit2.WebView it’s easier to use the WebKit2.WebView :favicon property. See WebKit2.WebView.get_favicon() for more details.