about summary refs log tree commit diff
path: root/surf.c
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2015-11-29 17:16:48 +0100
committerQuentin Rameau <quinq@fifth.space>2016-07-05 13:01:56 +0200
commit2aa1c38aed02bfc37379476a07516172b2817cae (patch)
treed04729059648df6252ac2216789ff2893ba7b950 /surf.c
parentDisable globbing in curl command (diff)
downloadsurf-2aa1c38aed02bfc37379476a07516172b2817cae.tar.gz
surf-2aa1c38aed02bfc37379476a07516172b2817cae.tar.bz2
surf-2aa1c38aed02bfc37379476a07516172b2817cae.zip
Introduce new data structure for handling settings
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/surf.c b/surf.c
index 8f2bfe9..43b1531 100644
--- a/surf.c
+++ b/surf.c
@@ -31,18 +31,42 @@
 
 #define LENGTH(x)               (sizeof(x) / sizeof(x[0]))
 #define CLEANMASK(mask)         (mask & (MODKEY|GDK_SHIFT_MASK))
+#define SETB(p, s)              [p] = (Parameter){ { .b = s }, }
+#define SETI(p, s)              [p] = (Parameter){ { .i = s }, }
+#define SETV(p, s)              [p] = (Parameter){ { .v = s }, }
+#define SETF(p, s)              [p] = (Parameter){ { .f = s }, }
+#define FSETB(p, s)             [p] = (Parameter){ { .b = s }, 1 }
+#define FSETI(p, s)             [p] = (Parameter){ { .i = s }, 1 }
+#define FSETV(p, s)             [p] = (Parameter){ { .v = s }, 1 }
+#define FSETF(p, s)             [p] = (Parameter){ { .f = s }, 1 }
 
 enum { AtomFind, AtomGo, AtomUri, AtomLast };
 
-enum {
+typedef enum {
 	CaretBrowsing,
+	CookiePolicies,
+	DiskCache,
+	DNSPrefetch,
+	FontSize,
 	FrameFlattening,
 	Geolocation,
+	HideBackground,
+	Inspector,
 	JavaScript,
+	KioskMode,
 	LoadImages,
 	Plugins,
+	PreferredLanguages,
+	RunInFullscreen,
 	ScrollBars,
-};
+	ShowIndicators,
+	SpellChecking,
+	SpellLanguages,
+	StrictSSL,
+	Style,
+	ZoomLevel,
+	ParameterLast,
+} ParamName;
 
 enum {
 	OnDoc   = WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT,
@@ -58,9 +82,15 @@ enum {
 typedef union {
 	int b;
 	int i;
+	float f;
 	const void *v;
 } Arg;
 
+typedef struct {
+	Arg val;
+	int force;
+} Parameter;
+
 typedef struct Client {
 	GtkWidget *win;
 	WebKitWebView *view;
@@ -92,6 +122,12 @@ typedef struct {
 } Button;
 
 typedef struct {
+	const char *uri;
+	Parameter config[ParameterLast];
+	regex_t re;
+} UriParameters;
+
+typedef struct {
 	char *regex;
 	char *style;
 	regex_t re;