diff options
author | Alberto Ruiz <aruiz@redhat.com> | 2015-07-14 21:32:52 +0100 |
---|---|---|
committer | Alberto Ruiz <aruiz@redhat.com> | 2015-10-13 14:00:23 +0100 |
commit | 7d6a894e4912460019763b0e5cb7304ead30f4cb (patch) | |
tree | 632130405a238ddedb705c2c7b8cbac77cf0f70d | |
parent | a9fa72df89525dd0083e0e02f80ec7e6e9a89e20 (diff) | |
download | dconf-7d6a894e4912460019763b0e5cb7304ead30f4cb.tar.gz |
engine: if a dconf.profile file or link is placed in XDG_RUNTIME_DIR that takes precedence over other profile files
-rw-r--r-- | engine/dconf-engine-profile.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/engine/dconf-engine-profile.c b/engine/dconf-engine-profile.c index d3163b5..932479a 100644 --- a/engine/dconf-engine-profile.c +++ b/engine/dconf-engine-profile.c @@ -224,6 +224,21 @@ dconf_engine_open_profile_file (const gchar *profile) return fp; } +static FILE * +dconf_engine_get_runtime_profile (void) { + gchar *filename; + FILE *fp; + + filename = g_build_filename (g_get_user_runtime_dir (), "dconf.profile", NULL); + fp = fopen (filename, "r"); + + if (fp == NULL) + g_debug ("Unable to open %s: %s", filename, g_strerror (errno)); + + g_free (filename); + return fp; +} + DConfEngineSource ** dconf_engine_profile_open (const gchar *profile, gint *n_sources) @@ -236,7 +251,10 @@ dconf_engine_profile_open (const gchar *profile, if (profile == NULL) { - file = dconf_engine_open_profile_file ("user"); + file = dconf_engine_get_runtime_profile (); + + if (file == NULL) + file = dconf_engine_open_profile_file ("user"); /* Only in the case that no profile was specified do we use this * fallback. |