From d74ba9036540c746291012956eaa6eb82000cb85 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 04 Oct 2017 19:22:23 -0400 Subject: src/config.c: Set configuration defaults --- (limited to 'src/config.c') diff --git a/src/config.c b/src/config.c index 41c0a27..ad8006f 100644 --- a/src/config.c +++ b/src/config.c @@ -86,15 +86,116 @@ set_type_or_run_callbacks(MqConfig *config, const gchar *name, gpointer value, } } +#define SET_BOOL(NAME, VALUE) mq_config_set_boolean(config, NAME, VALUE) +#define SET_INT( NAME, VALUE) mq_config_set_integer(config, NAME, VALUE) +#define SET_DBL( NAME, VALUE) mq_config_set_double (config, NAME, VALUE) +#define SET_STR( NAME, VALUE) do { *NAME = *NAME; *VALUE = *VALUE; } while (0) +#define SET_STRL(NAME, VALUE) do { *NAME = *NAME; *VALUE = *VALUE; } while (0) + static void set_defaults(MqConfig *config) { config->types_and_cbs_set = FALSE; + /* General -> Web Browsing */ + SET_STR ("tabs.new", "home"); + SET_STR ("tabs.home", ""); /* TODO */ + SET_BOOL("tabs.background", TRUE); + SET_BOOL("tabs.warn-on-close", TRUE); + + /* General -> Navigation and Accessibility */ + SET_BOOL("navigation.smooth-scrolling", TRUE); + SET_BOOL("navigation.tabbing", TRUE); + SET_BOOL("navigation.caret", FALSE); + SET_BOOL("navigation.spatial", FALSE); + + /* General -> Spell Checking */ + SET_BOOL("spell.enable", TRUE); + SET_STRL("spell.langs", "en_US"); /* TODO */ + + /* General -> Miscellaneous */ + // resizable text areas + SET_BOOL("devtools.enable", TRUE); + + /* General -> Compatibility */ + SET_STR ("compatibility.user-agent", "default"); /* TODO */ + SET_BOOL("compatibility.quirks", TRUE); + + /* Display -> Fonts */ + SET_STR ("font.family.default", "sans-serif"); + SET_STR ("font.family.monospace", "monospace"); + SET_STR ("font.family.serif", "serif"); + SET_STR ("font.family.sans-serif", "sans-serif"); + SET_STR ("font.family.cursive", "serif"); + SET_STR ("font.family.fantasy", "serif"); + SET_STR ("font.family.pictograph", "serif"); + SET_INT ("font.size.default", 16); + SET_INT ("font.size.monospace-default", 13); + SET_INT ("font.size.minimum", 0); + + /* Display -> Languages */ + SET_STRL("intl.accept-languages", "en-us"); /* TODO */ + SET_STR ("intl.default-charset", "iso-8859-1"); // TODO + + /* Display -> Zoom */ + SET_DBL ("zoom.default", 1.00); + SET_BOOL("zoom.text-only", FALSE); + + /* Permissions -> General */ + SET_BOOL("permissions.images.auto-load", TRUE); + SET_BOOL("permissions.images.favicons.override", FALSE); + SET_BOOL("permissions.java.enable", TRUE); + SET_BOOL("permissions.javascript.enable", TRUE); + SET_BOOL("permissions.plugins.enable", TRUE); + + /* Permissions -> JavaScript */ + SET_BOOL("permissions.javascript.open-windows", FALSE); + SET_BOOL("permissions.javascript.fullscreen", TRUE); + SET_BOOL("permissions.javascript.modal-dialogs", FALSE); + SET_BOOL("permissions.javascript.clipboard", FALSE); + + /* Permissions -> Data Storage */ + SET_BOOL("permissions.javascript.database", TRUE); + SET_BOOL("permissions.javascript.storage", TRUE); + SET_BOOL("permissions.appcache", TRUE); + + /* Permissions -> Graphics and Multimedia */ + SET_BOOL("canvas.acceleration.enable", FALSE); + SET_BOOL("permissions.javascript.webgl", FALSE); + SET_BOOL("permissions.javascript.audio", FALSE); + SET_BOOL("media.autoplay", TRUE); + SET_BOOL("media.force-fullscreen", FALSE); + // MediaStream + // MediaSource + + /* Security and Privacy -> History */ + SET_BOOL("privacy.private-browsing.enabled", FALSE); + SET_BOOL("privacy.remember.history", TRUE); + SET_BOOL("privacy.remember.downloads", TRUE); + + /* Security and Privacy -> Cookies */ + SET_STR ("cookies.accept", "always"); + + /* Security and Privacy -> Security */ + SET_BOOL("security.xss-auditor.enable", TRUE); + + /* Security and Privacy -> Network */ + SET_BOOL("dns.prefetch.enable", TRUE); + + /* Hidden window state preferences */ + SET_BOOL("window.maximized", FALSE); + SET_INT ("window.width", 1024); + SET_INT ("window.height", 768); config->types_and_cbs_set = TRUE; } +#undef SET_BOOL +#undef SET_INT +#undef SET_DBL +#undef SET_STR +#undef SET_STRL + MqConfig * mq_config_new(const gchar *profile) { -- cgit v0.9.1