From ce9b0836a0cdbf81b8fdc47f163b8a165d331101 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 26 Mar 2016 02:19:30 +0000 Subject: Added integer settings for plugins --- src/plugins/settings.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/plugins/settings.c') diff --git a/src/plugins/settings.c b/src/plugins/settings.c index dcaf2270..08d982d0 100644 --- a/src/plugins/settings.c +++ b/src/plugins/settings.c @@ -111,6 +111,23 @@ plugin_settings_set_string(const char *const group, const char *const key, const _save_settings(); } +int +plugin_settings_get_int(const char *const group, const char *const key, int def) +{ + if (group && key && g_key_file_has_key(settings, group, key, NULL)) { + return g_key_file_get_integer(settings, group, key, NULL); + } else { + return def; + } +} + +void +plugin_settings_set_int(const char *const group, const char *const key, int value) +{ + g_key_file_set_integer(settings, group, key, value); + _save_settings(); +} + static void _save_settings(void) { -- cgit 1.4.1-2-gfad0