packages feed

xfconf-4.8.0.0: System/XFCE/Xfconf/Core.chs

{-# LANGUAGE CPP, ForeignFunctionInterface #-}
-- vim:filetype=haskell:
--

-- XXX: Should we consider property names to be encoded in UTF-8 too
-- (string values are already encoded to / decoded from UTF-8).

{- | Core functionalities for libxfconf.

   There is actually only one core function : 'xfconfListChannels'.
   Access to the C functions xfconf_init() and xfconf_shutdown() are
   available in the "System.XFCE.Xfconf.Unsafe" module and should, in
   most cases, not be used in Haskell.

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


#include <xfconf/xfconf.h>

{# context lib="xfconf-0" prefix="xfconf" #}

module System.XFCE.Xfconf.Core (
                xfconfListChannels,
                ) where

import Control.Exception      (bracket_)

import System.Glib.UTFString

import System.XFCE.Xfconf.FFI
{#import System.XFCE.Xfconf.Unsafe #}

{----------------------------------------------------------------------
-- Core
----------------------------------------------------------------------}

-- | List the names of available channels.
xfconfListChannels :: IO [String]
xfconfListChannels = bracket_ xfconfInit xfconfShutdown $
        {#call unsafe xfconf_list_channels #} >>= readUTFStringArray0

-- TODO: implement xfconf_named_struct_register