gi-gio-2.0.30: Gio bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gio.Objects.SettingsBackend

Description

The SettingsBackend interface defines a generic interface for non-strictly-typed data that is stored in a hierarchy. To implement an alternative storage backend for Settings, you need to implement the SettingsBackend interface and then make it implement the extension point SETTINGS_BACKEND_EXTENSION_POINT_NAME.

The interface defines methods for reading and writing values, a method for determining if writing of certain values will fail (lockdown) and a change notification mechanism.

The semantics of the interface are very precisely defined and implementations must carefully adhere to the expectations of callers that are documented on each of the interface methods.

Some of the SettingsBackend functions accept or return a Tree. These trees always have strings as keys and GVariant as values. g_settings_backend_create_tree() is a convenience function to create suitable trees.

The SettingsBackend API is exported to allow third-party implementations, but does not carry the same stability guarantees as the public GIO API. For this reason, you have to define the C preprocessor symbol G_SETTINGS_ENABLE_BACKEND before including gio/gsettingsbackend.h.

Synopsis

Exported types

newtype SettingsBackend Source #

Memory-managed wrapper type.

Constructors

SettingsBackend (ManagedPtr SettingsBackend) 

Instances

Instances details
Eq SettingsBackend Source # 
Instance details

Defined in GI.Gio.Objects.SettingsBackend

GObject SettingsBackend Source # 
Instance details

Defined in GI.Gio.Objects.SettingsBackend

ManagedPtrNewtype SettingsBackend Source # 
Instance details

Defined in GI.Gio.Objects.SettingsBackend

TypedObject SettingsBackend Source # 
Instance details

Defined in GI.Gio.Objects.SettingsBackend

Methods

glibType :: IO GType

HasParentTypes SettingsBackend Source # 
Instance details

Defined in GI.Gio.Objects.SettingsBackend

IsGValue (Maybe SettingsBackend) Source #

Convert SettingsBackend to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gio.Objects.SettingsBackend

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe SettingsBackend -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe SettingsBackend)

type ParentTypes SettingsBackend Source # 
Instance details

Defined in GI.Gio.Objects.SettingsBackend

type ParentTypes SettingsBackend = '[Object]

class (GObject o, IsDescendantOf SettingsBackend o) => IsSettingsBackend o Source #

Type class for types which can be safely cast to SettingsBackend, for instance with toSettingsBackend.

Instances

Instances details
(GObject o, IsDescendantOf SettingsBackend o) => IsSettingsBackend o Source # 
Instance details

Defined in GI.Gio.Objects.SettingsBackend

toSettingsBackend :: (MonadIO m, IsSettingsBackend o) => o -> m SettingsBackend Source #

Cast to SettingsBackend, for types for which this is known to be safe. For general casts, use castTo.

Methods

changed

settingsBackendChanged Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingsBackend a) 
=> a

backend: a SettingsBackend implementation

-> Text

key: the name of the key

-> Ptr ()

originTag: the origin tag

-> m () 

Signals that a single key has possibly changed. Backend implementations should call this if a key has possibly changed its value.

key must be a valid key (ie starting with a slash, not containing '//', and not ending with a slash).

The implementation must call this function during any call to g_settings_backend_write(), before the call returns (except in the case that no keys are actually changed and it cares to detect this fact). It may not rely on the existence of a mainloop for dispatching the signal later.

The implementation may call this function at any other time it likes in response to other events (such as changes occurring outside of the program). These calls may originate from a mainloop or may originate in response to any other action (including from calls to g_settings_backend_write()).

In the case that this call is in response to a call to g_settings_backend_write() then originTag must be set to the same value that was passed to that call.

Since: 2.26

changedTree

settingsBackendChangedTree Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingsBackend a) 
=> a

backend: a SettingsBackend implementation

-> Tree

tree: a Tree containing the changes

-> Ptr ()

originTag: the origin tag

-> m () 

This call is a convenience wrapper. It gets the list of changes from tree, computes the longest common prefix and calls settingsBackendChanged.

Since: 2.26

getDefault

settingsBackendGetDefault Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m SettingsBackend

Returns: the default SettingsBackend, which will be a dummy (memory) settings backend if no other settings backend is available.

Returns the default SettingsBackend. It is possible to override the default by setting the GSETTINGS_BACKEND environment variable to the name of a settings backend.

The user gets a reference to the backend.

Since: 2.28

keysChanged

settingsBackendKeysChanged Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingsBackend a) 
=> a

backend: a SettingsBackend implementation

-> Text

path: the path containing the changes

-> [Text]

items: the Nothing-terminated list of changed keys

-> Ptr ()

originTag: the origin tag

-> m () 

Signals that a list of keys have possibly changed. Backend implementations should call this if keys have possibly changed their values.

path must be a valid path (ie starting and ending with a slash and not containing '//'). Each string in items must form a valid key name when path is prefixed to it (ie: each item must not start or end with '/' and must not contain '//').

The meaning of this signal is that any of the key names resulting from the contatenation of path with each item in items may have changed.

The same rules for when notifications must occur apply as per settingsBackendChanged. These two calls can be used interchangeably if exactly one item has changed (although in that case settingsBackendChanged is definitely preferred).

For efficiency reasons, the implementation should strive for path to be as long as possible (ie: the longest common prefix of all of the keys that were changed) but this is not strictly required.

Since: 2.26

pathChanged

settingsBackendPathChanged Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingsBackend a) 
=> a

backend: a SettingsBackend implementation

-> Text

path: the path containing the changes

-> Ptr ()

originTag: the origin tag

-> m () 

Signals that all keys below a given path may have possibly changed. Backend implementations should call this if an entire path of keys have possibly changed their values.

path must be a valid path (ie starting and ending with a slash and not containing '//').

The meaning of this signal is that any of the key which has a name starting with path may have changed.

The same rules for when notifications must occur apply as per settingsBackendChanged. This call might be an appropriate reasponse to a 'reset' call but implementations are also free to explicitly list the keys that were affected by that call if they can easily do so.

For efficiency reasons, the implementation should strive for path to be as long as possible (ie: the longest common prefix of all of the keys that were changed) but this is not strictly required. As an example, if this function is called with the path of "/" then every single key in the application will be notified of a possible change.

Since: 2.26

pathWritableChanged

settingsBackendPathWritableChanged Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingsBackend a) 
=> a

backend: a SettingsBackend implementation

-> Text

path: the name of the path

-> m () 

Signals that the writability of all keys below a given path may have changed.

Since GSettings performs no locking operations for itself, this call will always be made in response to external events.

Since: 2.26

writableChanged

settingsBackendWritableChanged Source #

Arguments

:: (HasCallStack, MonadIO m, IsSettingsBackend a) 
=> a

backend: a SettingsBackend implementation

-> Text

key: the name of the key

-> m () 

Signals that the writability of a single key has possibly changed.

Since GSettings performs no locking operations for itself, this call will always be made in response to external events.

Since: 2.26