summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2011-03-17 09:21:02 +0000
committerVincent Sanders <vince@netsurf-browser.org>2011-03-17 09:21:02 +0000
commitd90ca6181bb97d82c1eef7a303c408b2f8e5012b (patch)
tree281e80cfe65d81a043264e2008e168170e62aeb0
parentbd39eb42670d1ba66193a59821b6443d2bd16cf8 (diff)
downloadnetsurf-d90ca6181bb97d82c1eef7a303c408b2f8e5012b.tar.gz
netsurf-d90ca6181bb97d82c1eef7a303c408b2f8e5012b.tar.bz2
Improve options output
improve options:config styling svn path=/trunk/netsurf/; revision=12084
-rw-r--r--!NetSurf/Resources/internal.css,f7915
-rw-r--r--content/fetchers/about.c17
-rw-r--r--desktop/options.c32
3 files changed, 39 insertions, 25 deletions
diff --git a/!NetSurf/Resources/internal.css,f79 b/!NetSurf/Resources/internal.css,f79
index a5923fe33..60bc2cded 100644
--- a/!NetSurf/Resources/internal.css,f79
+++ b/!NetSurf/Resources/internal.css,f79
@@ -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; }
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index 6bee817be..3dfea825f 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -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>"
diff --git a/desktop/options.c b/desktop/options.c
index 294ce4a53..a426db301 100644
--- a/desktop/options.c
+++ b/desktop/options.c
@@ -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);