summaryrefslogtreecommitdiff
path: root/windows/main.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2013-05-28 15:19:06 +0100
committerVincent Sanders <vince@netsurf-browser.org>2013-05-28 15:19:06 +0100
commitfcc61ea37437fbfd163c5a96a7119bbcf69073e1 (patch)
treed110a3d7b1f75d5c3ee0f6243fe8e9c8d38fa216 /windows/main.c
parent15598b57901bc6abcd6b49337445a4c8fe31e15a (diff)
downloadnetsurf-fcc61ea37437fbfd163c5a96a7119bbcf69073e1.tar.gz
netsurf-fcc61ea37437fbfd163c5a96a7119bbcf69073e1.tar.bz2
move windows to new option API
Diffstat (limited to 'windows/main.c')
-rw-r--r--windows/main.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/windows/main.c b/windows/main.c
index 384386822..69a152d9b 100644
--- a/windows/main.c
+++ b/windows/main.c
@@ -80,13 +80,20 @@ static bool nslog_ensure(FILE *fptr)
return true;
}
-/* Documented in utils/nsoption.h */
-void gui_options_init_defaults(void)
+/**
+ * Set option defaults for framebuffer 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 */
/* ensure homepage option has a default */
nsoption_setnull_charp(homepage_url, strdup(NETSURF_HOMEPAGE));
+
+ return NSERROR_OK;
}
/**
@@ -132,7 +139,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
respaths = nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);
- messages = filepath_find(respaths, "messages");
options_file_location = filepath_find(respaths, "preferences");
@@ -141,14 +147,23 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
*/
nslog_init(nslog_ensure, &argc, argv);
- /* initialise netsurf */
- ret = netsurf_init(&argc, &argv, options_file_location, messages);
+ /* user options setup */
+ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
if (ret != NSERROR_OK) {
- free(options_file_location);
- return 1;
+ die("Options failed to initialise");
}
+ nsoption_read(options_file_location, NULL);
+ nsoption_commandline(&argc, argv, NULL);
+ /* common initialisation */
+ messages = filepath_find(respaths, "messages");
+ ret = netsurf_init(messages);
free(messages);
+ if (ret != NSERROR_OK) {
+ free(options_file_location);
+ LOG(("NetSurf failed to initialise"));
+ return 1;
+ }
ret = nsws_create_main_class(hInstance);
ret = nsws_create_drawable_class(hInstance);