Commit 151d3b01 authored by Ryan Hendrickson's avatar Ryan Hendrickson Committed by Philip Withnall

gsettings: check $XDG_DATA_HOME for schemas

Add $XDG_DATA_HOME/glib-2.0/schemas as a schema source, after (higher
priority than) $XDG_DATA_DIRS/glib-2.0/schemas but before
$GSETTINGS_SCHEMA_DIR. This is per the XDG Base Directory Specification,
which states that user specific versions of data in $XDG_DATA_DIRS can
be created in $XDG_DATA_HOME.

https://bugzilla.gnome.org/show_bug.cgi?id=741335
parent 3de1fac3
......@@ -321,6 +321,14 @@ try_prepend_dir (const gchar *directory)
schema_sources = source;
}
static void
try_prepend_data_dir (const gchar *directory)
{
const gchar *dirname = g_build_filename (directory, "glib-2.0", "schemas", NULL);
try_prepend_dir (dirname);
g_free (dirname);
}
static void
initialise_schema_sources (void)
{
......@@ -340,13 +348,9 @@ initialise_schema_sources (void)
for (i = 0; dirs[i]; i++);
while (i--)
{
gchar *dirname;
try_prepend_data_dir (dirs[i]);
dirname = g_build_filename (dirs[i], "glib-2.0", "schemas", NULL);
try_prepend_dir (dirname);
g_free (dirname);
}
try_prepend_data_dir (g_get_user_data_dir ());
if ((path = g_getenv ("GSETTINGS_SCHEMA_DIR")) != NULL)
try_prepend_dir (path);
......
......@@ -2613,6 +2613,7 @@ main (int argc, char *argv[])
backend_set = g_getenv ("GSETTINGS_BACKEND") != NULL;
g_setenv ("XDG_DATA_DIRS", ".", TRUE);
g_setenv ("XDG_DATA_HOME", ".", TRUE);
g_setenv ("GSETTINGS_SCHEMA_DIR", ".", TRUE);
if (!backend_set)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment