diff options
author | Michael Terry <michael.terry@canonical.com> | 2014-03-17 22:05:57 -0400 |
---|---|---|
committer | Michael Terry <michael.terry@canonical.com> | 2014-03-17 22:05:57 -0400 |
commit | 9ee502417ce58ab161b86ecca91b954663ca1b31 (patch) | |
tree | a869b94ce289eb30ec213574c2e41a3ce751fec0 /liblightdm-gobject | |
parent | 7eb48d9cba1ac45532b51b0953a59dbfe72ba9a0 (diff) | |
download | lightdm-9ee502417ce58ab161b86ecca91b954663ca1b31.tar.gz |
Move config loading into one function; move that function into libcommon; call it from liblightdm too
Diffstat (limited to 'liblightdm-gobject')
-rw-r--r-- | liblightdm-gobject/session.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/liblightdm-gobject/session.c b/liblightdm-gobject/session.c index 0b89eab7..e3ef2953 100644 --- a/liblightdm-gobject/session.c +++ b/liblightdm-gobject/session.c @@ -192,11 +192,10 @@ load_sessions (const gchar *sessions_dir) static void update_sessions (void) { - gchar *config_path = NULL; gchar *sessions_dir; gchar *remote_sessions_dir; gboolean result; - GError *error = NULL; + gchar *value; if (have_sessions) return; @@ -205,32 +204,21 @@ update_sessions (void) remote_sessions_dir = g_strdup (REMOTE_SESSIONS_DIR); /* Use session directory from configuration */ - /* FIXME: This should be sent in the greeter connection */ - config_path = g_build_filename (CONFIG_DIR, "lightdm.conf", NULL); - /* FIXME: This should load from lightdm.conf.d as well */ - result = config_load_from_file (config_get_instance (), config_path, &error); - if (error && !g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) - g_warning ("Failed to open configuration file: %s", error->message); - g_clear_error (&error); - if (result) - { - gchar *value; + config_load_from_standard_locations (config_get_instance (), NULL, NULL); - value = config_get_string (config_get_instance (), "LightDM", "sessions-directory"); - if (value) - { - g_free (sessions_dir); - sessions_dir = value; - } + value = config_get_string (config_get_instance (), "LightDM", "sessions-directory"); + if (value) + { + g_free (sessions_dir); + sessions_dir = value; + } - value = config_get_string (config_get_instance (), "LightDM", "remote-sessions-directory"); - if (value) - { - g_free (remote_sessions_dir); - remote_sessions_dir = value; - } + value = config_get_string (config_get_instance (), "LightDM", "remote-sessions-directory"); + if (value) + { + g_free (remote_sessions_dir); + remote_sessions_dir = value; } - g_free (config_path); local_sessions = load_sessions (sessions_dir); remote_sessions = load_sessions (remote_sessions_dir); |