Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/5e1236a8e7f31d8ded05b5e710009145d79dea6e
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/5e1236a8e7f31d8ded05b5e710009145d79dea6e
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/5e1236a8e7f31d8ded05b5e710009145d79dea6e

The branch, master has been updated
       via  5e1236a8e7f31d8ded05b5e710009145d79dea6e (commit)
       via  43e91251ad7844961f75c8af0ce7605c6e33f09b (commit)
      from  601d9da66d173152fcc095d271b08b43a02ca905 (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=5e1236a8e7f31d8ded05b5e710009145d79dea6e
commit 5e1236a8e7f31d8ded05b5e710009145d79dea6e
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    allow windows frontend to load and store urldb files

diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index 0d75c70..7b93c3b 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -32,6 +32,8 @@
 #include "utils/file.h"
 #include "utils/nsurl.h"
 #include "utils/nsoption.h"
+#include "netsurf/url_db.h"
+#include "netsurf/cookie_db.h"
 #include "netsurf/browser_window.h"
 #include "netsurf/fetch.h"
 #include "netsurf/misc.h"
@@ -67,6 +69,7 @@ char *nsw32_config_home; /* exported global defined in 
windows/gui.h */
 static nserror get_config_home(char **config_home_out)
 {
        TCHAR adPath[MAX_PATH]; /* appdata path */
+       char nsdir[] = "NetSurf";
        HRESULT hres;
 
        hres = SHGetFolderPath(NULL,
@@ -78,8 +81,7 @@ static nserror get_config_home(char **config_home_out)
                return NSERROR_INVALID;
        }
 
-       hres = PathAppend(adPath, "NetSurf");
-       if (hres != S_OK) {
+       if (PathAppend(adPath, nsdir) == false) {
                return NSERROR_NOT_FOUND;
        }
 
@@ -92,10 +94,10 @@ static nserror get_config_home(char **config_home_out)
                }
        }
 
-       LOG("\"%s\"", adPath);
-
        *config_home_out = strdup(adPath);
 
+       LOG("using config path \"%s\"", *config_home_out);
+
        return NSERROR_OK;
 }
 
@@ -155,8 +157,10 @@ static nserror set_defaults(struct nsoption_s *defaults)
        DWORD buf_tchar_size = PATH_MAX + 1;
        DWORD buf_bytes_size = sizeof(TCHAR) * buf_tchar_size;
        char *ptr = NULL;
-
        char *buf;
+       char *fname;
+       HRESULT hres;
+       char dldir[] = "Downloads";
 
        buf = malloc(buf_bytes_size);
        if (buf== NULL) {
@@ -164,6 +168,7 @@ static nserror set_defaults(struct nsoption_s *defaults)
        }
        buf[0] = '\0';
 
+       /* locate certificate bundle */
        res_len = SearchPathA(NULL,
                              "ca-bundle.crt",
                              NULL,
@@ -173,11 +178,62 @@ static nserror set_defaults(struct nsoption_s *defaults)
        if (res_len > 0) {
                nsoption_setnull_charp(ca_bundle, strdup(buf));
        }
+
+
+       /* download directory default
+        *
+        * unfortunately SHGetKnownFolderPath(FOLDERID_Downloads) is
+        * not available so use the obsolete method of user prodile
+        * with downloads suffixed
+        */
+       buf[0] = '\0';
+
+       hres = SHGetFolderPath(NULL,
+                              CSIDL_PROFILE | CSIDL_FLAG_CREATE,
+                              NULL,
+                              SHGFP_TYPE_CURRENT,
+                              buf);
+       if (hres == S_OK) {
+               if (PathAppend(buf, dldir)) {
+                       nsoption_setnull_charp(downloads_directory,
+                                              strdup(buf));
+
+               }
+       }
+
        free(buf);
        
        /* ensure homepage option has a default */
        nsoption_setnull_charp(homepage_url, strdup(NETSURF_HOMEPAGE));
 
+       /* cookie file default */
+       fname = NULL;
+       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Cookies");
+       if (fname != NULL) {
+               nsoption_setnull_charp(cookie_file, fname);
+       }
+
+       /* cookie jar default */
+       fname = NULL;
+       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Cookies");
+       if (fname != NULL) {
+               nsoption_setnull_charp(cookie_jar, fname);
+       }
+
+       /* url database default */
+       fname = NULL;
+       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "URLs");
+       if (fname != NULL) {
+               nsoption_setnull_charp(url_file, fname);
+       }
+
+       /* bookmark database default */
+       fname = NULL;
+       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Hotlist");
+       if (fname != NULL) {
+               nsoption_setnull_charp(hotlist_path, fname);
+       }
+
        return NSERROR_OK;
 }
 
@@ -306,6 +362,9 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR 
lpcli, int ncmd)
                return 1;
        }
 
+       urldb_load(nsoption_charp(url_file));
+       urldb_load_cookies(nsoption_charp(cookie_file));
+
        ret = nsws_create_main_class(hInstance);
        ret = nsws_create_drawable_class(hInstance);
        ret = nsws_create_localhistory_class(hInstance);
@@ -341,6 +400,9 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR 
lpcli, int ncmd)
                win32_run();
        }
 
+       urldb_save_cookies(nsoption_charp(cookie_jar));
+       urldb_save(nsoption_charp(url_file));
+
        netsurf_exit();
 
        /* finalise options */


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=43e91251ad7844961f75c8af0ce7605c6e33f09b
commit 43e91251ad7844961f75c8af0ce7605c6e33f09b
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    windows frontend netsurf options

diff --git a/frontends/windows/Makefile b/frontends/windows/Makefile
index cfb1712..baaf225 100644
--- a/frontends/windows/Makefile
+++ b/frontends/windows/Makefile
@@ -15,6 +15,7 @@ LDFLAGS += -lgnurx -lgdi32 -lcomctl32 -lws2_32 -lmsimg32 
-lshlwapi -mwindows
 
 CFLAGS += -U__STRICT_ANSI__ -mwin32
 # only windows versions after XP are supported
+# https://msdn.microsoft.com/en-gb/library/windows/desktop/aa383745
 CFLAGS += '-DWINVER=0x0501'
 CFLAGS += '-D_WIN32_WINNT=0x0501'
 CFLAGS += '-D_WIN32_WINDOWS=0x0501'
@@ -23,7 +24,7 @@ CFLAGS += '-D_WIN32_IE=0x0501'
 #installed resource path
 CFLAGS += '-DNETSURF_WINDOWS_RESPATH="$(NETSURF_WINDOWS_RESPATH)"'
 
-WSCFLAGS := -std=c99 -DCURL_STATICLIB -DCARES_STATICLIB -g
+WSCFLAGS := -std=c99 -Dnswin32 -DCURL_STATICLIB -DCARES_STATICLIB -g
 
 CFLAGS += $(WSCFLAGS)
 LDFLAGS += $(WSCFLAGS)
diff --git a/frontends/windows/options.h b/frontends/windows/options.h
new file mode 100644
index 0000000..50e6e00
--- /dev/null
+++ b/frontends/windows/options.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2016 Vincent Sanders <[email protected]>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _NETSURF_WIN32_OPTIONS_H_
+#define _NETSURF_WIN32_OPTIONS_H_
+
+/* currently nothing here */
+
+#endif
+
+/* location to download files to */
+NSOPTION_STRING(downloads_directory, NULL)
+
+/* where to store URL database */
+NSOPTION_STRING(url_file, NULL)
+
+/* path to save hotlist file */
+NSOPTION_STRING(hotlist_path, NULL)
diff --git a/utils/nsoption.c b/utils/nsoption.c
index f92debb..9ac4778 100644
--- a/utils/nsoption.c
+++ b/utils/nsoption.c
@@ -77,6 +77,8 @@ static struct nsoption_s defaults[] = {
 #include "atari/options.h"
 #elif defined(nsmonkey)
 #include "monkey/options.h"
+#elif defined(nswin32)
+#include "windows/options.h"
 #endif
        { NULL, 0, OPTION_INTEGER, { 0 } }
 };
diff --git a/utils/nsoption.h b/utils/nsoption.h
index 75558f4..62c89c4 100644
--- a/utils/nsoption.h
+++ b/utils/nsoption.h
@@ -71,6 +71,8 @@
 #include "atari/options.h"
 #elif defined(nsmonkey)
 #include "monkey/options.h"
+#elif defined(nswin32)
+#include "windows/options.h"
 #endif
 
 #undef NSOPTION_BOOL
@@ -142,6 +144,8 @@ enum nsoption_e {
 #include "atari/options.h"
 #elif defined(nsmonkey)
 #include "monkey/options.h"
+#elif defined(nswin32)
+#include "windows/options.h"
 #endif
        NSOPTION_LISTEND /* end of list */
 };


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

Summary of changes:
 frontends/windows/Makefile            |    3 +-
 frontends/windows/main.c              |   72 ++++++++++++++++++++++++++++++---
 frontends/{beos => windows}/options.h |   15 ++++---
 utils/nsoption.c                      |    2 +
 utils/nsoption.h                      |    4 ++
 5 files changed, 84 insertions(+), 12 deletions(-)
 copy frontends/{beos => windows}/options.h (70%)

diff --git a/frontends/windows/Makefile b/frontends/windows/Makefile
index cfb1712..baaf225 100644
--- a/frontends/windows/Makefile
+++ b/frontends/windows/Makefile
@@ -15,6 +15,7 @@ LDFLAGS += -lgnurx -lgdi32 -lcomctl32 -lws2_32 -lmsimg32 
-lshlwapi -mwindows
 
 CFLAGS += -U__STRICT_ANSI__ -mwin32
 # only windows versions after XP are supported
+# https://msdn.microsoft.com/en-gb/library/windows/desktop/aa383745
 CFLAGS += '-DWINVER=0x0501'
 CFLAGS += '-D_WIN32_WINNT=0x0501'
 CFLAGS += '-D_WIN32_WINDOWS=0x0501'
@@ -23,7 +24,7 @@ CFLAGS += '-D_WIN32_IE=0x0501'
 #installed resource path
 CFLAGS += '-DNETSURF_WINDOWS_RESPATH="$(NETSURF_WINDOWS_RESPATH)"'
 
-WSCFLAGS := -std=c99 -DCURL_STATICLIB -DCARES_STATICLIB -g
+WSCFLAGS := -std=c99 -Dnswin32 -DCURL_STATICLIB -DCARES_STATICLIB -g
 
 CFLAGS += $(WSCFLAGS)
 LDFLAGS += $(WSCFLAGS)
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index 0d75c70..7b93c3b 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -32,6 +32,8 @@
 #include "utils/file.h"
 #include "utils/nsurl.h"
 #include "utils/nsoption.h"
+#include "netsurf/url_db.h"
+#include "netsurf/cookie_db.h"
 #include "netsurf/browser_window.h"
 #include "netsurf/fetch.h"
 #include "netsurf/misc.h"
@@ -67,6 +69,7 @@ char *nsw32_config_home; /* exported global defined in 
windows/gui.h */
 static nserror get_config_home(char **config_home_out)
 {
        TCHAR adPath[MAX_PATH]; /* appdata path */
+       char nsdir[] = "NetSurf";
        HRESULT hres;
 
        hres = SHGetFolderPath(NULL,
@@ -78,8 +81,7 @@ static nserror get_config_home(char **config_home_out)
                return NSERROR_INVALID;
        }
 
-       hres = PathAppend(adPath, "NetSurf");
-       if (hres != S_OK) {
+       if (PathAppend(adPath, nsdir) == false) {
                return NSERROR_NOT_FOUND;
        }
 
@@ -92,10 +94,10 @@ static nserror get_config_home(char **config_home_out)
                }
        }
 
-       LOG("\"%s\"", adPath);
-
        *config_home_out = strdup(adPath);
 
+       LOG("using config path \"%s\"", *config_home_out);
+
        return NSERROR_OK;
 }
 
@@ -155,8 +157,10 @@ static nserror set_defaults(struct nsoption_s *defaults)
        DWORD buf_tchar_size = PATH_MAX + 1;
        DWORD buf_bytes_size = sizeof(TCHAR) * buf_tchar_size;
        char *ptr = NULL;
-
        char *buf;
+       char *fname;
+       HRESULT hres;
+       char dldir[] = "Downloads";
 
        buf = malloc(buf_bytes_size);
        if (buf== NULL) {
@@ -164,6 +168,7 @@ static nserror set_defaults(struct nsoption_s *defaults)
        }
        buf[0] = '\0';
 
+       /* locate certificate bundle */
        res_len = SearchPathA(NULL,
                              "ca-bundle.crt",
                              NULL,
@@ -173,11 +178,62 @@ static nserror set_defaults(struct nsoption_s *defaults)
        if (res_len > 0) {
                nsoption_setnull_charp(ca_bundle, strdup(buf));
        }
+
+
+       /* download directory default
+        *
+        * unfortunately SHGetKnownFolderPath(FOLDERID_Downloads) is
+        * not available so use the obsolete method of user prodile
+        * with downloads suffixed
+        */
+       buf[0] = '\0';
+
+       hres = SHGetFolderPath(NULL,
+                              CSIDL_PROFILE | CSIDL_FLAG_CREATE,
+                              NULL,
+                              SHGFP_TYPE_CURRENT,
+                              buf);
+       if (hres == S_OK) {
+               if (PathAppend(buf, dldir)) {
+                       nsoption_setnull_charp(downloads_directory,
+                                              strdup(buf));
+
+               }
+       }
+
        free(buf);
        
        /* ensure homepage option has a default */
        nsoption_setnull_charp(homepage_url, strdup(NETSURF_HOMEPAGE));
 
+       /* cookie file default */
+       fname = NULL;
+       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Cookies");
+       if (fname != NULL) {
+               nsoption_setnull_charp(cookie_file, fname);
+       }
+
+       /* cookie jar default */
+       fname = NULL;
+       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Cookies");
+       if (fname != NULL) {
+               nsoption_setnull_charp(cookie_jar, fname);
+       }
+
+       /* url database default */
+       fname = NULL;
+       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "URLs");
+       if (fname != NULL) {
+               nsoption_setnull_charp(url_file, fname);
+       }
+
+       /* bookmark database default */
+       fname = NULL;
+       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Hotlist");
+       if (fname != NULL) {
+               nsoption_setnull_charp(hotlist_path, fname);
+       }
+
        return NSERROR_OK;
 }
 
@@ -306,6 +362,9 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR 
lpcli, int ncmd)
                return 1;
        }
 
+       urldb_load(nsoption_charp(url_file));
+       urldb_load_cookies(nsoption_charp(cookie_file));
+
        ret = nsws_create_main_class(hInstance);
        ret = nsws_create_drawable_class(hInstance);
        ret = nsws_create_localhistory_class(hInstance);
@@ -341,6 +400,9 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR 
lpcli, int ncmd)
                win32_run();
        }
 
+       urldb_save_cookies(nsoption_charp(cookie_jar));
+       urldb_save(nsoption_charp(url_file));
+
        netsurf_exit();
 
        /* finalise options */
diff --git a/frontends/beos/options.h b/frontends/windows/options.h
similarity index 70%
copy from frontends/beos/options.h
copy to frontends/windows/options.h
index 40d23a3..50e6e00 100644
--- a/frontends/beos/options.h
+++ b/frontends/windows/options.h
@@ -1,6 +1,5 @@
 /*
- * Copyright 2008 François Revol <[email protected]>
- * Copyright 2006 Rob Kendrick <[email protected]>
+ * Copyright 2016 Vincent Sanders <[email protected]>
  *
  * This file is part of NetSurf, http://www.netsurf-browser.org/
  *
@@ -17,14 +16,18 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
-#ifndef _NETSURF_BEOS_OPTIONS_H_
-#define _NETSURF_BEOS_OPTIONS_H_
+#ifndef _NETSURF_WIN32_OPTIONS_H_
+#define _NETSURF_WIN32_OPTIONS_H_
 
 /* currently nothing here */
 
 #endif
 
-NSOPTION_BOOL(render_resample, false)
+/* location to download files to */
+NSOPTION_STRING(downloads_directory, NULL)
+
+/* where to store URL database */
 NSOPTION_STRING(url_file, NULL)
 
+/* path to save hotlist file */
+NSOPTION_STRING(hotlist_path, NULL)
diff --git a/utils/nsoption.c b/utils/nsoption.c
index f92debb..9ac4778 100644
--- a/utils/nsoption.c
+++ b/utils/nsoption.c
@@ -77,6 +77,8 @@ static struct nsoption_s defaults[] = {
 #include "atari/options.h"
 #elif defined(nsmonkey)
 #include "monkey/options.h"
+#elif defined(nswin32)
+#include "windows/options.h"
 #endif
        { NULL, 0, OPTION_INTEGER, { 0 } }
 };
diff --git a/utils/nsoption.h b/utils/nsoption.h
index 75558f4..62c89c4 100644
--- a/utils/nsoption.h
+++ b/utils/nsoption.h
@@ -71,6 +71,8 @@
 #include "atari/options.h"
 #elif defined(nsmonkey)
 #include "monkey/options.h"
+#elif defined(nswin32)
+#include "windows/options.h"
 #endif
 
 #undef NSOPTION_BOOL
@@ -142,6 +144,8 @@ enum nsoption_e {
 #include "atari/options.h"
 #elif defined(nsmonkey)
 #include "monkey/options.h"
+#elif defined(nswin32)
+#include "windows/options.h"
 #endif
        NSOPTION_LISTEND /* end of list */
 };


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to