diff options
author | James Booth <boothj5@gmail.com> | 2016-03-26 01:48:42 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2016-03-26 01:48:42 +0000 |
commit | e2b02733df157f0ec6a04713f89680332068e8f8 (patch) | |
tree | 89a04edd49156f8f0f1fe968970e971f357d0816 /src/plugins/settings.c | |
parent | a4e6d50a4016fa025f72bf42d3da2d4fe3f4b2dc (diff) | |
download | profani-tty-e2b02733df157f0ec6a04713f89680332068e8f8.tar.gz |
Added plugin string settings
Diffstat (limited to 'src/plugins/settings.c')
-rw-r--r-- | src/plugins/settings.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/plugins/settings.c b/src/plugins/settings.c index 7d915e9b..dcaf2270 100644 --- a/src/plugins/settings.c +++ b/src/plugins/settings.c @@ -92,6 +92,25 @@ plugin_settings_set_boolean(const char *const group, const char *const key, gboo _save_settings(); } +char* +plugin_settings_get_string(const char *const group, const char *const key, const char *const def) +{ + if (group && key && g_key_file_has_key(settings, group, key, NULL)) { + return g_key_file_get_string(settings, group, key, NULL); + } else if (def) { + return strdup(def); + } else { + return NULL; + } +} + +void +plugin_settings_set_string(const char *const group, const char *const key, const char *const value) +{ + g_key_file_set_string(settings, group, key, value); + _save_settings(); +} + static void _save_settings(void) { |