diff options
author | James Bursa <james@netsurf-browser.org> | 2005-01-13 22:42:39 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2005-01-13 22:42:39 +0000 |
commit | f0b264670e57d1eefd6f7e297b87cedf38d8be9a (patch) | |
tree | a9f2680f01e5cb9dab890b83ce05954a87bc8793 /content/content.c | |
parent | a76404dfd076925eebeb8166f588e0d5e7a9fdd3 (diff) | |
download | netsurf-f0b264670e57d1eefd6f7e297b87cedf38d8be9a.tar.gz netsurf-f0b264670e57d1eefd6f7e297b87cedf38d8be9a.tar.bz2 |
[project @ 2005-01-13 22:42:38 by bursa]
Start on theme auto-install. Fix content_add_user() not to broadcast error on memory exhaustion.
svn path=/import/netsurf/; revision=1448
Diffstat (limited to 'content/content.c')
-rw-r--r-- | content/content.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/content/content.c b/content/content.c index 9dac5fa85..c9ad560a5 100644 --- a/content/content.c +++ b/content/content.c @@ -61,9 +61,12 @@ struct mime_entry { /** A map from MIME type to ::content_type. Must be sorted by mime_type. */ static const struct mime_entry mime_map[] = { #ifdef WITH_DRAW - {"application/drawfile", CONTENT_DRAW}, - {"application/x-drawfile", CONTENT_DRAW}, - {"image/drawfile", CONTENT_DRAW}, + {"application/drawfile", CONTENT_DRAW}, + {"application/x-drawfile", CONTENT_DRAW}, +#ifdef WITH_THEME_INSTALL + {"application/x-netsurf-theme", CONTENT_THEME}, +#endif + {"image/drawfile", CONTENT_DRAW}, #endif #ifdef WITH_GIF {"image/gif", CONTENT_GIF}, @@ -127,6 +130,9 @@ const char *content_type_name[] = { #ifdef WITH_PLUGIN "PLUGIN", #endif +#ifdef WITH_THEME_INSTALL + "THEME", +#endif "OTHER", "UNKNOWN" }; @@ -198,6 +204,9 @@ static const struct handler_entry handler_map[] = { plugin_open, plugin_close, true}, #endif +#ifdef WITH_THEME_INSTALL + {0, 0, 0, 0, 0, 0, 0, 0, 0, false}, +#endif {0, 0, 0, 0, 0, 0, 0, 0, 0, false} }; #define HANDLER_MAP_COUNT (sizeof(handler_map) / sizeof(handler_map[0])) @@ -716,10 +725,10 @@ bool content_redraw(struct content *c, int x, int y, /** * Register a user for callbacks. * - * \param c The content to register - * \param callback The callback function - * \param p1, p2 Callback private data - * \return true on success, false otherwise and error broadcast to users + * \param c the content to register + * \param callback the callback function + * \param p1, p2 callback private data + * \return true on success, false otherwise on memory exhaustion * * The callback will be called with p1 and p2 when content_broadcast() is * called with the content. @@ -731,16 +740,11 @@ bool content_add_user(struct content *c, void *p1, void *p2) { struct content_user *user; - union content_msg_data msg_data; LOG(("content %s, user %p %p %p", c->url, callback, p1, p2)); user = calloc(1, sizeof(*user)); - if (!user) { - c->status = CONTENT_STATUS_ERROR; - msg_data.error = messages_get("NoMemory"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + if (!user) return false; - } user->callback = callback; user->p1 = p1; user->p2 = p2; |