Skip to content

GSettings: New schema source from path, bytes and resource

Zipdox requested to merge zipdox/glib:main into main

Allows the creation of a GSettingsSchemaSource from a file path directly, from a GBytes object and form a resource compiled with glib-compile-resources.

Adds 3 new methods:

  • g_settings_schema_source_new_from_path
  • g_settings_schema_source_new_from_bytes
  • g_settings_schema_source_new_from_resource

Why this is important:

  • Portability
    • Embedding the schema inside a program improves its portability as you don't have to worry about shipping a separate schema file.
  • Cross platform support
    • Windows and MacOS do not use XDG_DATA_DIRS and therefore it's not clear where to put schemas. This merge request omits that problem entirely.
  • Speed
    • Loading a schema from a resource is faster than loading it from a file.

Fixes: #2749 (closed) and #499

Edited by Philip Withnall

Merge request reports