Fix compilation when BMP/PNG/GIF support is disabled.
svn path=/trunk/netsurf/; revision=9858
This commit is contained in:
parent
3c3536fd68
commit
5b0ad574b6
|
@ -270,10 +270,13 @@ void search_web_ico_callback(content_msg msg, struct content *ico,
|
|||
|
||||
case CONTENT_MSG_DONE:
|
||||
LOG(("got favicon '%s'", ico->url));
|
||||
#ifdef WITH_BMP
|
||||
if (ico->type == CONTENT_ICO) {
|
||||
search_ico = ico; /* cache */
|
||||
gui_window_set_search_ico(search_ico);
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
search_web_retrieve_ico(true);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1870,9 +1870,11 @@ void gui_window_set_icon(struct gui_window *_g, struct content *icon)
|
|||
GtkImage *iconImage = NULL;
|
||||
if (g->icoFav != NULL)
|
||||
g_object_unref(g->icoFav);
|
||||
#ifdef WITH_BMP
|
||||
if ((icon != NULL) && (icon->type == CONTENT_ICO)) {
|
||||
nsico_set_bitmap_from_size(icon, 16, 16);
|
||||
}
|
||||
#endif
|
||||
if ((icon != NULL) && (icon->bitmap != NULL)) {
|
||||
GdkPixbuf *pb = gtk_bitmap_get_primary(icon->bitmap);
|
||||
if ((pb != NULL) && (gdk_pixbuf_get_width(pb) > 0) &&
|
||||
|
@ -1905,9 +1907,12 @@ void gui_window_set_search_ico(struct content *ico)
|
|||
if (ico == NULL)
|
||||
ico = search_web_ico();
|
||||
|
||||
#ifdef WITH_BMP
|
||||
if ((ico != NULL) && (ico->type == CONTENT_ICO)) {
|
||||
nsico_set_bitmap_from_size(ico, 20, 20);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((ico != NULL) && (ico->bitmap != NULL)) {
|
||||
pbico = gtk_bitmap_get_primary(ico->bitmap);
|
||||
if ((pbico != NULL) && (gdk_pixbuf_get_width(pbico) > 0) &&
|
||||
|
|
|
@ -166,14 +166,31 @@ bool favicon_get_icon(struct content *c, xmlNode *html)
|
|||
void favicon_callback(content_msg msg, struct content *icon,
|
||||
intptr_t p1, intptr_t p2, union content_msg_data data)
|
||||
{
|
||||
static const content_type permitted_types[] = {
|
||||
#ifdef WITH_BMP
|
||||
CONTENT_ICO,
|
||||
#endif
|
||||
#if defined(WITH_MNG) || defined(WITH_PNG)
|
||||
CONTENT_PNG,
|
||||
#endif
|
||||
#ifdef WITH_GIF
|
||||
CONTENT_GIF,
|
||||
#endif
|
||||
CONTENT_UNKNOWN
|
||||
};
|
||||
struct content *c = (struct content *) p1;
|
||||
unsigned int i = p2;
|
||||
const content_type *type;
|
||||
|
||||
|
||||
switch (msg) {
|
||||
case CONTENT_MSG_LOADING:
|
||||
/* check that the favicon is really a correct image type */
|
||||
if (!((icon->type == CONTENT_ICO) ||
|
||||
(icon->type == CONTENT_PNG) ||
|
||||
(icon->type == CONTENT_GIF))) {
|
||||
for (type = permitted_types; *type != CONTENT_UNKNOWN; type++)
|
||||
if (icon->type == *type)
|
||||
break;
|
||||
|
||||
if (*type != CONTENT_UNKNOWN) {
|
||||
c->data.html.favicon = 0;
|
||||
LOG(("%s is not a favicon", icon->url));
|
||||
content_add_error(c, "NotFavIco", 0);
|
||||
|
|
Loading…
Reference in New Issue