From 15342b5f5bc741565a848fbc0abb351dd8dd02a5 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 7 Apr 2020 21:25:16 +0100 Subject: About pages: Update presentation using nscolour. --- content/fetchers/about.c | 195 +++++++++++++++++++++++------------------------ resources/internal.css | 74 +++++------------- 2 files changed, 115 insertions(+), 154 deletions(-) diff --git a/content/fetchers/about.c b/content/fetchers/about.c index 02eb79d3e..249d372f0 100644 --- a/content/fetchers/about.c +++ b/content/fetchers/about.c @@ -282,6 +282,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx) unsigned int cent_loop = 0; int elen = 0; /* entry length */ nserror res; + bool even = false; /* content is going to return ok */ fetch_set_http_code(ctx->fetchh, code); @@ -293,16 +294,12 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx) /* page head */ res = ssenddataf(ctx, "\n\n" - "NetSurf Browser Image Cache Status\n" + "Image Cache Status\n" "\n" "\n" - "\n" - "

" - "" - "\"NetSurf\"" - "

\n" - "

NetSurf Browser Image Cache Status

\n"); + "\n" + "

Image Cache Status

\n"); if (res != NSERROR_OK) { goto fetch_about_imagecache_handler_aborted; } @@ -324,7 +321,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx) "(from %v images converted more than once)" "

\n" "

Bitmap of size %w had most (%x) conversions

\n" - "

Current image cache contents

\n"); + "

Current contents

\n"); if (slen >= (int) (sizeof(buffer))) { goto fetch_about_imagecache_handler_aborted; /* overflow */ } @@ -355,19 +352,35 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx) slen = 0; do { - elen = image_cache_snentryf(buffer + slen, - sizeof buffer - slen, - cent_loop, - "" - "%e" - "%k" - "%r" - "%c" - "%a" - "%g" - "%s" - "%o" - "\n"); + if (even) { + elen = image_cache_snentryf(buffer + slen, + sizeof buffer - slen, + cent_loop, + "" + "%e" + "%k" + "%r" + "%c" + "%a" + "%g" + "%s" + "%o" + "\n"); + } else { + elen = image_cache_snentryf(buffer + slen, + sizeof buffer - slen, + cent_loop, + "" + "%e" + "%k" + "%r" + "%c" + "%a" + "%g" + "%s" + "%o" + "\n"); + } if (elen <= 0) break; /* last option */ @@ -381,6 +394,7 @@ static bool fetch_about_imagecache_handler(struct fetch_about_context *ctx) /* normal addition */ slen += elen; cent_loop++; + even = !even; } } while (elen > 0); @@ -582,29 +596,6 @@ static bool fetch_about_certificate_handler(struct fetch_about_context *ctx) nserror res; struct cert_chain *chain = NULL; - colour bg; - colour fg; - colour border; - colour outside; - - res = ns_system_colour_char("Window", &bg); - if (res != NSERROR_OK) { - return false; - } - - res = ns_system_colour_char("WindowText", &fg); - if (res != NSERROR_OK) { - return false; - } - - outside = mix_colour(fg, bg, 0x0c); - border = mix_colour(fg, bg, 0x40); - - bg = colour_rb_swap(bg); - fg = colour_rb_swap(fg); - border = colour_rb_swap(border); - outside = colour_rb_swap(outside); - /* content is going to return ok */ fetch_set_http_code(ctx->fetchh, code); @@ -618,23 +609,9 @@ static bool fetch_about_certificate_handler(struct fetch_about_context *ctx) "NetSurf Browser Certificate Viewer\n" "\n" - "\n" "\n" - "\n" - "

Certificate

\n", - outside, fg, bg, border, border); + "\n" + "

Certificate

\n"); if (res != NSERROR_OK) { goto fetch_about_certificate_handler_aborted; } @@ -652,14 +629,14 @@ static bool fetch_about_certificate_handler(struct fetch_about_context *ctx) size_t depth; for (depth = 0; depth < chain->depth; depth++) { res = ssenddataf(ctx, - "

Certificate: %d

\n" + "

Certificate: %d

\n" "

Subject: %s

" "

Serial Number: %s

" "

Type: %i

" "

Version: %ld

" "

Issuer: %s

" "

Valid From: %s

" - "

Valid Untill: %s

", + "

Valid Until: %s

", depth, cert_info[depth].subject, cert_info[depth].serialnum, @@ -716,6 +693,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) unsigned int opt_loop = 0; int elen = 0; /* entry length */ nserror res; + bool even = false; /* content is going to return ok */ fetch_set_http_code(ctx->fetchh, 200); @@ -726,23 +704,21 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) } res = ssenddataf(ctx, - "\n\n" - "NetSurf Browser Config\n" - "\n" - "\n" - "\n" - "

" - "" - "\"NetSurf\"" - "

\n" - "

NetSurf Browser Config

\n" - "\n" - "" - "" - "" - "\n"); + "\n\n" + "NetSurf Browser Config\n" + "\n" + "\n" + "\n" + "

NetSurf Browser Config

\n" + "
OptionTypeProvenanceSetting
\n" + "" + "" + "" + "\n"); if (res != NSERROR_OK) { goto fetch_about_config_handler_aborted; } @@ -751,10 +727,27 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) msg.data.header_or_data.buf = (const uint8_t *) buffer; do { - elen = nsoption_snoptionf(buffer + slen, - sizeof buffer - slen, - opt_loop, - "\n"); + if (even) { + elen = nsoption_snoptionf(buffer + slen, + sizeof buffer - slen, + opt_loop, + "" + "" + "" + "" + "" + "\n"); + } else { + elen = nsoption_snoptionf(buffer + slen, + sizeof buffer - slen, + opt_loop, + "" + "" + "" + "" + "" + "\n"); + } if (elen <= 0) break; /* last option */ @@ -768,6 +761,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) /* normal addition */ slen += elen; opt_loop++; + even = !even; } } while (elen > 0); @@ -1162,17 +1156,15 @@ static bool fetch_about_query_auth_handler(struct fetch_about_context *ctx) goto fetch_about_query_auth_handler_aborted; } - title = messages_get("LoginTitle"); - res = ssenddataf(ctx, "\n\n" "%s\n" "\n" "\n" - "\n" - "

%s

\n", + "\n" + "

%s

\n", title, title); if (res != NSERROR_OK) { goto fetch_about_query_auth_handler_aborted; @@ -1331,8 +1323,8 @@ static bool fetch_about_query_privacy_handler(struct fetch_about_context *ctx) "\n" "\n" - "\n" - "

%s

\n", + "\n" + "

%s

\n", title, title); if (res != NSERROR_OK) { goto fetch_about_query_ssl_handler_aborted; @@ -1453,8 +1445,8 @@ static bool fetch_about_query_timeout_handler(struct fetch_about_context *ctx) "\n" "\n" - "\n" - "

%s

\n", + "\n" + "

%s

\n", title, title); if (res != NSERROR_OK) { goto fetch_about_query_timeout_handler_aborted; @@ -1576,8 +1568,8 @@ fetch_about_query_fetcherror_handler(struct fetch_about_context *ctx) "\n" "\n" - "\n" - "

%s

\n", + "\n" + "

%s

\n", title, title); if (res != NSERROR_OK) { goto fetch_about_query_fetcherror_handler_aborted; @@ -1711,6 +1703,13 @@ struct about_handlers about_handler_list[] = { fetch_about_about_handler, true }, + { + "nscolours.css", + SLEN("nscolours.css"), + NULL, + fetch_about_nscolours_handler, + true + }, { "logo", SLEN("logo"), @@ -1795,16 +1794,12 @@ static bool fetch_about_about_handler(struct fetch_about_context *ctx) res = ssenddataf(ctx, "\n\n" - "NetSurf List of About pages\n" + "List of NetSurf pages\n" "\n" "\n" - "\n" - "

" - "" - "\"NetSurf\"" - "

\n" - "

NetSurf List of About pages

\n" + "\n" + "

List of NetSurf pages

\n" "
OptionTypeProvenanceSetting
%k%t%p%V
%k%t%p%V
%k%t%p%V