Struct gio::SettingsSchemaSource
source · pub struct SettingsSchemaSource { /* private fields */ }
Expand description
This is an opaque structure type. You may not access it directly.
Implementations§
source§impl SettingsSchemaSource
impl SettingsSchemaSource
sourcepub fn as_ptr(&self) -> *mut GSettingsSchemaSource
pub fn as_ptr(&self) -> *mut GSettingsSchemaSource
Return the inner pointer to the underlying C value.
sourcepub unsafe fn from_glib_ptr_borrow<'a>(
ptr: *const *const GSettingsSchemaSource
) -> &'a Self
pub unsafe fn from_glib_ptr_borrow<'a>( ptr: *const *const GSettingsSchemaSource ) -> &'a Self
Borrows the underlying C value.
source§impl SettingsSchemaSource
impl SettingsSchemaSource
sourcepub fn from_directory(
directory: impl AsRef<Path>,
parent: Option<&SettingsSchemaSource>,
trusted: bool
) -> Result<SettingsSchemaSource, Error>
pub fn from_directory( directory: impl AsRef<Path>, parent: Option<&SettingsSchemaSource>, trusted: bool ) -> Result<SettingsSchemaSource, Error>
Attempts to create a new schema source corresponding to the contents of the given directory.
This function is not required for normal uses of Settings
but it
may be useful to authors of plugin management systems.
The directory should contain a file called gschemas.compiled
as
produced by the [glib-compile-schemas][glib-compile-schemas] tool.
If trusted
is true
then gschemas.compiled
is 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 set trusted
to true
for files installed by the
system and to false
for files in the home directory.
In either case, an empty file or some types of corruption in the file will
result in G_FILE_ERROR_INVAL
being returned.
If parent
is non-None
then there are two effects.
First, if lookup()
is called with the
recursive
flag set to true
and 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: child
or extends
) references may be resolved
from the parent
.
For this second reason, except in very unusual situations, the
parent
should probably be given as the default schema source, as
returned by default()
.
directory
the filename of a directory
parent
a SettingsSchemaSource
, or None
trusted
true
, if the directory is trusted
sourcepub fn list_schemas(&self, recursive: bool) -> (Vec<GString>, Vec<GString>)
pub fn list_schemas(&self, recursive: bool) -> (Vec<GString>, Vec<GString>)
Lists the schemas in a given source.
If recursive
is true
then include parent sources. If false
then
only include the schemas from one source (ie: one directory). You
probably want true
.
Non-relocatable schemas are those for which you can call
Settings::new()
. Relocatable schemas are those for which you must
use Settings::with_path()
.
Do not call this function from normal programs. This is designed for use by database editors, commandline tools, etc.
recursive
if we should recurse
Returns
non_relocatable
the list of non-relocatable schemas, in no defined order
relocatable
the list of relocatable schemas, in no defined order
sourcepub fn lookup(&self, schema_id: &str, recursive: bool) -> Option<SettingsSchema>
pub fn lookup(&self, schema_id: &str, recursive: bool) -> Option<SettingsSchema>
Looks up a schema with the identifier schema_id
in self
.
This function is not required for normal uses of Settings
but 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 self
and recursive
is true
then the parent sources will also be checked.
If the schema isn’t found, None
is returned.
schema_id
a schema ID
recursive
true
if the lookup should be recursive
Returns
a new SettingsSchema
sourcepub fn default() -> Option<SettingsSchemaSource>
pub fn default() -> Option<SettingsSchemaSource>
Gets the default system schema source.
This function is not required for normal uses of Settings
but 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, None
will be returned.
The returned source may actually consist of multiple schema sources
from different directories, depending on which directories were given
in XDG_DATA_DIRS
and GSETTINGS_SCHEMA_DIR
. For this reason, all
lookups performed against the default source should probably be done
recursively.
Returns
the default schema source
Trait Implementations§
source§impl Clone for SettingsSchemaSource
impl Clone for SettingsSchemaSource
source§impl Debug for SettingsSchemaSource
impl Debug for SettingsSchemaSource
source§impl From<SettingsSchemaSource> for Value
impl From<SettingsSchemaSource> for Value
source§fn from(s: SettingsSchemaSource) -> Self
fn from(s: SettingsSchemaSource) -> Self
source§impl HasParamSpec for SettingsSchemaSource
impl HasParamSpec for SettingsSchemaSource
type ParamSpec = ParamSpecBoxed
§type SetValue = SettingsSchemaSource
type SetValue = SettingsSchemaSource
type BuilderFn = fn(_: &str) -> ParamSpecBoxedBuilder<'_, SettingsSchemaSource>
fn param_spec_builder() -> Self::BuilderFn
source§impl Hash for SettingsSchemaSource
impl Hash for SettingsSchemaSource
source§impl Ord for SettingsSchemaSource
impl Ord for SettingsSchemaSource
source§fn cmp(&self, other: &SettingsSchemaSource) -> Ordering
fn cmp(&self, other: &SettingsSchemaSource) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for SettingsSchemaSource
impl PartialEq for SettingsSchemaSource
source§fn eq(&self, other: &SettingsSchemaSource) -> bool
fn eq(&self, other: &SettingsSchemaSource) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for SettingsSchemaSource
impl PartialOrd for SettingsSchemaSource
source§fn partial_cmp(&self, other: &SettingsSchemaSource) -> Option<Ordering>
fn partial_cmp(&self, other: &SettingsSchemaSource) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StaticType for SettingsSchemaSource
impl StaticType for SettingsSchemaSource
source§fn static_type() -> Type
fn static_type() -> Type
Self
.