Class SettingsSchemaSource
- All Implemented Interfaces:
Proxy
- Since:
- 2.32
-
Constructor Summary
ConstructorsConstructorDescriptionSettingsSchemaSource(MemorySegment address) Create a SettingsSchemaSource proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionstatic SettingsSchemaSourcefromDirectory(String directory, @Nullable SettingsSchemaSource parent, boolean trusted) Attempts to create a new schema source corresponding to the contents of the given directory.static @Nullable SettingsSchemaSourceGets the default system schema source.static @Nullable TypegetType()Get the GType of the SettingsSchemaSource classvoidlistSchemas(boolean recursive, @Nullable Out<String[]> nonRelocatable, @Nullable Out<String[]> relocatable) Lists the schemas in a given source.@Nullable SettingsSchemaLooks up a schema with the identifierschemaIdinsource.ref()Increase the reference count ofsource,returning a new reference.voidunref()Decrease the reference count ofsource,possibly freeing it.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
SettingsSchemaSource
Create a SettingsSchemaSource proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
-
Method Details
-
getType
Get the GType of the SettingsSchemaSource class- Returns:
- the GType
-
fromDirectory
public static SettingsSchemaSource fromDirectory(String directory, @Nullable SettingsSchemaSource parent, boolean trusted) throws GErrorException Attempts to create a new schema source corresponding to the contents of the given directory.This function is not required for normal uses of
GSettingsbut it may be useful to authors of plugin management systems.The directory should contain a file called
gschemas.compiledas produced by the [glib-compile-schemas][glib-compile-schemas] tool.If
trustedistruethengschemas.compiledis trusted not to be corrupted. This assumption has a performance advantage, but can result in crashes or inconsistent behaviour in the case of a corrupted file. Generally, you should settrustedtotruefor files installed by the system and tofalsefor files in the home directory.In either case, an empty file or some types of corruption in the file will result in
FileError.INVALbeing returned.If
parentis non-nullthen there are two effects.First, if g_settings_schema_source_lookup() is called with the
recursiveflag set totrueand the schema can not be found in the source, the lookup will recurse to the parent.Second, any references to other schemas specified within this source (ie:
childorextends) references may be resolved from theparent.For this second reason, except in very unusual situations, the
parentshould probably be given as the default schema source, as returned by g_settings_schema_source_get_default().- Parameters:
directory- the filename of a directoryparent- aGSettingsSchemaSource, ornulltrusted-true, if the directory is trusted- Throws:
GErrorException- seeGError- Since:
- 2.32
-
getDefault
Gets the default system schema source.This function is not required for normal uses of
GSettingsbut it may be useful to authors of plugin management systems or to those who want to introspect the content of schemas.If no schemas are installed,
nullwill be returned.The returned source may actually consist of multiple schema sources from different directories, depending on which directories were given in
XDG_DATA_DIRSandGSETTINGS_SCHEMA_DIR. For this reason, all lookups performed against the default source should probably be done recursively.- Returns:
- the default schema source
- Since:
- 2.32
-
listSchemas
public void listSchemas(boolean recursive, @Nullable Out<String[]> nonRelocatable, @Nullable Out<String[]> relocatable) Lists the schemas in a given source.If
recursiveistruethen include parent sources. Iffalsethen only include the schemas from one source (ie: one directory). You probably wanttrue.Non-relocatable schemas are those for which you can call g_settings_new(). Relocatable schemas are those for which you must use g_settings_new_with_path().
Do not call this function from normal programs. This is designed for use by database editors, commandline tools, etc.
- Parameters:
recursive- if we should recursenonRelocatable- the list of non-relocatable schemas, in no defined orderrelocatable- the list of relocatable schemas, in no defined order- Since:
- 2.40
-
lookup
Looks up a schema with the identifierschemaIdinsource.This function is not required for normal uses of
GSettingsbut it may be useful to authors of plugin management systems or to those who want to introspect the content of schemas.If the schema isn't found directly in this SettingsSchemaSource and
recursiveistruethen the parent sources will also be checked.If the schema isn't found,
nullis returned.- Parameters:
schemaId- a schema IDrecursive-trueif the lookup should be recursive- Returns:
- a new
GSettingsSchema - Since:
- 2.32
-
ref
Increase the reference count ofsource,returning a new reference.- Returns:
- a new reference to this SettingsSchemaSource
- Since:
- 2.32
-
unref
public void unref()Decrease the reference count ofsource,possibly freeing it.- Since:
- 2.32
-