mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-23 06:51:26 +03:00
Improve options output
improve options:config styling svn path=/trunk/netsurf/; revision=12084
This commit is contained in:
parent
bd39eb4267
commit
d90ca6181b
@ -159,3 +159,18 @@ body#dirlist span.size + span.size {
|
||||
text-align: left;
|
||||
padding-right: 0; }
|
||||
|
||||
/*
|
||||
* configuration listing style
|
||||
*/
|
||||
|
||||
body#configlist table.config th {
|
||||
text-align: left; }
|
||||
|
||||
body#configlist table.config td {
|
||||
padding-left: 1em; }
|
||||
|
||||
body#configlist table.config td + td {
|
||||
padding-left: 3em; }
|
||||
|
||||
body#configlist .null-content {
|
||||
font-style: italic; }
|
||||
|
@ -16,7 +16,12 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* about: URL handling. Based on the data fetcher by Rob Kendrick */
|
||||
/* about: URL handling.
|
||||
*
|
||||
* Based on the data fetcher by Rob Kendrick
|
||||
* This fetcher provides a simple scheme for the user to access
|
||||
* information from the browser from a known, fixed URL.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@ -182,16 +187,8 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
|
||||
"<html><head><title>NetSurf Browser Config</title>"
|
||||
"<link rel=\"stylesheet\" title=\"Standard\" "
|
||||
"type=\"text/css\" href=\"resource:internal.css\">"
|
||||
"<style>"
|
||||
"table.config th {"
|
||||
"text-align: left; }"
|
||||
"table.config td {"
|
||||
"padding-left: 1em; }"
|
||||
"table.config td + td {"
|
||||
"padding-left: 3em; }"
|
||||
"</style>"
|
||||
"</head>"
|
||||
"<body>"
|
||||
"<body id =\"configlist\">"
|
||||
"<p class=\"banner\">"
|
||||
"<a href=\"http://www.netsurf-browser.org/\">"
|
||||
"<img src=\"resource:netsurf.png\" alt=\"NetSurf\"></a>"
|
||||
|
@ -425,7 +425,7 @@ void options_read(const char *path)
|
||||
/* exported interface documented in options.h */
|
||||
void options_write(const char *path)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int entry;
|
||||
FILE *fp;
|
||||
colour rgbcolour; /* RRGGBB */
|
||||
|
||||
@ -435,35 +435,37 @@ void options_write(const char *path)
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i != option_table_entries; i++) {
|
||||
fprintf(fp, "%s:", option_table[i].key);
|
||||
switch (option_table[i].type) {
|
||||
for (entry = 0; entry != option_table_entries; entry++) {
|
||||
switch (option_table[entry].type) {
|
||||
case OPTION_BOOL:
|
||||
fprintf(fp, "%c", *((bool *) option_table[i].p) ?
|
||||
'1' : '0');
|
||||
fprintf(fp, "%s:%c\n", option_table[entry].key,
|
||||
*((bool *) option_table[entry].p) ? '1' : '0');
|
||||
break;
|
||||
|
||||
case OPTION_INTEGER:
|
||||
fprintf(fp, "%i", *((int *) option_table[i].p));
|
||||
fprintf(fp, "%s:%i\n", option_table[entry].key,
|
||||
*((int *) option_table[entry].p));
|
||||
break;
|
||||
|
||||
case OPTION_COLOUR:
|
||||
rgbcolour = ((0x000000FF & *((colour *)
|
||||
option_table[i].p)) << 16) |
|
||||
option_table[entry].p)) << 16) |
|
||||
((0x0000FF00 & *((colour *)
|
||||
option_table[i].p)) << 0) |
|
||||
option_table[entry].p)) << 0) |
|
||||
((0x00FF0000 & *((colour *)
|
||||
option_table[i].p)) >> 16);
|
||||
fprintf(fp, "%06x", rgbcolour);
|
||||
option_table[entry].p)) >> 16);
|
||||
fprintf(fp, "%s:%06x\n", option_table[entry].key,
|
||||
rgbcolour);
|
||||
break;
|
||||
|
||||
case OPTION_STRING:
|
||||
if (*((char **) option_table[i].p))
|
||||
fprintf(fp, "%s",
|
||||
*((char **) option_table[i].p));
|
||||
if (((*((char **) option_table[entry].p)) != NULL) &&
|
||||
(*(*((char **) option_table[entry].p)) != 0)) {
|
||||
fprintf(fp, "%s:%s\n", option_table[entry].key,
|
||||
*((char **) option_table[entry].p));
|
||||
}
|
||||
break;
|
||||
}
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
Loading…
Reference in New Issue
Block a user