diff options
-rw-r--r-- | include/setting.h | 1 | ||||
-rw-r--r-- | src/main.c | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/include/setting.h b/include/setting.h index 78adad78..3ea631a8 100644 --- a/include/setting.h +++ b/include/setting.h @@ -27,6 +27,7 @@ extern "C" { #endif connman_bool_t connman_setting_get_bool(const char *key); +char **connman_setting_get_string_list(const char *key); #ifdef __cplusplus } @@ -44,8 +44,10 @@ static struct { connman_bool_t bg_scan; + char **pref_timeservers; } connman_settings = { .bg_scan = TRUE, + .pref_timeservers = NULL, }; static GKeyFile *load_config(const char *file) @@ -75,6 +77,7 @@ static void parse_config(GKeyFile *config) { GError *error = NULL; gboolean boolean; + char **timeservers; if (config == NULL) return; @@ -87,6 +90,13 @@ static void parse_config(GKeyFile *config) connman_settings.bg_scan = boolean; g_clear_error(&error); + + timeservers = g_key_file_get_string_list(config, "General", + "FallbackTimeservers", NULL, &error); + if (error == NULL) + connman_settings.pref_timeservers = timeservers; + + g_clear_error(&error); } static GMainLoop *main_loop = NULL; @@ -237,6 +247,14 @@ connman_bool_t connman_setting_get_bool(const char *key) return FALSE; } +char **connman_setting_get_string_list(const char *key) +{ + if (g_str_equal(key, "FallbackTimeservers") == TRUE) + return connman_settings.pref_timeservers; + + return NULL; +} + int main(int argc, char *argv[]) { GOptionContext *context; @@ -419,6 +437,9 @@ int main(int argc, char *argv[]) if (config) g_key_file_free(config); + if (connman_settings.pref_timeservers != NULL) + g_strfreev(connman_settings.pref_timeservers); + g_free(option_debug); return 0; |