gi-gio-2.0.35: Gio bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | Safe-Inferred
Language | Haskell2010

GI.Gio.Structs.SettingsSchemaSource

Contents

- Exported types
- Methods
  - getDefault
  - listSchemas
  - lookup
  - newFromDirectory
  - ref
  - unref

Description

This is an opaque structure type. You may not access it directly.

Since: 2.32

Synopsis

- newtype SettingsSchemaSource = SettingsSchemaSource (ManagedPtr SettingsSchemaSource)
- settingsSchemaSourceGetDefault :: (HasCallStack, MonadIO m) => m (Maybe SettingsSchemaSource)
- settingsSchemaSourceListSchemas :: (HasCallStack, MonadIO m) => SettingsSchemaSource -> Bool -> m ([Text], [Text])
- settingsSchemaSourceLookup :: (HasCallStack, MonadIO m) => SettingsSchemaSource -> Text -> Bool -> m (Maybe SettingsSchema)
- settingsSchemaSourceNewFromDirectory :: (HasCallStack, MonadIO m) => [Char] -> Maybe SettingsSchemaSource -> Bool -> m SettingsSchemaSource
- settingsSchemaSourceRef :: (HasCallStack, MonadIO m) => SettingsSchemaSource -> m SettingsSchemaSource
- settingsSchemaSourceUnref :: (HasCallStack, MonadIO m) => SettingsSchemaSource -> m ()

# Exported types

newtype SettingsSchemaSource Source #

Memory-managed wrapper type.

Constructors

SettingsSchemaSource (ManagedPtr SettingsSchemaSource) |

#### Instances

Instances details

Eq SettingsSchemaSource Source # |
Instance details Defined in GI.Gio.Structs.SettingsSchemaSource Methods (==) :: SettingsSchemaSource -> SettingsSchemaSource -> Bool Source # (/=) :: SettingsSchemaSource -> SettingsSchemaSource -> Bool Source #
GBoxed SettingsSchemaSource Source # |
Instance details Defined in GI.Gio.Structs.SettingsSchemaSource
ManagedPtrNewtype SettingsSchemaSource Source # |
Instance details Defined in GI.Gio.Structs.SettingsSchemaSource Methods toManagedPtr :: SettingsSchemaSource -> ManagedPtr SettingsSchemaSource Source #
TypedObject SettingsSchemaSource Source # |
Instance details Defined in GI.Gio.Structs.SettingsSchemaSource Methods glibType :: IO GType Source #
HasParentTypes SettingsSchemaSource Source # |
Instance details Defined in GI.Gio.Structs.SettingsSchemaSource
IsGValue (Maybe SettingsSchemaSource) Source # | Convert `SettingsSchemaSource` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gio.Structs.SettingsSchemaSource Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe SettingsSchemaSource -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe SettingsSchemaSource) Source #
type ParentTypes SettingsSchemaSource Source # |
Instance details Defined in GI.Gio.Structs.SettingsSchemaSource type ParentTypes SettingsSchemaSource = '[] :: [Type]

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

listSchemas, lookup, ref, unref.

#### Getters

None.

#### Setters

None.

## getDefault

settingsSchemaSourceGetDefault Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m (Maybe SettingsSchemaSource) | Returns: the default schema source

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, `Nothing` 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.

Since: 2.32

## listSchemas

settingsSchemaSourceListSchemas Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> SettingsSchemaSource | `source`: a `SettingsSchemaSource`
-> Bool | `recursive`: if we should recurse
-> m ([Text], [Text]) |

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 `settingsNew`. Relocatable schemas are those for which you must use `settingsNewWithPath`.

Do not call this function from normal programs. This is designed for use by database editors, commandline tools, etc.

Since: 2.40

## lookup

settingsSchemaSourceLookup Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> SettingsSchemaSource | `source`: a `SettingsSchemaSource`
-> Text | `schemaId`: a schema ID
-> Bool | `recursive`: `True` if the lookup should be recursive
-> m (Maybe SettingsSchema) | Returns: a new `SettingsSchema`

Looks up a schema with the identifier `schemaId` in `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 the schema isn't found directly in `source` and `recursive` is `True` then the parent sources will also be checked.

If the schema isn't found, `Nothing` is returned.

Since: 2.32

## newFromDirectory

settingsSchemaSourceNewFromDirectory Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> [Char] | `directory`: the filename of a directory
-> Maybe SettingsSchemaSource | `parent`: a `SettingsSchemaSource`, or `Nothing`
-> Bool | `trusted`: `True`, if the directory is trusted
-> m SettingsSchemaSource | (Can throw `GError`)

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 `FileErrorInval` being returned.

If `parent` is non-`Nothing` then there are two effects.

First, if `settingsSchemaSourceLookup` 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 `settingsSchemaSourceGetDefault`.

Since: 2.32

## ref

settingsSchemaSourceRef Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> SettingsSchemaSource | `source`: a `SettingsSchemaSource`
-> m SettingsSchemaSource | Returns: a new reference to `source`

Increase the reference count of `source`, returning a new reference.

Since: 2.32

## unref

settingsSchemaSourceUnref Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> SettingsSchemaSource | `source`: a `SettingsSchemaSource`
-> m () |

Decrease the reference count of `source`, possibly freeing it.

Since: 2.32