xfconf-4.8.0.0: FFI bindings to xfconf

Safe HaskellNone

System.XFCE.Xfconf.Channel

Contents

Description

An application-defined domain for storing configuration settings.

For more information, see: http://docs.xfce.org/api/xfconf/xfconf-xfconf-channel.html

Synopsis

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

Constructors

channelGetSource

Arguments

:: 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.

channelNewSource

Arguments

:: String

channel name

-> 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

Arguments

:: String

channel name

-> String

root property_base

-> 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.

Base property path.

re-exported from System.Glib.Attributes

get :: o -> ReadWriteAttr o a b -> IO a

Get an Attr of an object.

Signals

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.

Special Xfconf value

The same remark as for the previous "basic values" applies.

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

channelGetProperty :: XfconfChannelClass self => self -> String -> IO (Maybe XfconfValue)Source

Generic function for retrieving XfconfValues. 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 XfconfValues. 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