| Gtk2Hs | Contents | Index

System.Gnome.GConf.GConfClient

Contents

Data types
Creation operation
Registering for change notifications
Getting and setting configuration values
Caching control
Navigation
GConfValue

Description

GConf is a system for maintaining program configuration information.

The main difference between GConf and traditional configuration file API's is that GConf is 'live'. Applications can be notified of changes in their configuration, it allows desktop wide setting to be propogated without restarting all applications, or multiple instances of a single application to synchronise their configuration. It is similar in many ways to the Win32 Registry with its directory-like structure.

This module only binds the client library which is the only interface that normal applications should need. Only special GConf apps need lower level access.

- Some low level functions have not been bound eg `gconf_client_get_for_engine`

Synopsis

data GConf
data GConfPreloadType
data GConfError
gconfGetDefault :: IO GConf
gconfAddDir :: GConf -> String -> IO ()
gconfRemoveDir :: GConf -> String -> IO ()
gconfNotifyAdd :: GConfValueClass value => GConf -> String -> (String -> value -> IO ()) -> IO GConfConnectId
gconfNotifyRemove :: GConf -> GConfConnectId -> IO ()
onValueChanged :: GConf -> (String -> Maybe GConfValueDyn -> IO ()) -> IO (ConnectId GConf)
afterValueChanged :: GConf -> (String -> Maybe GConfValueDyn -> IO ()) -> IO (ConnectId GConf)
gconfGet :: GConfValueClass value => GConf -> String -> IO value
gconfSet :: GConfValueClass value => GConf -> String -> value -> IO ()
gconfGetWithoutDefault :: GConfValueClass value => GConf -> String -> IO value
gconfGetDefaultFromSchema :: GConfValueClass value => GConf -> String -> IO value
gconfUnset :: GConf -> String -> IO ()
gconfClearCache :: GConf -> IO ()
gconfPreload :: GConf -> String -> GConfPreloadType -> IO ()
gconfSuggestSync :: GConf -> IO ()
gconfAllEntries :: GConf -> String -> IO [(String, GConfValueDyn)]
gconfAllDirs :: GConf -> String -> IO [String]
gconfDirExists :: GConf -> String -> IO Bool
class GConfValueClass value
class GConfValueClass value => GConfPrimitiveValueClass value
data GConfValue

data GConfValueDyn

= GConfValueString String
| GConfValueInt Int
| GConfValueFloat Double
| GConfValueBool Bool
| GConfValueSchema
| GConfValueList [GConfValueDyn]
| GConfValuePair (GConfValueDyn, GConfValueDyn)

Data types
data GConf

Instances

GObjectClass GConf
GConfClass GConf

data GConfPreloadType

Instances

Enum GConfPreloadType

data GConfError

The GError exceptions that can be thrown by functions in this module
Instances

Enum GConfError
GErrorClass GConfError

Creation operation
gconfGetDefault :: IO GConf
Create a new GConf object using the default configuration engine.
Registering for change notifications
gconfAddDir :: GConf -> String -> IO ()

Add a directory to the list of directories the GConf will watch. You should use gconfNotifyAdd to associate change handlers with specific keys.

- Added directories may not overlap. That is, if you add "/foo", you may not add "/foo/bar". However you can add "/foo" and "/bar". You can also add "/foo" multiple times; if you add a directory multiple times, it will not be removed until you call `gconfRemoveDir` an equal number of times.
- Note that the watch is recursive, all keys below the given directory will be watched. So it would be a bad idea to watch the root "/".

gconfRemoveDir :: GConf -> String -> IO ()

Remove a directory from the list created with `gconfAddDir`. If any notifications have been added below this directory with `gconfNotifyAdd`, those notifications will be disabled until you re-add the removed directory.

- Note that if a directory has been added multiple times, you must remove it the same number of times before the remove takes effect.

gconfNotifyAdd :: GConfValueClass value => GConf -> String -> (String -> value -> IO ()) -> IO GConfConnectId
gconfNotifyRemove :: GConf -> GConfConnectId -> IO ()
onValueChanged :: GConf -> (String -> Maybe GConfValueDyn -> IO ()) -> IO (ConnectId GConf)
afterValueChanged :: GConf -> (String -> Maybe GConfValueDyn -> IO ()) -> IO (ConnectId GConf)
Getting and setting configuration values
gconfGet

:: GConfValueClass value |
=> GConf |
-> String | Name of the key
-> IO value |
Gets the value of a configuration key.

gconfSet

:: GConfValueClass value |
=> GConf |
-> String | Name of the key
-> value | New value
-> IO () |
Sets the value of a configuration key.

gconfGetWithoutDefault :: GConfValueClass value => GConf -> String -> IO value
Gets the value of a configuration key. Same as `gconfGet`, but doesn't look for a default value if the key is unset.
gconfGetDefaultFromSchema :: GConfValueClass value => GConf -> String -> IO value
Returns the default value stored in the key's schema, if the key has a schema associated and the schema exists and the schema contains a default value. Note that `gconfSet` already returns the default value if no other value is found, so normally you do not need this function.
gconfUnset :: GConf -> String -> IO ()
Unsets the value of key; if key is already unset, has no effect. An error of note is `GconfErrorOverridden`, indicating that the system administrator has "forced" a value for this key.
Caching control
gconfClearCache :: GConf -> IO ()
Dumps everything out of the GConf client-side cache. If you know you're done using the GConf for a while, you can call this function to save some memory.
gconfPreload :: GConf -> String -> GConfPreloadType -> IO ()
Preloads a directory. Normally you do this when you call `gconfAddDirWithPreload`, but if you've called `gconfClearCache` there may be a reason to do it again.
gconfSuggestSync :: GConf -> IO ()
Suggests to gconfd that you've just finished a block of changes, and it would be an optimal time to sync to permanent storage. This is only a suggestion; and gconfd will eventually sync even if you don't call `gconfSuggestSync`. This function is just a hint provided to gconfd to maximize efficiency and minimize data loss.
Navigation
gconfAllEntries :: GConf -> String -> IO [(String, GConfValueDyn)]
gconfAllDirs :: GConf -> String -> IO [String]
gconfDirExists :: GConf -> String -> IO Bool
GConfValue
class GConfValueClass value

Class of types which can be kept by GConf
Instances

GConfValueClass Bool
GConfValueClass Double
GConfValueClass Int
GConfValueClass String
GConfValueClass GConfValueDyn
GConfPrimitiveValueClass a => GConfValueClass ([] a)
GConfValueClass value => GConfValueClass (Maybe value)
(GConfPrimitiveValueClass a, GConfPrimitiveValueClass b) => GConfValueClass ((,) a b)

class GConfValueClass value => GConfPrimitiveValueClass value

Instances

GConfPrimitiveValueClass Bool
GConfPrimitiveValueClass Double
GConfPrimitiveValueClass Int
GConfPrimitiveValueClass String

data GConfValue
data GConfValueDyn

Dynamic version for when the type is not known statically.
Constructors

GConfValueString String |
GConfValueInt Int |
GConfValueFloat Double |
GConfValueBool Bool |
GConfValueSchema | Not supported
GConfValueList [GConfValueDyn] | Must all be of same primitive type
GConfValuePair (GConfValueDyn, GConfValueDyn) | Must both be primitive

Instances

GConfValueClass GConfValueDyn

Produced by Haddock version 2.4.2