Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/601d9da66d173152fcc095d271b08b43a02ca905
...commit
http://git.netsurf-browser.org/netsurf.git/commit/601d9da66d173152fcc095d271b08b43a02ca905
...tree
http://git.netsurf-browser.org/netsurf.git/tree/601d9da66d173152fcc095d271b08b43a02ca905
The branch, master has been updated
via 601d9da66d173152fcc095d271b08b43a02ca905 (commit)
via 7d808e95496b8f2175537f03dd2edd6bb58156c9 (commit)
via 10afe5f61585db3944c70808af36b74da09ae061 (commit)
from fab01f4f1a11e0e2db971247a3dd8e00ccb9bcbe (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=601d9da66d173152fcc095d271b08b43a02ca905
commit 601d9da66d173152fcc095d271b08b43a02ca905
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
fix windows user preferences location storage
diff --git a/frontends/windows/gui.h b/frontends/windows/gui.h
index e4671ea..8dd2ded 100644
--- a/frontends/windows/gui.h
+++ b/frontends/windows/gui.h
@@ -25,7 +25,8 @@ struct gui_clipboard_table *win32_clipboard_table;
extern HINSTANCE hInstance;
-extern char *options_file_location;
+/** Directory where all configuration files are held. */
+extern char *nsw32_config_home;
/* bounding box */
typedef struct bbox_s {
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index 49aa431..0d75c70 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -21,6 +21,8 @@
#include <limits.h>
#include <stdbool.h>
#include <windows.h>
+#include <shlobj.h>
+#include <shlwapi.h>
#include <io.h>
#include "utils/utils.h"
@@ -50,7 +52,53 @@
static char **respaths; /** resource search path vector. */
-char *options_file_location;
+char *nsw32_config_home; /* exported global defined in windows/gui.h */
+
+/**
+ * Get the path to the config directory.
+ *
+ * This ought to use SHGetKnownFolderPath(FOLDERID_RoamingAppData) and
+ * PathCcpAppend() but uses depricated API because that is what mingw
+ * supports.
+ *
+ * @param config_home_out Path to configuration directory.
+ * @return NSERROR_OK on sucess and \a config_home_out updated else error code.
+ */
+static nserror get_config_home(char **config_home_out)
+{
+ TCHAR adPath[MAX_PATH]; /* appdata path */
+ HRESULT hres;
+
+ hres = SHGetFolderPath(NULL,
+ CSIDL_APPDATA | CSIDL_FLAG_CREATE,
+ NULL,
+ SHGFP_TYPE_CURRENT,
+ adPath);
+ if (hres != S_OK) {
+ return NSERROR_INVALID;
+ }
+
+ hres = PathAppend(adPath, "NetSurf");
+ if (hres != S_OK) {
+ return NSERROR_NOT_FOUND;
+ }
+
+ /* ensure netsurf directory exists */
+ if (CreateDirectory(adPath, NULL) == 0) {
+ DWORD dw;
+ dw = GetLastError();
+ if (dw != ERROR_ALREADY_EXISTS) {
+ return NSERROR_NOT_DIRECTORY;
+ }
+ }
+
+ LOG("\"%s\"", adPath);
+
+ *config_home_out = strdup(adPath);
+
+ return NSERROR_OK;
+}
+
/**
* Cause an abnormal program termination.
@@ -134,12 +182,39 @@ static nserror set_defaults(struct nsoption_s *defaults)
}
+/**
+ * Initialise user options location and contents
+ */
+static nserror nsw32_option_init(int *pargc, char** argv)
+{
+ nserror ret;
+ char *choices = NULL;
+
+ /* user options setup */
+ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
+ if (ret != NSERROR_OK) {
+ return ret;
+ }
+
+ /* Attempt to load the user choices */
+ ret = netsurf_mkpath(&choices, NULL, 2, nsw32_config_home, "Choices");
+ if (ret == NSERROR_OK) {
+ nsoption_read(choices, nsoptions);
+ free(choices);
+ }
+
+ /* overide loaded options with those from commandline */
+ nsoption_commandline(pargc, argv, nsoptions);
+
+ return NSERROR_OK;
+}
+
+
static struct gui_misc_table win32_misc_table = {
.schedule = win32_schedule,
.warning = win32_warning,
};
-
/**
* Entry point from windows
**/
@@ -172,13 +247,13 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance,
LPSTR lpcli, int ncmd)
die("NetSurf operation table registration failed");
}
+ setbuf(stderr, NULL);
+
+ /* Construct a unix style argc/argv */
if (SLEN(lpcli) > 0) {
argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
}
- setbuf(stderr, NULL);
-
- /* Construct a unix style argc/argv */
argv = malloc(sizeof(char *) * argc);
while (argctemp < argc) {
len = wcstombs(NULL, argvw[argctemp], 0) + 1;
@@ -197,23 +272,27 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance,
LPSTR lpcli, int ncmd)
argctemp++;
}
- respaths =
nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);
-
-
- options_file_location = filepath_find(respaths, "preferences");
-
/* initialise logging - not fatal if it fails but not much we
* can do about it
*/
nslog_init(nslog_ensure, &argc, argv);
- /* user options setup */
- ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
+ /* Locate the correct user configuration directory path */
+ ret = get_config_home(&nsw32_config_home);
if (ret != NSERROR_OK) {
- die("Options failed to initialise");
+ LOG("Unable to locate a configuration directory.");
+ nsw32_config_home = NULL;
}
- nsoption_read(options_file_location, NULL);
- nsoption_commandline(&argc, argv, NULL);
+
+ /* Initialise user options */
+ ret = nsw32_option_init(&argc, argv);
+ if (ret != NSERROR_OK) {
+ LOG("Options failed to initialise (%s)\n",
+ messages_get_errorcode(ret));
+ return 1;
+ }
+
+ respaths =
nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);
/* message init */
messages = filepath_find(respaths, "messages");
@@ -223,7 +302,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR
lpcli, int ncmd)
/* common initialisation */
ret = netsurf_init(NULL);
if (ret != NSERROR_OK) {
- free(options_file_location);
LOG("NetSurf failed to initialise");
return 1;
}
@@ -265,7 +343,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR
lpcli, int ncmd)
netsurf_exit();
- free(options_file_location);
+ /* finalise options */
+ nsoption_finalise(nsoptions, nsoptions_default);
return 0;
}
diff --git a/frontends/windows/prefs.c b/frontends/windows/prefs.c
index adc0101..286bfb0 100644
--- a/frontends/windows/prefs.c
+++ b/frontends/windows/prefs.c
@@ -25,6 +25,8 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
+#include "utils/file.h"
+
#include "windows/gui.h"
#include "windows/prefs.h"
#include "windows/resourceid.h"
@@ -628,6 +630,22 @@ static BOOL CALLBACK options_general_dialog_handler(HWND
hwnd,
return FALSE;
}
+/* exported interface documented in windows/prefs.h */
+nserror nsws_prefs_save(void)
+{
+ /* user saved changes */
+ char *choices = NULL;
+ nserror res;
+
+ res = netsurf_mkpath(&choices, NULL, 2, nsw32_config_home, "Choices");
+ if (res == NSERROR_OK) {
+ nsoption_write(choices, NULL, NULL);
+ free(choices);
+ }
+ return res;
+}
+
+/* exported interface documented in windows/prefs.h */
void nsws_prefs_dialog_init(HINSTANCE hinst, HWND parent)
{
int ret;
@@ -674,7 +692,6 @@ void nsws_prefs_dialog_init(HINSTANCE hinst, HWND parent)
if (ret == -1) {
win_perror("PropertySheet");
} else if (ret > 0) {
- /* user saved changes */
- nsoption_write(options_file_location, NULL, NULL);
+ nsws_prefs_save();
}
}
diff --git a/frontends/windows/prefs.h b/frontends/windows/prefs.h
index dec004b..fcab237 100644
--- a/frontends/windows/prefs.h
+++ b/frontends/windows/prefs.h
@@ -19,6 +19,14 @@
#ifndef _NETSURF_WINDOWS_PREFS_H_
#define _NETSURF_WINDOWS_PREFS_H_
+/**
+ * open the preferences dialog and respond to user.
+ */
void nsws_prefs_dialog_init(HINSTANCE hinst, HWND parent);
+/**
+ * Save the users preferances.
+ */
+nserror nsws_prefs_save(void);
+
#endif
diff --git a/frontends/windows/window.c b/frontends/windows/window.c
index 5db464a..7069417 100644
--- a/frontends/windows/window.c
+++ b/frontends/windows/window.c
@@ -1099,7 +1099,8 @@ nsws_window_command(HWND hwnd,
nsoption_set_int(window_y, r.top);
nsoption_set_int(window_width, r.right - r.left);
nsoption_set_int(window_height, r.bottom - r.top);
- nsoption_write(options_file_location, NULL, NULL);
+
+ nsws_prefs_save();
break;
}
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=7d808e95496b8f2175537f03dd2edd6bb58156c9
commit 7d808e95496b8f2175537f03dd2edd6bb58156c9
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
remove unused extraneous windows file
diff --git a/.gitignore b/.gitignore
index 3b674ff..b16d6f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,7 +11,6 @@
\!NetSurf/Resources/nl/Templates,fec
\!NetSurf/Resources/nl/Messages
\!NetSurf/Resources/it/Messages
-frontends/windows/res/preferences
frontends/gtk/res/en/Messages
frontends/gtk/res/fr/Messages
frontends/gtk/res/de/Messages
diff --git a/Makefile b/Makefile
index 586e61e..f616c6d 100644
--- a/Makefile
+++ b/Makefile
@@ -685,9 +685,6 @@ else
$(Q)$(ELF2AIF) $(EXETARGET:,ff8=,e1f) $(EXETARGET)
$(Q)$(RM) $(EXETARGET:,ff8=,e1f)
endif
-ifeq ($(TARGET),windows)
- $(Q)$(TOUCH) frontends/windows/res/preferences
-endif
ifeq ($(NETSURF_STRIP_BINARY),YES)
$(VQ)echo " STRIP: $(EXETARGET)"
$(Q)$(STRIP) $(EXETARGET)
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=10afe5f61585db3944c70808af36b74da09ae061
commit 10afe5f61585db3944c70808af36b74da09ae061
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
fix curl/openssl library link ordering
diff --git a/Makefile b/Makefile
index c5c374b..586e61e 100644
--- a/Makefile
+++ b/Makefile
@@ -544,7 +544,10 @@ NETSURF_FEATURE_OPENSSL_CFLAGS := -DWITH_OPENSSL
NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
NETSURF_FEATURE_NSPSL_CFLAGS := -DWITH_NSPSL
-$(eval $(call pkg_config_find_and_add_enabled,OPENSSL,openssl,OpenSSL))
+# libcurl and openssl ordering matters as if libcurl requires ssl it
+# needs to come first in link order to ensure its symbols can be
+# resolved by the subsequent openssl
+
# freemint does not support pkg-config for libcurl
ifeq ($(HOST),mint)
CFLAGS += $(shell curl-config --cflags)
@@ -552,6 +555,7 @@ ifeq ($(HOST),mint)
else
$(eval $(call pkg_config_find_and_add_enabled,CURL,libcurl,Curl))
endif
+$(eval $(call pkg_config_find_and_add_enabled,OPENSSL,openssl,OpenSSL))
$(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG))
$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
diff --git a/frontends/windows/Makefile b/frontends/windows/Makefile
index a3a95d9..cfb1712 100644
--- a/frontends/windows/Makefile
+++ b/frontends/windows/Makefile
@@ -10,8 +10,8 @@ CFLAGS += -I${GCCSDK_INSTALL_ENV}/include/
$(eval $(call pkg_config_find_and_add,libcares,Cares))
$(eval $(call pkg_config_find_and_add,zlib,ZLib))
-
-LDFLAGS += -lssl -lcrypto -lgnurx -lgdi32 -lcomctl32 -lws2_32 -lmsimg32
-mwindows
+# libraries for windows API
+LDFLAGS += -lgnurx -lgdi32 -lcomctl32 -lws2_32 -lmsimg32 -lshlwapi -mwindows
CFLAGS += -U__STRICT_ANSI__ -mwin32
# only windows versions after XP are supported
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 1 -
Makefile | 9 ++--
frontends/windows/Makefile | 4 +-
frontends/windows/gui.h | 3 +-
frontends/windows/main.c | 113 +++++++++++++++++++++++++++++++++++++-------
frontends/windows/prefs.c | 21 +++++++-
frontends/windows/prefs.h | 8 ++++
frontends/windows/window.c | 3 +-
8 files changed, 134 insertions(+), 28 deletions(-)
diff --git a/.gitignore b/.gitignore
index 3b674ff..b16d6f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,7 +11,6 @@
\!NetSurf/Resources/nl/Templates,fec
\!NetSurf/Resources/nl/Messages
\!NetSurf/Resources/it/Messages
-frontends/windows/res/preferences
frontends/gtk/res/en/Messages
frontends/gtk/res/fr/Messages
frontends/gtk/res/de/Messages
diff --git a/Makefile b/Makefile
index c5c374b..f616c6d 100644
--- a/Makefile
+++ b/Makefile
@@ -544,7 +544,10 @@ NETSURF_FEATURE_OPENSSL_CFLAGS := -DWITH_OPENSSL
NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
NETSURF_FEATURE_NSPSL_CFLAGS := -DWITH_NSPSL
-$(eval $(call pkg_config_find_and_add_enabled,OPENSSL,openssl,OpenSSL))
+# libcurl and openssl ordering matters as if libcurl requires ssl it
+# needs to come first in link order to ensure its symbols can be
+# resolved by the subsequent openssl
+
# freemint does not support pkg-config for libcurl
ifeq ($(HOST),mint)
CFLAGS += $(shell curl-config --cflags)
@@ -552,6 +555,7 @@ ifeq ($(HOST),mint)
else
$(eval $(call pkg_config_find_and_add_enabled,CURL,libcurl,Curl))
endif
+$(eval $(call pkg_config_find_and_add_enabled,OPENSSL,openssl,OpenSSL))
$(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG))
$(eval $(call pkg_config_find_and_add_enabled,BMP,libnsbmp,BMP))
@@ -681,9 +685,6 @@ else
$(Q)$(ELF2AIF) $(EXETARGET:,ff8=,e1f) $(EXETARGET)
$(Q)$(RM) $(EXETARGET:,ff8=,e1f)
endif
-ifeq ($(TARGET),windows)
- $(Q)$(TOUCH) frontends/windows/res/preferences
-endif
ifeq ($(NETSURF_STRIP_BINARY),YES)
$(VQ)echo " STRIP: $(EXETARGET)"
$(Q)$(STRIP) $(EXETARGET)
diff --git a/frontends/windows/Makefile b/frontends/windows/Makefile
index a3a95d9..cfb1712 100644
--- a/frontends/windows/Makefile
+++ b/frontends/windows/Makefile
@@ -10,8 +10,8 @@ CFLAGS += -I${GCCSDK_INSTALL_ENV}/include/
$(eval $(call pkg_config_find_and_add,libcares,Cares))
$(eval $(call pkg_config_find_and_add,zlib,ZLib))
-
-LDFLAGS += -lssl -lcrypto -lgnurx -lgdi32 -lcomctl32 -lws2_32 -lmsimg32
-mwindows
+# libraries for windows API
+LDFLAGS += -lgnurx -lgdi32 -lcomctl32 -lws2_32 -lmsimg32 -lshlwapi -mwindows
CFLAGS += -U__STRICT_ANSI__ -mwin32
# only windows versions after XP are supported
diff --git a/frontends/windows/gui.h b/frontends/windows/gui.h
index e4671ea..8dd2ded 100644
--- a/frontends/windows/gui.h
+++ b/frontends/windows/gui.h
@@ -25,7 +25,8 @@ struct gui_clipboard_table *win32_clipboard_table;
extern HINSTANCE hInstance;
-extern char *options_file_location;
+/** Directory where all configuration files are held. */
+extern char *nsw32_config_home;
/* bounding box */
typedef struct bbox_s {
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index 49aa431..0d75c70 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -21,6 +21,8 @@
#include <limits.h>
#include <stdbool.h>
#include <windows.h>
+#include <shlobj.h>
+#include <shlwapi.h>
#include <io.h>
#include "utils/utils.h"
@@ -50,7 +52,53 @@
static char **respaths; /** resource search path vector. */
-char *options_file_location;
+char *nsw32_config_home; /* exported global defined in windows/gui.h */
+
+/**
+ * Get the path to the config directory.
+ *
+ * This ought to use SHGetKnownFolderPath(FOLDERID_RoamingAppData) and
+ * PathCcpAppend() but uses depricated API because that is what mingw
+ * supports.
+ *
+ * @param config_home_out Path to configuration directory.
+ * @return NSERROR_OK on sucess and \a config_home_out updated else error code.
+ */
+static nserror get_config_home(char **config_home_out)
+{
+ TCHAR adPath[MAX_PATH]; /* appdata path */
+ HRESULT hres;
+
+ hres = SHGetFolderPath(NULL,
+ CSIDL_APPDATA | CSIDL_FLAG_CREATE,
+ NULL,
+ SHGFP_TYPE_CURRENT,
+ adPath);
+ if (hres != S_OK) {
+ return NSERROR_INVALID;
+ }
+
+ hres = PathAppend(adPath, "NetSurf");
+ if (hres != S_OK) {
+ return NSERROR_NOT_FOUND;
+ }
+
+ /* ensure netsurf directory exists */
+ if (CreateDirectory(adPath, NULL) == 0) {
+ DWORD dw;
+ dw = GetLastError();
+ if (dw != ERROR_ALREADY_EXISTS) {
+ return NSERROR_NOT_DIRECTORY;
+ }
+ }
+
+ LOG("\"%s\"", adPath);
+
+ *config_home_out = strdup(adPath);
+
+ return NSERROR_OK;
+}
+
/**
* Cause an abnormal program termination.
@@ -134,12 +182,39 @@ static nserror set_defaults(struct nsoption_s *defaults)
}
+/**
+ * Initialise user options location and contents
+ */
+static nserror nsw32_option_init(int *pargc, char** argv)
+{
+ nserror ret;
+ char *choices = NULL;
+
+ /* user options setup */
+ ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
+ if (ret != NSERROR_OK) {
+ return ret;
+ }
+
+ /* Attempt to load the user choices */
+ ret = netsurf_mkpath(&choices, NULL, 2, nsw32_config_home, "Choices");
+ if (ret == NSERROR_OK) {
+ nsoption_read(choices, nsoptions);
+ free(choices);
+ }
+
+ /* overide loaded options with those from commandline */
+ nsoption_commandline(pargc, argv, nsoptions);
+
+ return NSERROR_OK;
+}
+
+
static struct gui_misc_table win32_misc_table = {
.schedule = win32_schedule,
.warning = win32_warning,
};
-
/**
* Entry point from windows
**/
@@ -172,13 +247,13 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance,
LPSTR lpcli, int ncmd)
die("NetSurf operation table registration failed");
}
+ setbuf(stderr, NULL);
+
+ /* Construct a unix style argc/argv */
if (SLEN(lpcli) > 0) {
argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
}
- setbuf(stderr, NULL);
-
- /* Construct a unix style argc/argv */
argv = malloc(sizeof(char *) * argc);
while (argctemp < argc) {
len = wcstombs(NULL, argvw[argctemp], 0) + 1;
@@ -197,23 +272,27 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance,
LPSTR lpcli, int ncmd)
argctemp++;
}
- respaths =
nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);
-
-
- options_file_location = filepath_find(respaths, "preferences");
-
/* initialise logging - not fatal if it fails but not much we
* can do about it
*/
nslog_init(nslog_ensure, &argc, argv);
- /* user options setup */
- ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
+ /* Locate the correct user configuration directory path */
+ ret = get_config_home(&nsw32_config_home);
if (ret != NSERROR_OK) {
- die("Options failed to initialise");
+ LOG("Unable to locate a configuration directory.");
+ nsw32_config_home = NULL;
}
- nsoption_read(options_file_location, NULL);
- nsoption_commandline(&argc, argv, NULL);
+
+ /* Initialise user options */
+ ret = nsw32_option_init(&argc, argv);
+ if (ret != NSERROR_OK) {
+ LOG("Options failed to initialise (%s)\n",
+ messages_get_errorcode(ret));
+ return 1;
+ }
+
+ respaths =
nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);
/* message init */
messages = filepath_find(respaths, "messages");
@@ -223,7 +302,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR
lpcli, int ncmd)
/* common initialisation */
ret = netsurf_init(NULL);
if (ret != NSERROR_OK) {
- free(options_file_location);
LOG("NetSurf failed to initialise");
return 1;
}
@@ -265,7 +343,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR
lpcli, int ncmd)
netsurf_exit();
- free(options_file_location);
+ /* finalise options */
+ nsoption_finalise(nsoptions, nsoptions_default);
return 0;
}
diff --git a/frontends/windows/prefs.c b/frontends/windows/prefs.c
index adc0101..286bfb0 100644
--- a/frontends/windows/prefs.c
+++ b/frontends/windows/prefs.c
@@ -25,6 +25,8 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
+#include "utils/file.h"
+
#include "windows/gui.h"
#include "windows/prefs.h"
#include "windows/resourceid.h"
@@ -628,6 +630,22 @@ static BOOL CALLBACK options_general_dialog_handler(HWND
hwnd,
return FALSE;
}
+/* exported interface documented in windows/prefs.h */
+nserror nsws_prefs_save(void)
+{
+ /* user saved changes */
+ char *choices = NULL;
+ nserror res;
+
+ res = netsurf_mkpath(&choices, NULL, 2, nsw32_config_home, "Choices");
+ if (res == NSERROR_OK) {
+ nsoption_write(choices, NULL, NULL);
+ free(choices);
+ }
+ return res;
+}
+
+/* exported interface documented in windows/prefs.h */
void nsws_prefs_dialog_init(HINSTANCE hinst, HWND parent)
{
int ret;
@@ -674,7 +692,6 @@ void nsws_prefs_dialog_init(HINSTANCE hinst, HWND parent)
if (ret == -1) {
win_perror("PropertySheet");
} else if (ret > 0) {
- /* user saved changes */
- nsoption_write(options_file_location, NULL, NULL);
+ nsws_prefs_save();
}
}
diff --git a/frontends/windows/prefs.h b/frontends/windows/prefs.h
index dec004b..fcab237 100644
--- a/frontends/windows/prefs.h
+++ b/frontends/windows/prefs.h
@@ -19,6 +19,14 @@
#ifndef _NETSURF_WINDOWS_PREFS_H_
#define _NETSURF_WINDOWS_PREFS_H_
+/**
+ * open the preferences dialog and respond to user.
+ */
void nsws_prefs_dialog_init(HINSTANCE hinst, HWND parent);
+/**
+ * Save the users preferances.
+ */
+nserror nsws_prefs_save(void);
+
#endif
diff --git a/frontends/windows/window.c b/frontends/windows/window.c
index 5db464a..7069417 100644
--- a/frontends/windows/window.c
+++ b/frontends/windows/window.c
@@ -1099,7 +1099,8 @@ nsws_window_command(HWND hwnd,
nsoption_set_int(window_y, r.top);
nsoption_set_int(window_width, r.right - r.left);
nsoption_set_int(window_height, r.bottom - r.top);
- nsoption_write(options_file_location, NULL, NULL);
+
+ nsws_prefs_save();
break;
}
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org