···3 * where GSettings system could look for schemas, we need to point the software to a correct location somehow.
4 * For executables, we handle this using wrappers but this is not an option for libraries like e-d-s.
5 * Instead, we hardcode the schema path when creating the settings.
0006 */
78@initialize:python@
9@@
01011cpp_constants = {}
12···16def resolve_cpp_constant(const_name):
17 return cpp_constants.get(const_name, const_name)
1819-e_s_d_schema_constants = [
20- # The following are actually part of e-d-s, despite the name.
21- # We rename the old ambiguos constant name in ./prepare-for-gsettings-patching.patch
22- "\"org.gnome.Evolution.DefaultSources\"",
23- "\"org.gnome.evolution.shell.network-config\"",
24-]
25-26-g_d_s_schema_constants = [
27-]
2829def get_schema_directory(schema_path):
30 # Sometimes the schema id is referenced using C preprocessor #define constant in the same file
31 # let’s try to resolve it first.
32- schema_path = resolve_cpp_constant(schema_path.strip())
33- if schema_path.startswith("\"org.gnome.evolution-data-server") or schema_path in e_s_d_schema_constants:
34- return "\"@EDS_GSETTINGS_PATH@\""
35- elif schema_path in g_d_s_schema_constants:
36- return "\"@GDS_GSETTINGS_PATH@\""
37- raise Exception(f"Unknown schema path {schema_path}")
383940@find_cpp_constants@
···3 * where GSettings system could look for schemas, we need to point the software to a correct location somehow.
4 * For executables, we handle this using wrappers but this is not an option for libraries like e-d-s.
5 * Instead, we hardcode the schema path when creating the settings.
6+ * A schema path (ie org.gnome.evolution) can be replaced by @EVOLUTION_SCHEMA_PATH@
7+ * which is then replaced at build time by substituteAll.
8+ * The mapping is provided in a json file ./glib-schema-to-var.json
9 */
1011@initialize:python@
12@@
13+import json
1415cpp_constants = {}
16···20def resolve_cpp_constant(const_name):
21 return cpp_constants.get(const_name, const_name)
2223+with open("./glib-schema-to-var.json") as mapping_file:
24+ schema_to_var = json.load(mapping_file);
00000002526def get_schema_directory(schema_path):
27 # Sometimes the schema id is referenced using C preprocessor #define constant in the same file
28 # let’s try to resolve it first.
29+ schema_path = resolve_cpp_constant(schema_path.strip()).strip('"')
30+ if schema_path in schema_to_var:
31+ return f'"@{schema_to_var[schema_path]}@"'
32+ raise Exception(f"Unknown schema path {schema_path!r}, please add it to ./glib-schema-to-var.json")
00333435@find_cpp_constants@