diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2013-05-27 15:02:04 +0100 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2013-05-28 14:16:11 +0100 |
commit | 429a30caa73d80a363a47f307c8688c073d15145 (patch) | |
tree | a7ac81131391f978f29ff0692d8d0401f23c5d6e /atari/gui.c | |
parent | 91966b562ed11a933df764db54b56a893fce09b9 (diff) | |
download | netsurf-429a30caa73d80a363a47f307c8688c073d15145.tar.gz netsurf-429a30caa73d80a363a47f307c8688c073d15145.tar.bz2 |
move atari to new options code
Diffstat (limited to 'atari/gui.c')
-rw-r--r-- | atari/gui.c | 73 |
1 files changed, 45 insertions, 28 deletions
diff --git a/atari/gui.c b/atari/gui.c index 97d63ce3c..6b542742e 100644 --- a/atari/gui.c +++ b/atari/gui.c @@ -922,16 +922,21 @@ nsurl *gui_get_resource_url(const char *path) return url; } -/* Documented in utils/nsoption.h */ -void gui_options_init_defaults(void) +/** + * Set option defaults for atari frontend + * + * @param defaults The option table to update. + * @return error status. + */ +static nserror set_defaults(struct nsoption_s *defaults) { /* Set defaults for absent option strings */ nsoption_setnull_charp(cookie_file, strdup("cookies")); if (nsoption_charp(cookie_file) == NULL) { - die("Failed initialising string options"); + LOG(("Failed initialising string options")); + return NSERROR_BAD_PARAMETER; } - - nsoption_set_int(min_reflow_period, 350); + return NSERROR_OK; } static void gui_init(int argc, char** argv) @@ -1031,11 +1036,11 @@ static void gui_init2(int argc, char** argv) int main(int argc, char** argv) { char messages[PATH_MAX]; - const char *addr; - char * file_url = NULL; - struct stat stat_buf; - nsurl *url; - nserror error; + const char *addr; + char * file_url = NULL; + struct stat stat_buf; + nsurl *url; + nserror ret; /* @todo logging file descriptor update belongs in a nslog_init callback */ setbuf(stderr, NULL); @@ -1059,8 +1064,20 @@ int main(int argc, char** argv) */ nslog_init(NULL, &argc, argv); + /* user options setup */ + ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default); + if (ret != NSERROR_OK) { + die("Options failed to initialise"); + } + nsoption_read(options, NULL); + nsoption_commandline(&argc, argv, NULL); + + /* common initialisation */ LOG(("Initialising core...")); - netsurf_init(&argc, &argv, options, messages); + ret = netsurf_init(messages); + if (ret != NSERROR_OK) { + die("NetSurf failed to initialise"); + } LOG(("Initializing GUI...")); gui_init(argc, argv); @@ -1079,23 +1096,23 @@ int main(int argc, char** argv) } } - /* create an initial browser window */ - error = nsurl_create(addr, &url); - if (error == NSERROR_OK) { - error = browser_window_create(BROWSER_WINDOW_VERIFIABLE | - BROWSER_WINDOW_HISTORY, - url, - NULL, - NULL, - NULL); - nsurl_unref(url); - } - if (error != NSERROR_OK) { - warn_user(messages_get_errorcode(error), 0); - } else { - LOG(("Entering NetSurf mainloop...")); - netsurf_main_loop(); - } + /* create an initial browser window */ + ret = nsurl_create(addr, &url); + if (ret == NSERROR_OK) { + ret = browser_window_create(BROWSER_WINDOW_VERIFIABLE | + BROWSER_WINDOW_HISTORY, + url, + NULL, + NULL, + NULL); + nsurl_unref(url); + } + if (ret != NSERROR_OK) { + warn_user(messages_get_errorcode(ret), 0); + } else { + LOG(("Entering NetSurf mainloop...")); + netsurf_main_loop(); + } netsurf_exit(); |