summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-11-01 11:25:25 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-11-01 11:25:25 (EDT)
commit50fe0d29337a6a78fe2913363e605de6a4e28309 (patch)
tree3acddce805311922d105545bb18d01099b25dab3
parentf3fc14cb105961fde293cdd7fe319682e7cbff0e (diff)
downloadmarquee-50fe0d29337a6a78fe2913363e605de6a4e28309.zip
marquee-50fe0d29337a6a78fe2913363e605de6a4e28309.tar.gz
marquee-50fe0d29337a6a78fe2913363e605de6a4e28309.tar.bz2
MqSettings: Fix negated boolean mappings
-rw-r--r--src/settings.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/settings.c b/src/settings.c
index f261d41..c8595f9 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -211,6 +211,9 @@ mq_settings_set_web_context(MqSettings *settings, WebKitWebContext *web_context)
settings->web_context = web_context;
}
+#define is_neg(NAME) \
+ (((struct mapping *) g_hash_table_lookup(mappings_table, \
+ NAME))->type == MAP_BOOL_N)
#define map_name(NAME) \
(((struct mapping *) g_hash_table_lookup(mappings_table, \
NAME))->wk_name)
@@ -221,7 +224,7 @@ set_bool(MqSettings *settings, const gchar *name, const gboolean value)
GValue g_value = G_VALUE_INIT;
g_value_init(&g_value, G_TYPE_BOOLEAN);
- g_value_set_boolean(&g_value, value);
+ g_value_set_boolean(&g_value, is_neg(name) ? !value : value);
g_object_set_property(G_OBJECT(settings), map_name(name), &g_value);
}