summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index ded3bb1b..6e0d64df 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;