Safe Haskell | None |
---|
An application-defined domain for storing configuration settings.
For more information, see: http://docs.xfce.org/api/xfconf/xfconf-xfconf-channel.html
- class GObjectClass o => XfconfChannelClass o
- data XfconfChannel
- channelGet :: String -> IO XfconfChannel
- channelNew :: String -> IO XfconfChannel
- channelNewWithPropertyBase :: String -> String -> IO XfconfChannel
- channelGetName :: XfconfChannelClass self => self -> IO String
- channelName :: XfconfChannelClass self => ReadAttr self String
- channelGetPropertyBase :: XfconfChannelClass self => self -> IO String
- channelPropertyBase :: XfconfChannelClass self => ReadAttr self String
- get :: o -> ReadWriteAttr o a b -> IO a
- onPropertyChanged :: XfconfChannelClass self => self -> (String -> Maybe XfconfValue -> IO ()) -> IO (ConnectId self)
- afterPropertyChanged :: XfconfChannelClass self => self -> (String -> Maybe XfconfValue -> IO ()) -> IO (ConnectId self)
- propertyChanged :: XfconfChannelClass self => Signal self (String -> Maybe XfconfValue -> IO ())
- channelHasProperty :: XfconfChannelClass self => self -> String -> IO Bool
- channelIsPropertyLocked :: XfconfChannelClass self => self -> String -> IO Bool
- channelResetProperty :: XfconfChannelClass self => self -> String -> Bool -> IO ()
- channelGetKeys :: XfconfChannelClass self => self -> String -> IO [String]
- channelGetAllKeys :: XfconfChannelClass self => self -> IO [String]
- channelGetStringWithDefault :: XfconfChannelClass self => self -> String -> String -> IO String
- channelGetString :: XfconfChannelClass self => self -> String -> IO String
- channelSetString :: XfconfChannelClass self => self -> String -> String -> IO Bool
- channelGetIntWithDefault :: XfconfChannelClass self => self -> String -> Int32 -> IO Int32
- channelGetInt :: XfconfChannelClass self => self -> String -> IO Int32
- channelSetInt :: XfconfChannelClass self => self -> String -> Int32 -> IO Bool
- channelGetUIntWithDefault :: XfconfChannelClass self => self -> String -> Word32 -> IO Word32
- channelGetUInt :: XfconfChannelClass self => self -> String -> IO Word32
- channelSetUInt :: XfconfChannelClass self => self -> String -> Word32 -> IO Bool
- channelGetUInt64WithDefault :: XfconfChannelClass self => self -> String -> Word64 -> IO Word64
- channelGetUInt64 :: XfconfChannelClass self => self -> String -> IO Word64
- channelSetUInt64 :: XfconfChannelClass self => self -> String -> Word64 -> IO Bool
- channelGetDoubleWithDefault :: XfconfChannelClass self => self -> String -> Double -> IO Double
- channelGetDouble :: XfconfChannelClass self => self -> String -> IO Double
- channelSetDouble :: XfconfChannelClass self => self -> String -> Double -> IO Bool
- channelGetBoolWithDefault :: XfconfChannelClass self => self -> String -> Bool -> IO Bool
- channelGetBool :: XfconfChannelClass self => self -> String -> IO Bool
- channelSetBool :: XfconfChannelClass self => self -> String -> Bool -> IO Bool
- channelGetUInt16WithDefault :: XfconfChannelClass self => self -> String -> Word16 -> IO Word16
- channelGetUInt16 :: XfconfChannelClass self => self -> String -> IO Word16
- channelSetUInt16 :: XfconfChannelClass self => self -> String -> Word16 -> IO Bool
- channelGetInt16WithDefault :: XfconfChannelClass self => self -> String -> Int16 -> IO Int16
- channelGetInt16 :: XfconfChannelClass self => self -> String -> IO Int16
- channelSetInt16 :: XfconfChannelClass self => self -> String -> Int16 -> IO Bool
- channelSetStringList :: XfconfChannelClass self => self -> String -> [String] -> IO Bool
- channelGetStringList :: XfconfChannelClass self => self -> String -> IO [String]
- channelSetArray :: (XfconfChannelClass self, XfconfValueClass a) => self -> String -> [a] -> IO Bool
- channelGetArray :: XfconfChannelClass self => self -> String -> IO [XfconfValue]
- channelGetProperty :: XfconfChannelClass self => self -> String -> IO (Maybe XfconfValue)
- channelSetProperty :: (XfconfChannelClass self, XfconfValueClass a) => self -> String -> Maybe a -> IO Bool
- channelGetAllProperties :: XfconfChannelClass self => self -> IO [(String, Maybe XfconfValue)]
- channelGetProperties :: XfconfChannelClass self => self -> String -> IO [(String, Maybe XfconfValue)]
- channelSetProperties :: (XfconfChannelClass self, XfconfValueClass a) => self -> [(String, Maybe a)] -> IO [Bool]
Detail
An XfconfChannel is a representation of a restricted domain or namespace that an application can define to store configuration settings. This is to ensure that different applications do not store configuration keys with the same names.
Example
Channel initialisation:
chan <- channelGet "demo" -- -- Clear channel channelResetProperty chan "/" True -- channelSetInt chan "/MyInt" 42 channelSetString chan "/MyString" "Hello world" channelSetStringList chan "/MyList" [ "haskell", "xfce", "xfconf", "gtk" ] channelSetProperty chan "/MyArray" (Just [1..5] :: Maybe [Int])
Which we'll give us:
>>>
channelGetAllKeys chan >>= mapM_ print
"/MyInt" "/MyString" "/MyList" "/MyArray"
>>>
channelGetAllProperties chan >>= mapM_ print
("/MyInt",Just (XfconfInt 42)) ("/MyString",Just (XfconfString "Hello world")) ("/MyList",Just (XfconfArray [XfconfString "haskell",XfconfString "xfce",XfconfString "xfconf",XfconfString "gtk"])) ("/MyArray",Just (XfconfArray [XfconfInt 1,XfconfInt 2,XfconfInt 3,XfconfInt 4,XfconfInt 5]))
Class Hierarchy
|GObject
| +-----XfconfChannel
Channel Type
data XfconfChannel Source
Constructors
:: String | channel name |
-> IO XfconfChannel |
Either creates a new Channel
, or fetches a singleton object for
channel_name. This function always returns a valid object; no
checking is done to see if the channel exists or has a valid name.
May throw a GError
, see xfconfInit
for more information.
:: String | channel |
-> IO XfconfChannel |
Creates a new channel using name
as the channel's identifier.
This function always returns a valid object; no checking is done to
see if the channel exists or has a valid name.
Note: use of this function is not recommended, in favor of
channelGet
, which returns a singleton object and saves a little
memory. However, channelNew
can be useful in some cases where you
want to tie an XfconfChannel
's lifetime (and thus the lifetime of
connected signals and bound GObject properties) to the lifetime of
another object.
May throw a GError
, see xfconfInit
for more information.
channelNewWithPropertyBaseSource
:: String | channel |
-> String | root |
-> IO XfconfChannel |
Creates a new channel using name
as the channel's identifier,
restricting the accessible properties to be rooted at property_base
.
This function always returns a valid object; no checking is done to
see if the channel exists or has a valid name.
May throw a GError
, see xfconfInit
for more information.
Attributes
The name of the channel.
channelGetName :: XfconfChannelClass self => self -> IO StringSource
channelName :: XfconfChannelClass self => ReadAttr self StringSource
Base property path.
channelGetPropertyBase :: XfconfChannelClass self => self -> IO StringSource
channelPropertyBase :: XfconfChannelClass self => ReadAttr self StringSource
re-exported from System.Glib.Attributes
get :: o -> ReadWriteAttr o a b -> IO a
Get an Attr of an object.
Signals
onPropertyChanged :: XfconfChannelClass self => self -> (String -> Maybe XfconfValue -> IO ()) -> IO (ConnectId self)Source
afterPropertyChanged :: XfconfChannelClass self => self -> (String -> Maybe XfconfValue -> IO ()) -> IO (ConnectId self)Source
propertyChanged :: XfconfChannelClass self => Signal self (String -> Maybe XfconfValue -> IO ())Source
Emitted whenever a property on channel has changed. If the change
was caused by the removal of property, value will be unset; you will
receive Nothing
instead of (Just
XfconfValue
).
Methods
Misc
channelHasProperty :: XfconfChannelClass self => self -> String -> IO BoolSource
Checks to see if property exists on channel.
channelIsPropertyLocked :: XfconfChannelClass self => self -> String -> IO BoolSource
Queries whether or not property on channel is locked by system
policy. If the property is locked, calls to setProperty
(or any of
the "set" family of functions) or resetProperty
will fail.
channelResetProperty :: XfconfChannelClass self => self -> String -> Bool -> IO ()Source
Resets properties starting at (and including) the String
property_base. If recursive is True
, will also reset all properties
that are under property_base in the property hierarchy.
A bit of an explanation as to what this function actually does: Since Xfconf backends are expected to support setting defaults via what you might call "optional schema," you can't really "remove" properties. Since the client library can't know if a channel provides default values (or even if the backend supports it!), at best it can only reset properties to their default values. To retrieve all properties in the channel, specify "/".
channelGetKeys :: XfconfChannelClass self => self -> String -> IO [String]Source
Retrieves the list of properties from Channel
. The value of the
property specified by the String
property_base and all
sub-properties are retrieved. To retrieve all properties in the
channel, specify "/".
channelGetAllKeys :: XfconfChannelClass self => self -> IO [String]Source
Alias to channelGetKeys channel "/"
Basic values get/set
The following functions are simple getters/setters for dead simple glib type (gint, gboolean, gchar*, ...). Set functions come in two flavors:
-
getTypeWidthDefault
takes a third parameter which is the default fallback value returned by xfconf if no value was found -
getType
are convenience function which returned hard-coded default values. (0 for (u)ints, floats and doubles, "" for strings, False for booleans, etc. )
Note that if you wish to "unset" a value, you should probably use
channelResetProperty
.
channelGetStringWithDefault :: XfconfChannelClass self => self -> String -> String -> IO StringSource
channelGetString :: XfconfChannelClass self => self -> String -> IO StringSource
channelSetString :: XfconfChannelClass self => self -> String -> String -> IO BoolSource
channelGetIntWithDefault :: XfconfChannelClass self => self -> String -> Int32 -> IO Int32Source
channelGetInt :: XfconfChannelClass self => self -> String -> IO Int32Source
channelSetInt :: XfconfChannelClass self => self -> String -> Int32 -> IO BoolSource
channelGetUIntWithDefault :: XfconfChannelClass self => self -> String -> Word32 -> IO Word32Source
channelGetUInt :: XfconfChannelClass self => self -> String -> IO Word32Source
channelSetUInt :: XfconfChannelClass self => self -> String -> Word32 -> IO BoolSource
channelGetUInt64WithDefault :: XfconfChannelClass self => self -> String -> Word64 -> IO Word64Source
channelGetUInt64 :: XfconfChannelClass self => self -> String -> IO Word64Source
channelSetUInt64 :: XfconfChannelClass self => self -> String -> Word64 -> IO BoolSource
channelGetDoubleWithDefault :: XfconfChannelClass self => self -> String -> Double -> IO DoubleSource
channelGetDouble :: XfconfChannelClass self => self -> String -> IO DoubleSource
channelSetDouble :: XfconfChannelClass self => self -> String -> Double -> IO BoolSource
channelGetBoolWithDefault :: XfconfChannelClass self => self -> String -> Bool -> IO BoolSource
channelGetBool :: XfconfChannelClass self => self -> String -> IO BoolSource
channelSetBool :: XfconfChannelClass self => self -> String -> Bool -> IO BoolSource
Special Xfconf value
The same remark as for the previous "basic values" applies.
channelGetUInt16WithDefault :: XfconfChannelClass self => self -> String -> Word16 -> IO Word16Source
channelGetUInt16 :: XfconfChannelClass self => self -> String -> IO Word16Source
channelSetUInt16 :: XfconfChannelClass self => self -> String -> Word16 -> IO BoolSource
channelGetInt16WithDefault :: XfconfChannelClass self => self -> String -> Int16 -> IO Int16Source
channelGetInt16 :: XfconfChannelClass self => self -> String -> IO Int16Source
channelSetInt16 :: XfconfChannelClass self => self -> String -> Int16 -> IO BoolSource
Complex values get/set
C Arrays, structures and named structures are not implemented.
(correction: you can now retrieve and store arrays, just do not play
with complex arrays -- eg. no array of arrays -- and be careful of
the difference betwwen channelSetStringList
, channelGetArray
or
channelGetProperty
).
channelSetStringList :: XfconfChannelClass self => self -> String -> [String] -> IO BoolSource
Handles [] empty string lists by resetting the value with
channelResetProperty
channelGetStringList :: XfconfChannelClass self => self -> String -> IO [String]Source
channelSetArray :: (XfconfChannelClass self, XfconfValueClass a) => self -> String -> [a] -> IO BoolSource
channelGetArray :: XfconfChannelClass self => self -> String -> IO [XfconfValue]Source
channelGetProperty :: XfconfChannelClass self => self -> String -> IO (Maybe XfconfValue)Source
Generic function for retrieving XfconfValue
s. As for
channelGetProperties
, only work with the limited set of simple
types supported by System.XFCE.Xfconf.Values.
channelSetProperty :: (XfconfChannelClass self, XfconfValueClass a) => self -> String -> Maybe a -> IO BoolSource
Generic function for storing XfconfValue
s. As for
channelGetProperties
, only work with the limited set of simple
types supported by System.XFCE.Xfconf.Values.
Reset property and return True if Maybe XfconfValue
is Nothing
or
throw an error if the value is an instance of Just
(
.
XfconfNotImplemented
t)
channelGetAllProperties :: XfconfChannelClass self => self -> IO [(String, Maybe XfconfValue)]Source
Alias to channelGetProperties channel "/"
channelGetProperties :: XfconfChannelClass self => self -> String -> IO [(String, Maybe XfconfValue)]Source
A convenience function returning an association list [(key,
value)]. Work only for the data types defined in
System.XFCE.Xfconf.Values (i.e. no (named) structures).
See also the limitation imposed by gHashTableLookup
. The value of
the property specified by the String
property_base and all
sub-properties are retrieved. To retrieve all properties in the
channel, specify "/".
channelSetProperties :: (XfconfChannelClass self, XfconfValueClass a) => self -> [(String, Maybe a)] -> IO [Bool]Source
A convenience function equivalent to
mapM ((k,v) -> channelSetProperty channel k v) properties