summaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/src/config.c b/src/config.c
index 85487c0..6074773 100644
--- a/src/config.c
+++ b/src/config.c
@@ -55,48 +55,6 @@ struct item {
struct callbacks *callbacks;
};
-static void
-set_type_or_run_callbacks(MqConfig *config, const gchar *name, gpointer value,
- enum type type)
-{
- struct item *item;
- struct callbacks *cbs;
-
- if (!config->types_and_cbs_set) {
- item = g_malloc(sizeof(*item));
- item->type = type;
- item->callbacks = NULL;
- g_hash_table_insert(config->types_and_cbs, g_strdup(name),
- item);
- } else {
- item = g_hash_table_lookup(config->types_and_cbs, name);
- for (cbs = item->callbacks; cbs; cbs = cbs->next) {
- switch (item->type) {
- case TYPE_BOOLEAN:
- cbs->cb.boolean_cb(name,
- *((gboolean *) value),
- cbs->user_data);
- break;
- case TYPE_INTEGER:
- cbs->cb.integer_cb(name,
- *((gint *) value),
- cbs->user_data);
- break;
- case TYPE_DOUBLE:
- cbs->cb.double_cb(name,
- *((gdouble *) value),
- cbs->user_data);
- break;
- case TYPE_STRING:
- cbs->cb.string_cb(name,
- (gchar *) value,
- cbs->user_data);
- break;
- }
- }
- }
-}
-
#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)
@@ -324,6 +282,48 @@ mq_config_get_string(MqConfig *config, const gchar *name)
return value;
}
+static void
+set_type_or_run_callbacks(MqConfig *config, const gchar *name, gpointer value,
+ enum type type)
+{
+ struct item *item;
+ struct callbacks *cbs;
+
+ if (!config->types_and_cbs_set) {
+ item = g_malloc(sizeof(*item));
+ item->type = type;
+ item->callbacks = NULL;
+ g_hash_table_insert(config->types_and_cbs, g_strdup(name),
+ item);
+ } else {
+ item = g_hash_table_lookup(config->types_and_cbs, name);
+ for (cbs = item->callbacks; cbs; cbs = cbs->next) {
+ switch (item->type) {
+ case TYPE_BOOLEAN:
+ cbs->cb.boolean_cb(name,
+ *((gboolean *) value),
+ cbs->user_data);
+ break;
+ case TYPE_INTEGER:
+ cbs->cb.integer_cb(name,
+ *((gint *) value),
+ cbs->user_data);
+ break;
+ case TYPE_DOUBLE:
+ cbs->cb.double_cb(name,
+ *((gdouble *) value),
+ cbs->user_data);
+ break;
+ case TYPE_STRING:
+ cbs->cb.string_cb(name,
+ (gchar *) value,
+ cbs->user_data);
+ break;
+ }
+ }
+ }
+}
+
void
mq_config_set_boolean(MqConfig *config, const gchar *name, gboolean value)
{