diff options
-rwxr-xr-x | atari/gui.c | 3 | ||||
-rw-r--r-- | content/fetchers/about.c | 8 | ||||
-rw-r--r-- | desktop/options.c | 19 | ||||
-rw-r--r-- | desktop/options.h | 9 |
4 files changed, 32 insertions, 7 deletions
diff --git a/atari/gui.c b/atari/gui.c index c2158e05e..210f0af69 100755 --- a/atari/gui.c +++ b/atari/gui.c @@ -795,7 +795,8 @@ void gui_quit(void) browser_window_destroy(gw->browser->bw);
gw = tmp;
}
-
+ + nsoption_write(options);
global_history_destroy();
hotlist_destroy();
toolbar_exit();
diff --git a/content/fetchers/about.c b/content/fetchers/about.c index f514b1c5c..a7e289e38 100644 --- a/content/fetchers/about.c +++ b/content/fetchers/about.c @@ -329,7 +329,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) } if (strcmp(post_item->name, "action") == 0 - && strcmp(post_item->value, "Save") == 0) { + && strcmp(post_item->value, "Set") == 0) { do_save = true; if (valid_token == true) { break; @@ -342,9 +342,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) int opt = 0; post_item = ctx->post_multipart; while (post_item != NULL) { - printf("%s -> %s\n", post_item->name, post_item->value); - //opt = nsoption_get_index(post_item->name); - //nsoption_get_type(opt); + bool s = nsoption_set_key(post_item->name, post_item->value); post_item = post_item->next; } } @@ -411,7 +409,7 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) slen += snprintf(buffer + slen, sizeof buffer - slen, "<br/><center>" "<input type=\"hidden\" name=\"token\" value=\"%s\" />\n" - "<input type=\"submit\" name=\"action\" value=\"Save\" />\n" + "<input type=\"submit\" name=\"action\" value=\"Set\" /> \n" "<input type=\"submit\" name=\"action\" value=\"Abort\" />\n" "</center><br/>\n" "</form>\n" diff --git a/desktop/options.c b/desktop/options.c index 4bdac6d24..12468fb84 100644 --- a/desktop/options.c +++ b/desktop/options.c @@ -327,7 +327,7 @@ nsoption_output_value_html_input(struct option_entry_s *option, option->key, (*((char **)option->p) != NULL) ? *((char **)option->p) : - "NULL"); + ""); break; } @@ -537,3 +537,20 @@ nsoption_dump(FILE *outf) } while (res > 0); } +/* exported interface documented in options.h */ +bool nsoption_set_key(const char *key, const char *value) +{ + bool ret = false; + int i; + + for (i = 0; i != option_table_entries; i++) { + if (strcasecmp(key, option_table[i].key) != 0) + continue; + + strtooption(value, option_table + i); + ret = true; + break; + } + + return(ret); +} diff --git a/desktop/options.h b/desktop/options.h index 53c025c18..d5c113baa 100644 --- a/desktop/options.h +++ b/desktop/options.h @@ -179,6 +179,15 @@ int nsoption_snoptionf(char *string, size_t size, unsigned int option, void nsoption_commandline(int *pargc, char **argv); /** +* Set an option by it's key +* +* \param name the option key to search for. +* \param value the value (as string) +* \return true on success, false when the option key is not found. +*/ +bool nsoption_set_key(const char *key, const char *value); + +/** * Set default values for unset front-end specific options */ void gui_options_init_defaults(void); |