   sourceLanguageManagerGetSearchPath,
   sourceLanguageManagerGetLanguageIds,
   sourceLanguageManagerGetLanguage,
-  sourceLanguageManagerGuessLanguage
+  sourceLanguageManagerGuessLanguage,
+
+-- * Attributes
+  sourceLanguageManagerLanguageIds,
+  sourceLanguageManagerSearchPath,
   ) where
 
 import Control.Monad	(liftM)

-- -*-haskell-*-
--  GIMP Toolkit (GTK) Widget SourceView
--
--  Author : Peter Gavin
--  derived from sourceview bindings by Axel Simon and Duncan Coutts
--
--  Created: 18 December 2008
--
--  Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon
--
--  This library is free software; you can redistribute it and/or
--  modify it under the terms of the GNU Lesser General Public


{# enum SourceSmartHomeEndType {underscoreToCase} deriving (Eq, Bounded, Show, Read) #}

-- | Creates a new language manager. If you do not need more than one language manager or a private
-- language manager instance then use 'sourceLanguageManagerGetDefault' instead.
--
sourceLanguageManagerNew :: IO SourceLanguageManager
sourceLanguageManagerNew = constructNewGObject mkSourceLanguageManager $ liftM castPtr
  {#call unsafe source_language_manager_new#}

-- | Returns the default 'SourceLanguageManager' instance.
--
sourceLanguageManagerGetDefault :: IO SourceLanguageManager
sourceLanguageManagerGetDefault = makeNewGObject mkSourceLanguageManager $ liftM castPtr
  {#call unsafe source_language_manager_new#}

-- | Sets the list of directories where the lm looks for language files. If dirs is 'Nothing', the search path
-- is reset to default.
-- 
-- Note
-- 
-- At the moment this function can be called only before the language files are loaded for the first
-- time. In practice to set a custom search path for a 'SourceLanguageManager', you have to call this
-- function right after creating it.
--
sourceLanguageManagerSetSearchPath :: SourceLanguageManager -> Maybe [String] -> IO ()
sourceLanguageManagerSetSearchPath slm dirs =
  maybeWith withUTFStringArray0 dirs $ \dirsPtr -> do
    {#call unsafe source_language_manager_set_search_path#} slm dirsPtr

-- | Gets the list directories where lm looks for language files.
--
sourceLanguageManagerGetSearchPath :: SourceLanguageManager -> IO [String]
sourceLanguageManagerGetSearchPath slm = do
  dirsPtr <- {#call unsafe source_language_manager_get_search_path#} slm
  liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 dirsPtr

-- | Returns the ids of the available languages.
--
sourceLanguageManagerGetLanguageIds :: SourceLanguageManager -> IO [String]
sourceLanguageManagerGetLanguageIds slm = do
  idsPtr <- {#call unsafe source_language_manager_get_language_ids#} slm
  liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 idsPtr

-- | Gets the 'SourceLanguage' identified by the given id in the language manager.
--
sourceLanguageManagerGetLanguage :: SourceLanguageManager 
                                 -> String  -- ^ @id@      a language id.
                                 -> IO (Maybe SourceLanguage) -- ^ returns a 'SourceLanguage', or 'Nothing' if there is no language identified by the given id. 
sourceLanguageManagerGetLanguage slm id = do
  slPtr <- liftM castPtr $
    withUTFString id ({#call unsafe source_language_manager_get_language#} slm)
