summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-11-06 16:55:17 (EST)
committer Patrick McDermott <pj@pehjota.net>2017-11-06 16:55:17 (EST)
commitc902685c47e70bfbb45b74c4a1d2b631bd16974a (patch)
tree864680c115ff740d8b97f09e5fc8b93db5a4bf4f
parent03f412a9ed8bdb1ba57242cb7874a2efc90094cb (diff)
downloadmarquee-c902685c47e70bfbb45b74c4a1d2b631bd16974a.zip
marquee-c902685c47e70bfbb45b74c4a1d2b631bd16974a.tar.gz
marquee-c902685c47e70bfbb45b74c4a1d2b631bd16974a.tar.bz2
mq_config_new(): Add a profile type argument
-rw-r--r--src/application.c2
-rw-r--r--src/config/config.c15
-rw-r--r--src/config/config.h7
3 files changed, 16 insertions, 8 deletions
diff --git a/src/application.c b/src/application.c
index 04e09ad..742d7cd 100644
--- a/src/application.c
+++ b/src/application.c
@@ -87,7 +87,7 @@ mq_application_new(const gchar *profile)
application = malloc(sizeof(*application));
application->profiles = mq_profiles_new();
mq_profiles_set_current(application->profiles, profile);
- application->config = mq_config_new(profile);
+ application->config = mq_config_new(profile, MQ_CONFIG_PROFILE_DEFAULT);
mq_config_load(application->config);
application->windows = NULL;
application->tabs = g_hash_table_new_full(g_int64_hash, g_int64_equal,
diff --git a/src/config/config.c b/src/config/config.c
index ce992f4..9951765 100644
--- a/src/config/config.c
+++ b/src/config/config.c
@@ -70,7 +70,7 @@ struct item {
#define SET_STRL(NAME, VALUE) mq_config_set_string (config, NAME, VALUE)
static void
-set_defaults(MqConfig *config)
+set_defaults(MqConfig *config, MqConfigProfile profile)
{
config->types_and_cbs_set = FALSE;
@@ -146,9 +146,12 @@ set_defaults(MqConfig *config)
SET_BOOL("permissions.javascript.mediasource.enable", FALSE);
/* Security and Privacy -> History */
- SET_BOOL("privacy.private-browsing.enabled", FALSE);
- SET_BOOL("privacy.remember.history", TRUE);
- SET_BOOL("privacy.remember.downloads", TRUE);
+ SET_BOOL("privacy.private-browsing.enabled",
+ profile == MQ_CONFIG_PROFILE_PRIVATE);
+ SET_BOOL("privacy.remember.history",
+ profile != MQ_CONFIG_PROFILE_PRIVATE);
+ SET_BOOL("privacy.remember.downloads",
+ profile != MQ_CONFIG_PROFILE_PRIVATE);
/* Security and Privacy -> Cookies */
SET_STR ("cookies.accept", "always");
@@ -179,7 +182,7 @@ set_defaults(MqConfig *config)
#undef SET_STRL
MqConfig *
-mq_config_new(const gchar *profile)
+mq_config_new(const gchar *profile, MqConfigProfile profile_type)
{
MqConfig *config;
@@ -190,7 +193,7 @@ mq_config_new(const gchar *profile)
PACKAGE, profile, "config", NULL);
config->key_file = g_key_file_new();
config->types_and_cbs = g_hash_table_new(g_str_hash, g_int_equal);
- set_defaults(config);
+ set_defaults(config, profile_type);
return config;
}
diff --git a/src/config/config.h b/src/config/config.h
index ec64b65..17859de 100644
--- a/src/config/config.h
+++ b/src/config/config.h
@@ -28,6 +28,11 @@ typedef struct MqConfig MqConfig;
G_BEGIN_DECLS
+typedef enum {
+ MQ_CONFIG_PROFILE_DEFAULT,
+ MQ_CONFIG_PROFILE_PRIVATE,
+} MqConfigProfile;
+
typedef void (*MqConfigBooleanCallback)(MqConfig *,
const gchar *, const gboolean, gpointer);
typedef void (*MqConfigIntegerCallback)(MqConfig *,
@@ -38,7 +43,7 @@ typedef void (*MqConfigStringCallback)(MqConfig *,
const gchar *, const gchar *, gpointer);
MqConfig *
-mq_config_new(const gchar *profile);
+mq_config_new(const gchar *profile, MqConfigProfile profile_type);
gboolean
mq_config_load(MqConfig *config);