"Safari/537.15 Surf/"VERSION;
static char *scriptfile = "~/.surf/script.js";
static char *styledir = "~/.surf/styles/";
+static char *cachefolder = "~/.surf/cache/";
static Bool kioskmode = FALSE; /* Ignore shortcuts */
static Bool showindicators = TRUE; /* Show indicators in window title */
static time_t sessiontime = 3600;
/* Webkit default features */
-static Bool enablescrollbars = TRUE;
+static Bool enablescrollbars = TRUE;
static Bool enablespatialbrowsing = TRUE;
-static Bool enableplugins = TRUE;
-static Bool enablescripts = TRUE;
-static Bool enableinspector = TRUE;
-static Bool enablestyles = TRUE;
-static Bool loadimages = TRUE;
-static Bool hidebackground = FALSE;
-static Bool allowgeolocation = TRUE;
+static Bool enablediskcache = TRUE;
+static int diskcachebytes = 5 * 1024 * 1024;
+static Bool enableplugins = TRUE;
+static Bool enablescripts = TRUE;
+static Bool enableinspector = TRUE;
+static Bool enablestyles = TRUE;
+static Bool loadimages = TRUE;
+static Bool hidebackground = FALSE;
+static Bool allowgeolocation = TRUE;
#define SETPROP(p, q) { \
.v = (char *[]){ "/bin/sh", "-c", \
static gboolean showxid = FALSE;
static char winid[64];
static gboolean usingproxy = 0;
-static char togglestat[8];
+static char togglestat[9];
static char pagestat[3];
static GTlsDatabase *tlsdb;
static int policysel = 0;
static char *stylefile = NULL;
+static SoupCache *diskcache = NULL;
static void addaccelgroup(Client *c);
static void beforerequest(WebKitWebView *w, WebKitWebFrame *f,
static void
cleanup(void) {
+ if (diskcache) {
+ soup_cache_flush(diskcache);
+ soup_cache_dump(diskcache);
+ }
while(clients)
destroyclient(clients);
g_free(cookiefile);
case WEBKIT_LOAD_FINISHED:
c->progress = 100;
updatetitle(c);
+ if (diskcache) {
+ soup_cache_flush(diskcache);
+ soup_cache_dump(diskcache);
+ }
break;
default:
break;
cmd[i++] = "-s";
if(showxid)
cmd[i++] = "-x";
+ if(enablediskcache)
+ cmd[i++] = "-D";
cmd[i++] = "-c";
cmd[i++] = cookiefile;
cmd[i++] = "--";
/* dirs and files */
cookiefile = buildpath(cookiefile);
scriptfile = buildpath(scriptfile);
+ cachefolder = buildpath(cachefolder);
styledir = buildpath(styledir);
if(stylefile == NULL && enablestyles) {
for(i = 0; i < LENGTH(styles); i++) {
SOUP_SESSION_FEATURE(cookiejar_new(cookiefile, FALSE,
cookiepolicy_get())));
+ /* disk cache */
+ if(enablediskcache) {
+ diskcache = soup_cache_new(cachefolder, SOUP_CACHE_SINGLE_USER);
+ soup_cache_set_max_size(diskcache, diskcachebytes);
+ soup_cache_load(diskcache);
+ soup_session_add_feature(s, SOUP_SESSION_FEATURE(diskcache));
+ }
+
/* ssl */
tlsdb = g_tls_file_database_new(cafile, &error);
togglestat[p++] = allowgeolocation? 'G': 'g';
+ togglestat[p++] = enablediskcache? 'D': 'd';
+
g_object_get(G_OBJECT(settings), "auto-load-images", &value, NULL);
togglestat[p++] = value? 'I': 'i';
case 'c':
cookiefile = EARGF(usage());
break;
+ case 'd':
+ enablediskcache = 0;
+ break;
+ case 'D':
+ enablediskcache = 1;
+ break;
case 'e':
embed = strtol(EARGF(usage()), NULL, 0);
break;