Lookup favicons in 'link' tags via GJS

This commit is contained in:
Dale Whittaker 2008-07-30 01:34:37 +02:00 committed by Christian Dywan
parent 6a32c93138
commit 630e88d9af

View file

@ -467,9 +467,13 @@ gjs_value_links_foreach_cb (GjsValue* link,
MidoriWebView* web_view)
{
const gchar* type;
const gchar* rel;
GFile* icon_file;
GIcon* icon;
if (gjs_value_is_object (link) && gjs_value_has_attribute (link, "type")
&& gjs_value_has_attribute (link, "href"))
if (gjs_value_is_object (link) && gjs_value_has_attribute (link, "href"))
{
if (gjs_value_has_attribute (link, "type"))
{
type = gjs_value_get_attribute_string (link, "type");
if (!strcmp (type, "application/rss+xml")
@ -480,6 +484,19 @@ gjs_value_links_foreach_cb (GjsValue* link,
gjs_value_has_attribute (link, "title")
? gjs_value_get_attribute_string (link, "title") : NULL);
}
if (gjs_value_has_attribute (link, "rel"))
{
rel = gjs_value_get_attribute_string (link, "rel");
if (!strcmp (rel, "icon") || !strcmp (rel, "shortcut icon"))
{
icon_file = g_file_new_for_uri (
gjs_value_get_attribute_string (link, "href"));
icon = g_file_icon_new (icon_file);
g_loadable_icon_load_async (G_LOADABLE_ICON (icon),
0, NULL, (GAsyncReadyCallback)loadable_icon_finish_cb, web_view);
}
}
}
}
static void