Commit da84d4ff authored by Luca Bruno's avatar Luca Bruno Committed by Jeremy Bicha

Search for GSettings schemas in system data dirs

XDG Base Directory Specification requires that all directories in XDG_DATA_DIRS environment variable are checked. This patch modifies the GSettings schema loader to respect the spec. Closes: #114
parent 878b4c0d
......@@ -22,10 +22,15 @@ class GSettingsMissingError(Exception):
class _GSettingsSchema:
def __init__(self, schema_name, schema_dir=None, schema_filename=None, **options):
if not schema_dir:
schema_dir = gtweak.GSETTINGS_SCHEMA_DIR
if not schema_filename:
schema_filename = schema_name + ".gschema.xml"
if not schema_dir:
schema_dir = gtweak.GSETTINGS_SCHEMA_DIR
for xdg_dir in GLib.get_system_data_dirs():
dir = os.path.join(xdg_dir, "glib-2.0", "schemas")
if os.path.exists(os.path.join(dir, schema_filename)):
schema_dir = dir
break
schema_path = os.path.join(schema_dir, schema_filename)
if not os.path.exists(schema_path):
......
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