xfconf-4.8.0.0: FFI bindings to xfconf

Safe HaskellNone

System.XFCE.Xfconf.GHashTable

Contents

Description

A limited binding to glib GHashTable structures. We only handle hash tables as returned by xfconf_channel_get_properties. They have gchar * keys and GValue * values.

Objectives:

  • get back the list of keys when keys are strings
  • extract values

Synopsis

Private data type

data GHashTable Source

Haskell representation of a C GHashTable* with gchar * keys and GValue* values. Memory management is automatically managed by a special Haskell finalizer calling g_hash_table_destroy.

Marshalling functions

mkGHashTable :: Ptr GHashTable -> IO GHashTableSource

Marshal out a raw C GHashTable* by wrapping it in the Haskell type GHashTable and adding it a finalizer (which calls g_hash_table_destroy).

Should be called for every function returning a GHashTable*, see for example in System.XFCE.Xfconf.Channel.chs:

        {#fun unsafe get_properties as ^
                { channelPtr `Channel' -- ^ channel pointer
                , withUTFString* `String'  -- ^ property base
                } -> `GHashTable' mkGHashTable* #}

Query functions

gHashTableKeys :: GHashTable -> IO [String]Source

Retrieves every key inside a GHashTable. The returned data is valid until the table is modified.

gHashTableLookup :: GHashTable -> String -> IO (Maybe GValue)Source

Looks up a key in a GHashTable. Note that this function cannot distinguish between a key that is not present and one which is present and has the value Nothing.