summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2010-01-21 23:48:34 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2010-01-21 23:48:34 +0000
commit5b0ad574b68b21ceef4ea167163c0a10d1d13d71 (patch)
treebb996417fbab422d5fb262417972f8d7c89b6daf
parent3c3536fd68f16ea9f995680fc24919acbffe1022 (diff)
downloadnetsurf-5b0ad574b68b21ceef4ea167163c0a10d1d13d71.tar.gz
netsurf-5b0ad574b68b21ceef4ea167163c0a10d1d13d71.tar.bz2
Fix compilation when BMP/PNG/GIF support is disabled.
svn path=/trunk/netsurf/; revision=9858
-rw-r--r--desktop/searchweb.c5
-rw-r--r--gtk/gtk_scaffolding.c5
-rw-r--r--render/favicon.c23
3 files changed, 29 insertions, 4 deletions
diff --git a/desktop/searchweb.c b/desktop/searchweb.c
index 69ef10d05..bc0f71ad4 100644
--- a/desktop/searchweb.c
+++ b/desktop/searchweb.c
@@ -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;
diff --git a/gtk/gtk_scaffolding.c b/gtk/gtk_scaffolding.c
index 31d745e27..e36cac89b 100644
--- a/gtk/gtk_scaffolding.c
+++ b/gtk/gtk_scaffolding.c
@@ -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) &&
diff --git a/render/favicon.c b/render/favicon.c
index bc64f0a9e..4b9d381a6 100644
--- a/render/favicon.c
+++ b/render/favicon.c
@@ -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);