netsurf: branch master updated. release/3.0-148-g68c2013

NetSurf Browser Project (Commit Mailer) no-reply at netsurf-browser.org
Tue May 28 21:34:37 BST 2013


Gitweb links:

...log http://git.netsurf-browser.org/netsurf.git/shortlog/68c2013504b9ed951178dd8c77ba479f1b134614
...commit http://git.netsurf-browser.org/netsurf.git/commit/68c2013504b9ed951178dd8c77ba479f1b134614
...tree http://git.netsurf-browser.org/netsurf.git/tree/68c2013504b9ed951178dd8c77ba479f1b134614

The branch, master has been updated
       via  68c2013504b9ed951178dd8c77ba479f1b134614 (commit)
      from  8e8b4fbe574c72b467054d0c64b8ca28d98bbadd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=68c2013504b9ed951178dd8c77ba479f1b134614
commit 68c2013504b9ed951178dd8c77ba479f1b134614
Author: Vincent Sanders <vince at kyllikki.org>
Commit: Vincent Sanders <vince at kyllikki.org>

    add provenance to about:config

diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index ee2ea54..cac8b2b 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -331,13 +331,13 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
 			"</p>\n"
 			"<h1>NetSurf Browser Config</h1>\n"
 			"<table class=\"config\">\n"
-			"<tr><th></th><th></th><th></th></tr>\n");
+			"<tr><th>Option</th><th>Type</th><th>Provenance</th><th>Setting</th></tr>\n");
 
 	do {
 		res = nsoption_snoptionf(buffer + slen, 
 					 sizeof buffer - slen,
 					 opt_loop,
-					 "<tr><th>%k</th><td>%t</td><td>%V</td></tr>\n");
+					 "<tr><th>%k</th><td>%t</td><td>%p</td><td>%V</td></tr>\n");
 		if (res <= 0) 
 			break; /* last option */
 
diff --git a/utils/nsoption.c b/utils/nsoption.c
index b5add5f..d64adec 100644
--- a/utils/nsoption.c
+++ b/utils/nsoption.c
@@ -155,6 +155,58 @@ static void nsoption_validate(struct nsoption_s *opts)
 	}
 }
 
+static bool 
+nsoption_is_set(struct nsoption_s *opts,
+		struct nsoption_s *defs,
+		enum nsoption_e entry)
+{
+	bool ret = false;
+
+	switch (opts[entry].type) {
+	case OPTION_BOOL:
+		if (opts[entry].value.b != defs[entry].value.b) {
+			ret = true;
+		}
+		break;
+
+	case OPTION_INTEGER:
+		if (opts[entry].value.i != defs[entry].value.i) {
+			ret = true;
+		}
+		break;
+
+	case OPTION_UINT:
+		if (opts[entry].value.u != defs[entry].value.u) {
+			ret = true;
+		}
+		break;
+
+	case OPTION_COLOUR:
+		if (opts[entry].value.c != defs[entry].value.c) {
+			ret = true;
+		}
+		break;
+
+	case OPTION_STRING:
+		/* set if:
+		 *  - defs is null.
+		 *  - default is null but value is not.
+		 *  - default and value pointers are different
+		 *    (acts as a null check because of previous check)
+		 *    and the strings content differ.
+		 */
+		if (((defs[entry].value.s == NULL) &&
+		     (opts[entry].value.s != NULL)) ||
+		    ((defs[entry].value.s != opts[entry].value.s) &&
+		     (strcmp(opts[entry].value.s, defs[entry].value.s) != 0))) {
+			ret = true;
+		}
+		break;
+
+	}
+	return ret;
+}
+
 /** Output choices to file stream
  *
  * @param fp the file stream to write to
@@ -169,66 +221,52 @@ nsoption_output(FILE *fp,
 		bool all)
 {
 	unsigned int entry;
+	bool show;
+	colour rgbcolour; /* RRGGBB */
+
 	for (entry = 0; entry < NSOPTION_LISTEND; entry++) {
+		show = all || nsoption_is_set(opts, defs, entry);
+
+		if (show == false) {
+			continue;
+		}
+
 		switch (opts[entry].type) {
 		case OPTION_BOOL:
-			if (all ||
-			    (opts[entry].value.b != defs[entry].value.b)) {
-				    fprintf(fp, "%s:%c\n",
-					    opts[entry].key,
-					    opts[entry].value.b ? '1' : '0');
-				}
+			fprintf(fp, "%s:%c\n",
+				opts[entry].key,
+				opts[entry].value.b ? '1' : '0');
 			break;
 
 		case OPTION_INTEGER:
-			if (all ||
-			    (opts[entry].value.i != defs[entry].value.i)) {
-				    fprintf(fp, "%s:%i\n",
-					    opts[entry].key,
-					    opts[entry].value.i);
-			    }
+			fprintf(fp, "%s:%i\n",
+				opts[entry].key,
+				opts[entry].value.i);
+
 			break;
 
 		case OPTION_UINT:
-			if (all ||
-			    (opts[entry].value.u != defs[entry].value.u)) {
-				    fprintf(fp, "%s:%u\n",
-					    opts[entry].key,
-					    opts[entry].value.u);
-			    }
+			fprintf(fp, "%s:%u\n",
+				opts[entry].key,
+				opts[entry].value.u);
 			break;
 
 		case OPTION_COLOUR:
-			if (all ||
-			    (opts[entry].value.c != defs[entry].value.c)) {
-				    colour rgbcolour; /* RRGGBB */
-				    rgbcolour = (((0x000000FF & opts[entry].value.c) << 16) |
-						 ((0x0000FF00 & opts[entry].value.c) << 0) |
-						 ((0x00FF0000 & opts[entry].value.c) >> 16));
-				    fprintf(fp, "%s:%06x\n",
-					    opts[entry].key,
-					    rgbcolour);
-			    }
+			rgbcolour = (((0x000000FF & opts[entry].value.c) << 16) |
+				     ((0x0000FF00 & opts[entry].value.c) << 0) |
+				     ((0x00FF0000 & opts[entry].value.c) >> 16));
+			fprintf(fp, "%s:%06x\n",
+				opts[entry].key,
+				rgbcolour);
+
 			break;
 
 		case OPTION_STRING:
-			/* output the key if:
-			 *  - defs is null.
-			 *  - default is null but value is not.
-			 *  - default and value pointers are different
-			 *    (acts as a null check because of previous check)
-			 *    and the strings content differ.
-			 */
-			if (all ||
-			    ((defs[entry].value.s == NULL) &&
-			     (opts[entry].value.s != NULL)) ||
-			    ((defs[entry].value.s != opts[entry].value.s) &&
-			     (strcmp(opts[entry].value.s, defs[entry].value.s) != 0))) {
-				fprintf(fp, "%s:%s\n",
-					opts[entry].key,
-					((opts[entry].value.s == NULL) ||
-					 (*opts[entry].value.s == 0)) ? "" : opts[entry].value.s);
-			}
+			fprintf(fp, "%s:%s\n",
+				opts[entry].key,
+				((opts[entry].value.s == NULL) ||
+				 (*opts[entry].value.s == 0)) ? "" : opts[entry].value.s);
+
 			break;
 		}
 	}
@@ -283,7 +321,8 @@ nsoption_output_value_html(struct nsoption_s *option,
 		slen = snprintf(string + pos,
 				size - pos,
 				"<span style=\"background-color: #%06x; "
-				"color: #%06x;\">#%06x</span>",
+				"color: #%06x; "
+				"font-family:Monospace; \">#%06X</span>",
 				rgbcolour,
 				(~rgbcolour) & 0xffffff,
 				rgbcolour);
@@ -630,6 +669,20 @@ nsoption_snoptionf(char *string,
 						 option->key);
 				break;
 
+			case 'p':
+				if (nsoption_is_set(nsoptions, 
+						    nsoptions_default, 
+						    option_idx)) {
+					slen += snprintf(string + slen,
+							 size - slen,
+							 "user");
+				} else {
+					slen += snprintf(string + slen,
+							 size - slen,
+							 "default");
+				}
+				break;
+
 			case 't':
 				switch (option->type) {
 				case OPTION_BOOL:
diff --git a/utils/nsoption.h b/utils/nsoption.h
index 32e9e66..868e077 100644
--- a/utils/nsoption.h
+++ b/utils/nsoption.h
@@ -220,6 +220,7 @@ nserror nsoption_commandline(int *pargc, char **argv, struct nsoption_s *opts);
  * %t - The options type
  * %V - value (HTML formatting)
  * %v - value (plain formatting)
+ * %p - provenance either "user" or "default"
  *
  * @param string The buffer in which to place the results.
  * @param size The size of the string buffer.


-----------------------------------------------------------------------

Summary of changes:
 content/fetchers/about.c |    4 +-
 utils/nsoption.c         |  145 +++++++++++++++++++++++++++++++---------------
 utils/nsoption.h         |    1 +
 3 files changed, 102 insertions(+), 48 deletions(-)

diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index ee2ea54..cac8b2b 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -331,13 +331,13 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx)
 			"</p>\n"
 			"<h1>NetSurf Browser Config</h1>\n"
 			"<table class=\"config\">\n"
-			"<tr><th></th><th></th><th></th></tr>\n");
+			"<tr><th>Option</th><th>Type</th><th>Provenance</th><th>Setting</th></tr>\n");
 
 	do {
 		res = nsoption_snoptionf(buffer + slen, 
 					 sizeof buffer - slen,
 					 opt_loop,
-					 "<tr><th>%k</th><td>%t</td><td>%V</td></tr>\n");
+					 "<tr><th>%k</th><td>%t</td><td>%p</td><td>%V</td></tr>\n");
 		if (res <= 0) 
 			break; /* last option */
 
diff --git a/utils/nsoption.c b/utils/nsoption.c
index b5add5f..d64adec 100644
--- a/utils/nsoption.c
+++ b/utils/nsoption.c
@@ -155,6 +155,58 @@ static void nsoption_validate(struct nsoption_s *opts)
 	}
 }
 
+static bool 
+nsoption_is_set(struct nsoption_s *opts,
+		struct nsoption_s *defs,
+		enum nsoption_e entry)
+{
+	bool ret = false;
+
+	switch (opts[entry].type) {
+	case OPTION_BOOL:
+		if (opts[entry].value.b != defs[entry].value.b) {
+			ret = true;
+		}
+		break;
+
+	case OPTION_INTEGER:
+		if (opts[entry].value.i != defs[entry].value.i) {
+			ret = true;
+		}
+		break;
+
+	case OPTION_UINT:
+		if (opts[entry].value.u != defs[entry].value.u) {
+			ret = true;
+		}
+		break;
+
+	case OPTION_COLOUR:
+		if (opts[entry].value.c != defs[entry].value.c) {
+			ret = true;
+		}
+		break;
+
+	case OPTION_STRING:
+		/* set if:
+		 *  - defs is null.
+		 *  - default is null but value is not.
+		 *  - default and value pointers are different
+		 *    (acts as a null check because of previous check)
+		 *    and the strings content differ.
+		 */
+		if (((defs[entry].value.s == NULL) &&
+		     (opts[entry].value.s != NULL)) ||
+		    ((defs[entry].value.s != opts[entry].value.s) &&
+		     (strcmp(opts[entry].value.s, defs[entry].value.s) != 0))) {
+			ret = true;
+		}
+		break;
+
+	}
+	return ret;
+}
+
 /** Output choices to file stream
  *
  * @param fp the file stream to write to
@@ -169,66 +221,52 @@ nsoption_output(FILE *fp,
 		bool all)
 {
 	unsigned int entry;
+	bool show;
+	colour rgbcolour; /* RRGGBB */
+
 	for (entry = 0; entry < NSOPTION_LISTEND; entry++) {
+		show = all || nsoption_is_set(opts, defs, entry);
+
+		if (show == false) {
+			continue;
+		}
+
 		switch (opts[entry].type) {
 		case OPTION_BOOL:
-			if (all ||
-			    (opts[entry].value.b != defs[entry].value.b)) {
-				    fprintf(fp, "%s:%c\n",
-					    opts[entry].key,
-					    opts[entry].value.b ? '1' : '0');
-				}
+			fprintf(fp, "%s:%c\n",
+				opts[entry].key,
+				opts[entry].value.b ? '1' : '0');
 			break;
 
 		case OPTION_INTEGER:
-			if (all ||
-			    (opts[entry].value.i != defs[entry].value.i)) {
-				    fprintf(fp, "%s:%i\n",
-					    opts[entry].key,
-					    opts[entry].value.i);
-			    }
+			fprintf(fp, "%s:%i\n",
+				opts[entry].key,
+				opts[entry].value.i);
+
 			break;
 
 		case OPTION_UINT:
-			if (all ||
-			    (opts[entry].value.u != defs[entry].value.u)) {
-				    fprintf(fp, "%s:%u\n",
-					    opts[entry].key,
-					    opts[entry].value.u);
-			    }
+			fprintf(fp, "%s:%u\n",
+				opts[entry].key,
+				opts[entry].value.u);
 			break;
 
 		case OPTION_COLOUR:
-			if (all ||
-			    (opts[entry].value.c != defs[entry].value.c)) {
-				    colour rgbcolour; /* RRGGBB */
-				    rgbcolour = (((0x000000FF & opts[entry].value.c) << 16) |
-						 ((0x0000FF00 & opts[entry].value.c) << 0) |
-						 ((0x00FF0000 & opts[entry].value.c) >> 16));
-				    fprintf(fp, "%s:%06x\n",
-					    opts[entry].key,
-					    rgbcolour);
-			    }
+			rgbcolour = (((0x000000FF & opts[entry].value.c) << 16) |
+				     ((0x0000FF00 & opts[entry].value.c) << 0) |
+				     ((0x00FF0000 & opts[entry].value.c) >> 16));
+			fprintf(fp, "%s:%06x\n",
+				opts[entry].key,
+				rgbcolour);
+
 			break;
 
 		case OPTION_STRING:
-			/* output the key if:
-			 *  - defs is null.
-			 *  - default is null but value is not.
-			 *  - default and value pointers are different
-			 *    (acts as a null check because of previous check)
-			 *    and the strings content differ.
-			 */
-			if (all ||
-			    ((defs[entry].value.s == NULL) &&
-			     (opts[entry].value.s != NULL)) ||
-			    ((defs[entry].value.s != opts[entry].value.s) &&
-			     (strcmp(opts[entry].value.s, defs[entry].value.s) != 0))) {
-				fprintf(fp, "%s:%s\n",
-					opts[entry].key,
-					((opts[entry].value.s == NULL) ||
-					 (*opts[entry].value.s == 0)) ? "" : opts[entry].value.s);
-			}
+			fprintf(fp, "%s:%s\n",
+				opts[entry].key,
+				((opts[entry].value.s == NULL) ||
+				 (*opts[entry].value.s == 0)) ? "" : opts[entry].value.s);
+
 			break;
 		}
 	}
@@ -283,7 +321,8 @@ nsoption_output_value_html(struct nsoption_s *option,
 		slen = snprintf(string + pos,
 				size - pos,
 				"<span style=\"background-color: #%06x; "
-				"color: #%06x;\">#%06x</span>",
+				"color: #%06x; "
+				"font-family:Monospace; \">#%06X</span>",
 				rgbcolour,
 				(~rgbcolour) & 0xffffff,
 				rgbcolour);
@@ -630,6 +669,20 @@ nsoption_snoptionf(char *string,
 						 option->key);
 				break;
 
+			case 'p':
+				if (nsoption_is_set(nsoptions, 
+						    nsoptions_default, 
+						    option_idx)) {
+					slen += snprintf(string + slen,
+							 size - slen,
+							 "user");
+				} else {
+					slen += snprintf(string + slen,
+							 size - slen,
+							 "default");
+				}
+				break;
+
 			case 't':
 				switch (option->type) {
 				case OPTION_BOOL:
diff --git a/utils/nsoption.h b/utils/nsoption.h
index 32e9e66..868e077 100644
--- a/utils/nsoption.h
+++ b/utils/nsoption.h
@@ -220,6 +220,7 @@ nserror nsoption_commandline(int *pargc, char **argv, struct nsoption_s *opts);
  * %t - The options type
  * %V - value (HTML formatting)
  * %v - value (plain formatting)
+ * %p - provenance either "user" or "default"
  *
  * @param string The buffer in which to place the results.
  * @param size The size of the string buffer.


-- 
NetSurf Browser



More information about the netsurf-commits mailing list