summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-11-01 11:22:18 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-11-01 11:22:18 (EDT)
commitf3fc14cb105961fde293cdd7fe319682e7cbff0e (patch)
tree8c64d86deed2fe4e38d44b0e04ed680afbda3fa7 /src
parent0a8468d4ff45758602263e0c50df66f1ea702a0d (diff)
downloadmarquee-f3fc14cb105961fde293cdd7fe319682e7cbff0e.zip
marquee-f3fc14cb105961fde293cdd7fe319682e7cbff0e.tar.gz
marquee-f3fc14cb105961fde293cdd7fe319682e7cbff0e.tar.bz2
MqSettings: Store mapping struct pointers in mappings table
This way, the type is also available.
Diffstat (limited to 'src')
-rw-r--r--src/settings.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/settings.c b/src/settings.c
index c48ccb0..f261d41 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -181,8 +181,7 @@ init_mappings_table(void)
for (i = 0; i < sizeof(mappings) / sizeof(mappings[0]); ++i) {
g_hash_table_insert(mappings_table,
- g_strdup(mappings[i].mq_name),
- g_strdup(mappings[i].wk_name));
+ g_strdup(mappings[i].mq_name), &mappings[i]);
}
}
@@ -212,6 +211,10 @@ mq_settings_set_web_context(MqSettings *settings, WebKitWebContext *web_context)
settings->web_context = web_context;
}
+#define map_name(NAME) \
+ (((struct mapping *) g_hash_table_lookup(mappings_table, \
+ NAME))->wk_name)
+
static void
set_bool(MqSettings *settings, const gchar *name, const gboolean value)
{
@@ -219,8 +222,7 @@ set_bool(MqSettings *settings, const gchar *name, const gboolean value)
g_value_init(&g_value, G_TYPE_BOOLEAN);
g_value_set_boolean(&g_value, value);
- g_object_set_property(G_OBJECT(settings),
- g_hash_table_lookup(mappings_table, name), &g_value);
+ g_object_set_property(G_OBJECT(settings), map_name(name), &g_value);
}
static void
@@ -230,8 +232,7 @@ set_int(MqSettings *settings, const gchar *name, const gint value)
g_value_init(&g_value, G_TYPE_INT);
g_value_set_int(&g_value, value);
- g_object_set_property(G_OBJECT(settings),
- g_hash_table_lookup(mappings_table, name), &g_value);
+ g_object_set_property(G_OBJECT(settings), map_name(name), &g_value);
}
static void
@@ -241,8 +242,7 @@ set_str(MqSettings *settings, const gchar *name, const gchar *value)
g_value_init(&g_value, G_TYPE_STRING);
g_value_set_static_string(&g_value, value);
- g_object_set_property(G_OBJECT(settings),
- g_hash_table_lookup(mappings_table, name), &g_value);
+ g_object_set_property(G_OBJECT(settings), map_name(name), &g_value);
}
void