summaryrefslogtreecommitdiff
path: root/src/dged/settings.h
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2024-01-31 14:32:10 +0100
committerAlbert Cervin <albert@acervin.com>2024-01-31 14:32:10 +0100
commit9382250e21488feec982ff7dfffb5df05b39a290 (patch)
treeea8a8867a39a2935cf16b00662daea187d34316a /src/dged/settings.h
parenta393f2e1dc0fb163d5df00ffc6f29ab4350619e7 (diff)
downloaddged-9382250e21488feec982ff7dfffb5df05b39a290.tar.gz
dged-9382250e21488feec982ff7dfffb5df05b39a290.tar.xz
dged-9382250e21488feec982ff7dfffb5df05b39a290.zip
Change how language and settings work
No need to register settings anymore and languages can better handle arbitrary settings now.
Diffstat (limited to 'src/dged/settings.h')
-rw-r--r--src/dged/settings.h26
1 files changed, 15 insertions, 11 deletions
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
@@ -77,17 +77,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 <category>.<sub-category>.<setting-name>.
- * @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.
*
* @param path The exact path of the setting on
@@ -119,6 +108,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 <category>.<sub-category>.<setting-name>.
+ * @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.
*
* @param setting Pointer to a setting to set.
@@ -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.
*