diff options
author | Manuel Rego Casasnovas <rego@igalia.com> | 2013-02-25 21:17:11 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2013-03-02 22:32:31 +0800 |
commit | b5b4d3a8680ac4b7c7358af782cc823213b412bc (patch) | |
tree | d9506b788da308a959629c6c1d67f44f7dfb15e5 /src | |
parent | 8a00f5c726c9b1fbe3dbe346957d0d2dbaee008b (diff) | |
download | gsoc2013-epiphany-b5b4d3a8680ac4b7c7358af782cc823213b412bc.tar gsoc2013-epiphany-b5b4d3a8680ac4b7c7358af782cc823213b412bc.tar.gz gsoc2013-epiphany-b5b4d3a8680ac4b7c7358af782cc823213b412bc.tar.bz2 gsoc2013-epiphany-b5b4d3a8680ac4b7c7358af782cc823213b412bc.tar.lz gsoc2013-epiphany-b5b4d3a8680ac4b7c7358af782cc823213b412bc.tar.xz gsoc2013-epiphany-b5b4d3a8680ac4b7c7358af782cc823213b412bc.tar.zst gsoc2013-epiphany-b5b4d3a8680ac4b7c7358af782cc823213b412bc.zip |
Move code to get application icon from DOM to ephy-dom-utils
https://bugzilla.gnome.org/show_bug.cgi?id=694091
Diffstat (limited to 'src')
-rw-r--r-- | src/window-commands.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/window-commands.c b/src/window-commands.c index c60f4df52..d86ff06a1 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -658,6 +658,10 @@ download_icon_and_set_image (EphyApplicationDialogData *data) static void fill_default_application_image (EphyApplicationDialogData *data) { + WebKitDOMDocument *document; + const char *base_uri; + char *image = NULL; + char *color = NULL; gboolean res; data->icon_rgba.red = 0.5; @@ -665,9 +669,32 @@ fill_default_application_image (EphyApplicationDialogData *data) data->icon_rgba.blue = 0.5; data->icon_rgba.alpha = 0.3; - res = ephy_web_view_get_best_icon (WEBKIT_WEB_VIEW (data->view), - &data->icon_href, - &data->icon_rgba); + base_uri = webkit_web_view_get_uri (WEBKIT_WEB_VIEW (data->view)); + +#ifdef HAVE_WEBKIT2 + /* TODO use web extension to get image and color */ + res = FALSE; +#else + document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (data->view)); + res = ephy_web_dom_utils_get_best_icon (document, + base_uri, + &image, + &color); +#endif + + if (image != NULL) + { + data->icon_href = g_strdup (image); + } + + if (color != NULL) + { + gdk_rgba_parse (&data->icon_rgba, color); + } + + g_free (image); + g_free (color); + if (res) { download_icon_and_set_image (data); |