mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-25 21:46:57 +03:00
about fetcher: Add about:nscolour.css generated colour stylesheet.
This commit is contained in:
parent
9fa6ac7113
commit
0e04059f53
@ -36,6 +36,7 @@
|
||||
#include "utils/log.h"
|
||||
#include "testament.h"
|
||||
#include "utils/corestrings.h"
|
||||
#include "utils/nscolour.h"
|
||||
#include "utils/nsoption.h"
|
||||
#include "utils/utils.h"
|
||||
#include "utils/messages.h"
|
||||
@ -786,6 +787,51 @@ fetch_about_config_handler_aborted:
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handler to generate the nscolours stylesheet
|
||||
*
|
||||
* \param ctx The fetcher context.
|
||||
* \return true if handled false if aborted.
|
||||
*/
|
||||
static bool fetch_about_nscolours_handler(struct fetch_about_context *ctx)
|
||||
{
|
||||
nserror res;
|
||||
const char *stylesheet;
|
||||
|
||||
/* content is going to return ok */
|
||||
fetch_set_http_code(ctx->fetchh, 200);
|
||||
|
||||
/* content type */
|
||||
if (fetch_about_send_header(ctx, "Content-Type: text/css; charset=utf-8")) {
|
||||
goto aborted;
|
||||
}
|
||||
|
||||
res = nscolour_get_stylesheet(&stylesheet);
|
||||
if (res != NSERROR_OK) {
|
||||
goto aborted;
|
||||
}
|
||||
|
||||
res = ssenddataf(ctx,
|
||||
"html {\n"
|
||||
"\tbackground-color: #%06x;\n"
|
||||
"}\n"
|
||||
"%s",
|
||||
colour_rb_swap(nscolours[NSCOLOUR_WIN_ODD_BG]),
|
||||
stylesheet);
|
||||
if (res != NSERROR_OK) {
|
||||
goto aborted;
|
||||
}
|
||||
|
||||
fetch_about_send_finished(ctx);
|
||||
|
||||
return true;
|
||||
|
||||
aborted:
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate the text of a Choices file which represents the current
|
||||
* in use options.
|
||||
|
Loading…
Reference in New Issue
Block a user