From 9382250e21488feec982ff7dfffb5df05b39a290 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Wed, 31 Jan 2024 14:32:10 +0100 Subject: Change how language and settings work No need to register settings anymore and languages can better handle arbitrary settings now. --- src/dged/settings.h | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/dged/settings.h') diff --git a/src/dged/settings.h b/src/dged/settings.h index 637844b..6e94d64 100644 --- a/src/dged/settings.h +++ b/src/dged/settings.h @@ -76,17 +76,6 @@ void settings_init(uint32_t initial_capacity); */ void settings_destroy(); -/** - * Register a new setting. - * - * @param path The path of the new setting on - * the form ... - * @param default_value The default value for the setting. - * All settings are required to declare a default value. - */ -void settings_register_setting(const char *path, - struct setting_value default_value); - /** * Retrieve a single setting by path. * @@ -118,6 +107,19 @@ void settings_get_prefix(const char *prefix, struct setting **settings_out[], */ void settings_set(const char *path, struct setting_value value); +/** + * Set the default value for a setting. + * + * This works the same as @ref settings_set but + * will not overwrite the value if the setting already has one. + * + * @param path The exact path of the setting on + * the form ... + * @param value The new value of the setting. The type has to match the declared + * type for the setting. If not, the new value is ignored. + */ +void settings_set_default(const char *path, struct setting_value value); + /** * Set a value for a setting. * @@ -136,6 +138,8 @@ void setting_set_value(struct setting *setting, struct setting_value val); */ void setting_to_string(struct setting *setting, char *buf, size_t n); +const char *setting_join_key(const char *initial, const char *setting); + /** * Parse settings from a string in TOML format. * -- cgit v1.2.3