diff --git a/Graphics/UI/Gtk/SourceView.hs b/Graphics/UI/Gtk/SourceView.hs
--- a/Graphics/UI/Gtk/SourceView.hs
+++ b/Graphics/UI/Gtk/SourceView.hs
@@ -1,19 +1,37 @@
 module Graphics.UI.Gtk.SourceView (
 	module Graphics.UI.Gtk.SourceView.SourceBuffer,
+	module Graphics.UI.Gtk.SourceView.SourceCompletion,
+	module Graphics.UI.Gtk.SourceView.SourceCompletionContext,
+	module Graphics.UI.Gtk.SourceView.SourceCompletionInfo,
+	module Graphics.UI.Gtk.SourceView.SourceCompletionItem,
+	module Graphics.UI.Gtk.SourceView.SourceCompletionProposal,
+	module Graphics.UI.Gtk.SourceView.SourceCompletionProvider,
+	module Graphics.UI.Gtk.SourceView.SourceGutter,
 	module Graphics.UI.Gtk.SourceView.SourceIter,
 	module Graphics.UI.Gtk.SourceView.SourceLanguage,
 	module Graphics.UI.Gtk.SourceView.SourceLanguageManager,
+	module Graphics.UI.Gtk.SourceView.SourceMark,
 	module Graphics.UI.Gtk.SourceView.SourceStyle,
 	module Graphics.UI.Gtk.SourceView.SourceStyleScheme,
 	module Graphics.UI.Gtk.SourceView.SourceStyleSchemeManager,
-	module Graphics.UI.Gtk.SourceView.SourceView
+	module Graphics.UI.Gtk.SourceView.SourceUndoManager,
+	module Graphics.UI.Gtk.SourceView.SourceView,
 	) where
 
 import Graphics.UI.Gtk.SourceView.SourceBuffer
+import Graphics.UI.Gtk.SourceView.SourceCompletion
+import Graphics.UI.Gtk.SourceView.SourceCompletionContext
+import Graphics.UI.Gtk.SourceView.SourceCompletionInfo
+import Graphics.UI.Gtk.SourceView.SourceCompletionItem
+import Graphics.UI.Gtk.SourceView.SourceCompletionProposal
+import Graphics.UI.Gtk.SourceView.SourceCompletionProvider
+import Graphics.UI.Gtk.SourceView.SourceGutter
 import Graphics.UI.Gtk.SourceView.SourceIter
 import Graphics.UI.Gtk.SourceView.SourceLanguage
 import Graphics.UI.Gtk.SourceView.SourceLanguageManager
+import Graphics.UI.Gtk.SourceView.SourceMark
 import Graphics.UI.Gtk.SourceView.SourceStyle
 import Graphics.UI.Gtk.SourceView.SourceStyleScheme
 import Graphics.UI.Gtk.SourceView.SourceStyleSchemeManager
+import Graphics.UI.Gtk.SourceView.SourceUndoManager
 import Graphics.UI.Gtk.SourceView.SourceView
diff --git a/Graphics/UI/Gtk/SourceView/Enums.chs b/Graphics/UI/Gtk/SourceView/Enums.chs
new file mode 100644
--- /dev/null
+++ b/Graphics/UI/Gtk/SourceView/Enums.chs
@@ -0,0 +1,55 @@
+{-# LANGUAGE CPP #-}
+-- -*-haskell-*-
+--  GIMP Toolkit (GTK) Widget Enums
+--
+--  Author : Andy Stewart
+--
+--  Created: 08 Aug 2010
+--
+--  Copyright (C) 2010 Andy Stewart
+--
+--  This library is free software; you can redistribute it and/or
+--  modify it under the terms of the GNU Lesser General Public
+--  License as published by the Free Software Foundation; either
+--  version 2.1 of the License, or (at your option) any later version.
+--
+--  This library is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+--  Lesser General Public License for more details.
+--
+-- |
+-- Maintainer  : gtk2hs-users@lists.sourceforge.net
+-- Stability   : provisional
+-- Portability : portable (depends on GHC)
+--
+module Graphics.UI.Gtk.SourceView.Enums (
+-- * Enums
+   SourceCompletionActivation (..),
+   SourceSearchFlags (..),
+   SourceSmartHomeEndType (..),
+   SourceDrawSpacesFlags (..),
+   SourceViewGutterPosition (..)
+) where
+
+import Control.Monad	(liftM)
+
+import System.Glib.FFI
+import System.Glib.Flags
+
+{# context lib="gtk" prefix="gtk" #}
+
+{# enum SourceCompletionActivation {underscoreToCase} deriving(Eq,Bounded,Show,Read) #}
+
+{# enum SourceSearchFlags {underscoreToCase} deriving(Eq,Bounded,Show,Read) #}
+
+instance Flags SourceSearchFlags
+
+{# enum SourceSmartHomeEndType {underscoreToCase} deriving (Eq, Bounded, Show, Read) #}
+
+{# enum SourceDrawSpacesFlags {underscoreToCase} deriving (Eq, Bounded, Show, Read) #}
+
+instance Flags SourceDrawSpacesFlags
+
+{# enum SourceViewGutterPosition {underscoreToCase} deriving (Eq, Bounded, Show, Read) #}
+
diff --git a/Graphics/UI/Gtk/SourceView/Signals.chs b/Graphics/UI/Gtk/SourceView/Signals.chs
--- a/Graphics/UI/Gtk/SourceView/Signals.chs
+++ b/Graphics/UI/Gtk/SourceView/Signals.chs
@@ -41,7 +41,13 @@
   module System.Glib.Signals,
 
   connect_NONE__NONE,
+  connect_OBJECT__NONE,
   connect_BOXED_BOXED__NONE,
+  connect_BOOL_INT__NONE,
+  connect_PTR_BOXED__NONE,
+  connect_OBJECT_PTR_BOXED__NONE,
+  connect_OBJECT_BOXED_OBJECT__BOOL,
+  connect_ENUM_INT__NONE,
   
   ) where
 
@@ -74,6 +80,19 @@
           failOnGError $
           user
 
+connect_OBJECT__NONE :: 
+  (GObjectClass a', GObjectClass obj) => SignalName ->
+  ConnectAfter -> obj ->
+  (a' -> IO ()) ->
+  IO (ConnectId obj)
+connect_OBJECT__NONE signal after obj user =
+  connectGeneric signal after obj action
+  where action :: Ptr GObject -> Ptr GObject -> IO ()
+        action _ obj1 =
+          failOnGError $
+          makeNewGObject (GObject, objectUnref) (return obj1) >>= \obj1' ->
+          user (unsafeCastGObject obj1')
+
 connect_BOXED_BOXED__NONE :: 
   GObjectClass obj => SignalName ->
   (Ptr a' -> IO a) -> (Ptr b' -> IO b) -> 
@@ -88,4 +107,73 @@
           boxedPre2 (castPtr box2) >>= \box2' ->
           boxedPre1 (castPtr box1) >>= \box1' ->
           user box1' box2'
+
+connect_BOOL_INT__NONE :: 
+  GObjectClass obj => SignalName ->
+  ConnectAfter -> obj ->
+  (Bool -> Int -> IO ()) ->
+  IO (ConnectId obj)
+connect_BOOL_INT__NONE signal after obj user =
+  connectGeneric signal after obj action
+  where action :: Ptr GObject -> Bool -> Int -> IO ()
+        action _ bool1 int2 =
+          failOnGError $
+          user bool1 int2
+
+connect_PTR_BOXED__NONE :: 
+  GObjectClass obj => SignalName ->
+  (Ptr b' -> IO b) -> 
+  ConnectAfter -> obj ->
+  (Ptr a -> b -> IO ()) ->
+  IO (ConnectId obj)
+connect_PTR_BOXED__NONE signal boxedPre2 after obj user =
+  connectGeneric signal after obj action
+  where action :: Ptr GObject -> Ptr () -> Ptr () -> IO ()
+        action _ ptr1 box2 =
+          failOnGError $
+          boxedPre2 (castPtr box2) >>= \box2' ->
+          user (castPtr ptr1) box2'
+
+connect_OBJECT_PTR_BOXED__NONE :: 
+  (GObjectClass a', GObjectClass obj) => SignalName ->
+  (Ptr c' -> IO c) -> 
+  ConnectAfter -> obj ->
+  (a' -> Ptr b -> c -> IO ()) ->
+  IO (ConnectId obj)
+connect_OBJECT_PTR_BOXED__NONE signal boxedPre3 after obj user =
+  connectGeneric signal after obj action
+  where action :: Ptr GObject -> Ptr GObject -> Ptr () -> Ptr () -> IO ()
+        action _ obj1 ptr2 box3 =
+          failOnGError $
+          boxedPre3 (castPtr box3) >>= \box3' ->
+          makeNewGObject (GObject, objectUnref) (return obj1) >>= \obj1' ->
+          user (unsafeCastGObject obj1') (castPtr ptr2) box3'
+
+connect_OBJECT_BOXED_OBJECT__BOOL :: 
+  (GObjectClass a', GObjectClass c', GObjectClass obj) => SignalName ->
+  (Ptr b' -> IO b) -> 
+  ConnectAfter -> obj ->
+  (a' -> b -> c' -> IO Bool) ->
+  IO (ConnectId obj)
+connect_OBJECT_BOXED_OBJECT__BOOL signal boxedPre2 after obj user =
+  connectGeneric signal after obj action
+  where action :: Ptr GObject -> Ptr GObject -> Ptr () -> Ptr GObject -> IO Bool
+        action _ obj1 box2 obj3 =
+          failOnGError $
+          makeNewGObject (GObject, objectUnref) (return obj3) >>= \obj3' ->
+          boxedPre2 (castPtr box2) >>= \box2' ->
+          makeNewGObject (GObject, objectUnref) (return obj1) >>= \obj1' ->
+          user (unsafeCastGObject obj1') box2' (unsafeCastGObject obj3')
+
+connect_ENUM_INT__NONE :: 
+  (Enum a, GObjectClass obj) => SignalName ->
+  ConnectAfter -> obj ->
+  (a -> Int -> IO ()) ->
+  IO (ConnectId obj)
+connect_ENUM_INT__NONE signal after obj user =
+  connectGeneric signal after obj action
+  where action :: Ptr GObject -> Int -> Int -> IO ()
+        action _ enum1 int2 =
+          failOnGError $
+          user (toEnum enum1) int2
 
diff --git a/Graphics/UI/Gtk/SourceView/SourceBuffer.chs b/Graphics/UI/Gtk/SourceView/SourceBuffer.chs
--- a/Graphics/UI/Gtk/SourceView/SourceBuffer.chs
+++ b/Graphics/UI/Gtk/SourceView/SourceBuffer.chs
@@ -2,12 +2,13 @@
 -- -*-haskell-*-
 --  GIMP Toolkit (GTK) SourceBuffer
 --
---  Author : Peter Gavin
+--  Author : Peter Gavin, Andy Stewart
 --  derived from sourceview bindings by Axel Simon and Duncan Coutts
 --
 --  Created: 18 December 2008
 --
 --  Copyright (C) 2003-2008 Peter Gavin, Duncan Coutts, Axel Simon
+--  Copyright (C) 2010 Andy Stewart
 --
 --  This library is free software; you can redistribute it and/or
 --  modify it under the terms of the GNU Lesser General Public
@@ -25,8 +26,23 @@
 -- Portability : portable (depends on GHC)
 --
 module Graphics.UI.Gtk.SourceView.SourceBuffer (
+-- * Description
+-- | The 'SourceBuffer' object is the model for 'SourceView' widgets. It extends the 'TextBuffer'
+-- object by adding features useful to display and edit source code as syntax highlighting and bracket
+-- matching. It also implements support for undo/redo operations.
+-- 
+-- To create a 'SourceBuffer' use 'sourceBufferNew' or
+-- 'sourceBufferNewWithLanguage'. The second form is just a convenience function which allows
+-- you to initially set a 'SourceLanguage'.
+-- 
+-- By default highlighting is enabled, but you can disable it with
+-- 'sourceBufferSetHighlightSyntax'.
+
+-- * Types
   SourceBuffer,
   SourceBufferClass,
+
+-- * Methods
   castToSourceBuffer,
   sourceBufferNew,
   sourceBufferNewWithLanguage,
@@ -47,30 +63,44 @@
   sourceBufferBeginNotUndoableAction,
   sourceBufferEndNotUndoableAction,
   sourceBufferCreateSourceMark,
+  sourceBufferGetSourceMarksAtLine,
+  sourceBufferGetSourceMarksAtIter,
+  sourceBufferRemoveSourceMarks,
+  sourceBufferForwardIterToSourceMark,
+  sourceBufferBackwardIterToSourceMark,
   sourceBufferEnsureHighlight,
+
+-- * Attributes
   sourceBufferCanRedo,
   sourceBufferCanUndo,
   sourceBufferHighlightMatchingBrackets,
   sourceBufferHighlightSyntax,
   sourceBufferLanguage,
   sourceBufferSourceStyleScheme,
-  sourceBufferHighlightUpdated
+  sourceBufferMaxUndoLevels,
+  sourceBufferUndoManager,
+
+-- * Signals
+  sourceBufferHighlightUpdated,
+  sourceBufferRedoSignal,
+  sourceBufferUndoSignal,
+  sourceBufferSourceMarkUpdated,
   ) where
 
 import Control.Monad	(liftM)
 import Data.Maybe    (fromMaybe)
 
-import System.Glib.FFI
-import System.Glib.GObject              (constructNewGObject,
-					 makeNewGObject)
-{#import System.Glib.Properties#}
-import System.Glib.Attributes
 import Graphics.UI.Gtk.Abstract.Object	(makeNewObject)
-{#import Graphics.UI.Gtk.SourceView.Types#}
-{#import Graphics.UI.Gtk.SourceView.Signals#}
-{#import Graphics.UI.Gtk.Multiline.TextIter#}
+import System.Glib.Attributes
+import System.Glib.FFI
+import System.Glib.GList
+import System.Glib.GObject              (constructNewGObject, makeNewGObject)
 
+{#import Graphics.UI.Gtk.Multiline.TextIter#}
+{#import Graphics.UI.Gtk.SourceView.Signals#}
 {#import Graphics.UI.Gtk.SourceView.SourceMark#}
+{#import Graphics.UI.Gtk.SourceView.Types#}
+{#import System.Glib.Properties#}
 
 {# context lib="gtk" prefix="gtk" #}
 
@@ -91,101 +121,143 @@
 sourceBufferNewWithLanguage lang = constructNewGObject mkSourceBuffer $
   {#call unsafe source_buffer_new_with_language#} lang
 
--- | 
---
-sourceBufferSetHighlightSyntax :: SourceBuffer -> Bool -> IO ()
+-- | Controls whether syntax is highlighted in the buffer. If highlight is 'True', the text will be
+-- highlighted according to the syntax patterns specified in the language set with
+-- 'sourceBufferSetLanguage'. If highlight is 'False', syntax highlighting is disabled and all the
+-- 'TextTag' objects that have been added by the syntax highlighting engine are removed from the
+-- buffer.
+sourceBufferSetHighlightSyntax :: SourceBufferClass buffer => buffer  -- ^ @buffer@    a 'SourceBuffer'.                                       
+                               -> Bool  -- ^ @highlight@ 'True' to enable syntax highlighting, 'False' to disable it. 
+                               -> IO ()
 sourceBufferSetHighlightSyntax sb newVal =
-  {#call unsafe source_buffer_set_highlight_syntax#} sb (fromBool newVal)
+  {#call unsafe source_buffer_set_highlight_syntax#} 
+    (toSourceBuffer sb) 
+    (fromBool newVal)
   
--- | 
---
-sourceBufferGetHighlightSyntax :: SourceBuffer -> IO Bool 
+-- | Determines whether syntax highlighting is activated in the source buffer.
+sourceBufferGetHighlightSyntax :: SourceBufferClass buffer => buffer 
+                               -> IO Bool  -- ^ returns 'True' if syntax highlighting is enabled, 'False' otherwise. 
 sourceBufferGetHighlightSyntax sb = liftM toBool $
-  {#call unsafe source_buffer_get_highlight_syntax#} sb
+  {#call unsafe source_buffer_get_highlight_syntax#} 
+    (toSourceBuffer sb)
 
--- | 
---
-sourceBufferSetLanguage :: SourceBuffer -> SourceLanguage -> IO ()
+-- | Associate a 'SourceLanguage' with the source buffer. If language is not-'Nothing' and syntax
+-- highlighting is enabled (see 'sourceBufferSetHighlightSyntax', the syntax patterns defined
+-- in language will be used to highlight the text contained in the buffer. If language is 'Nothing', the
+-- text contained in the buffer is not highlighted.
+sourceBufferSetLanguage :: SourceBufferClass buffer => buffer 
+                        -> Maybe SourceLanguage  -- ^ @language@ a 'SourceLanguage' to set, or 'Nothing'. 
+                        -> IO ()
 sourceBufferSetLanguage sb lang =
-  {#call unsafe source_buffer_set_language#} sb lang
+  {#call unsafe source_buffer_set_language#} 
+    (toSourceBuffer sb) 
+    (fromMaybe (SourceLanguage nullForeignPtr) lang)
   
--- | 
---
-sourceBufferGetLanguage :: SourceBuffer -> IO SourceLanguage
-sourceBufferGetLanguage sb = makeNewGObject mkSourceLanguage $
-  {#call unsafe source_buffer_get_language#} sb
+-- | Returns the 'SourceLanguage' associated with the buffer, see 'sourceBufferSetLanguage'. 
+sourceBufferGetLanguage :: SourceBufferClass buffer => buffer 
+                        -> IO (Maybe SourceLanguage) -- ^ returns 'SourceLanguage' associated with the buffer, or 'Nothing'. 
+sourceBufferGetLanguage sb = 
+  maybeNull (makeNewGObject mkSourceLanguage) $
+  {#call unsafe source_buffer_get_language#} (toSourceBuffer sb)
 
--- | 
---
-sourceBufferSetHighlightMatchingBrackets :: SourceBuffer -> Bool -> IO ()
+-- | Controls the bracket match highlighting function in the buffer. If activated, when you position your
+-- cursor over a bracket character (a parenthesis, a square bracket, etc.) the matching opening or
+-- closing bracket character will be highlighted. You can specify the style with the
+-- 'sourceBufferSetBracketMatchStyle' function.
+sourceBufferSetHighlightMatchingBrackets :: SourceBufferClass buffer => buffer 
+                                         -> Bool  -- ^ @highlight@ 'True' if you want matching brackets highlighted. 
+                                         -> IO ()
 sourceBufferSetHighlightMatchingBrackets sb newVal =
-  {#call unsafe source_buffer_set_highlight_matching_brackets#} sb (fromBool newVal)
+  {#call unsafe source_buffer_set_highlight_matching_brackets#} (toSourceBuffer sb) (fromBool newVal)
   
--- | 
---
-sourceBufferGetHighlightMatchingBrackets :: SourceBuffer -> IO Bool 
+-- | Determines whether bracket match highlighting is activated for the source buffer.
+sourceBufferGetHighlightMatchingBrackets :: SourceBufferClass buffer => buffer 
+                                         -> IO Bool  -- ^ returns 'True' if the source buffer will highlight matching brackets. 
 sourceBufferGetHighlightMatchingBrackets sb = liftM toBool $
-  {#call unsafe source_buffer_get_highlight_matching_brackets#} sb
+  {#call unsafe source_buffer_get_highlight_matching_brackets#} (toSourceBuffer sb)
 
--- |
--- 
-sourceBufferSetStyleScheme :: SourceBuffer -> SourceStyleScheme -> IO ()
-sourceBufferSetStyleScheme sb sss =
-    {#call unsafe source_buffer_set_style_scheme#} sb sss
+-- | Sets style scheme used by the buffer. If scheme is 'Nothing' no style scheme is used.
+sourceBufferSetStyleScheme :: SourceBufferClass buffer => buffer 
+                           -> Maybe SourceStyleScheme  -- ^ @scheme@ style scheme.      
+                           -> IO ()
+sourceBufferSetStyleScheme sb scheme =
+    {#call unsafe source_buffer_set_style_scheme#} 
+      (toSourceBuffer sb)  
+      (fromMaybe (SourceStyleScheme nullForeignPtr) scheme)
 
--- |
--- 
-sourceBufferGetStyleScheme :: SourceBuffer -> IO SourceStyleScheme
-sourceBufferGetStyleScheme sb = makeNewGObject mkSourceStyleScheme $
-  {#call unsafe source_buffer_get_style_scheme#} sb
+-- | Returns the 'SourceStyleScheme' currently used in buffer.
+sourceBufferGetStyleScheme :: SourceBufferClass buffer => buffer 
+                           -> IO (Maybe SourceStyleScheme) -- ^ returns the 'SourceStyleScheme' set by 'sourceBufferSetStyleScheme', or 'Nothing'.
+sourceBufferGetStyleScheme sb = 
+    maybeNull (makeNewGObject mkSourceStyleScheme) $
+    {#call unsafe source_buffer_get_style_scheme#} (toSourceBuffer sb)
 
--- | 
---
-sourceBufferSetMaxUndoLevels :: SourceBuffer -> Int -> IO ()
+-- | Sets the number of undo levels for user actions the buffer will track. If the number of user actions
+-- exceeds the limit set by this function, older actions will be discarded.
+-- 
+-- If @maxUndoLevels@ is -1, no limit is set.
+-- 
+-- A new action is started whenever the function 'textBufferBeginUserAction' is called. In
+-- general, this happens whenever the user presses any key which modifies the buffer, but the undo
+-- manager will try to merge similar consecutive actions, such as multiple character insertions into
+-- one action. But, inserting a newline does start a new action.
+sourceBufferSetMaxUndoLevels :: SourceBufferClass buffer => buffer 
+                             -> Int  -- ^ @maxUndoLevels@ the desired maximum number of undo levels. 
+                             -> IO ()
 sourceBufferSetMaxUndoLevels sb newVal =
-  {#call unsafe source_buffer_set_max_undo_levels#} sb (fromIntegral newVal)
+  {#call unsafe source_buffer_set_max_undo_levels#} (toSourceBuffer sb) (fromIntegral newVal)
   
--- | 
---
-sourceBufferGetMaxUndoLevels :: SourceBuffer -> IO Int
+-- | Determines the number of undo levels the buffer will track for buffer edits.
+sourceBufferGetMaxUndoLevels :: SourceBufferClass buffer => buffer 
+                             -> IO Int -- ^ returns the maximum number of possible undo levels or -1 if no limit is set.
 sourceBufferGetMaxUndoLevels sb = liftM fromIntegral $
-  {#call unsafe source_buffer_get_max_undo_levels#} sb
+  {#call unsafe source_buffer_get_max_undo_levels#} (toSourceBuffer sb)
 
--- | 
---
-sourceBufferGetCanUndo :: SourceBuffer -> IO Bool
+-- | Determines whether a source buffer can undo the last action.
+sourceBufferGetCanUndo :: SourceBufferClass buffer => buffer 
+                       -> IO Bool -- ^ returns 'True' if it's possible to undo the last action. 
 sourceBufferGetCanUndo sb = liftM toBool $
-  {#call unsafe source_buffer_can_undo#} sb
+  {#call unsafe source_buffer_can_undo#} (toSourceBuffer sb)
   
--- | 
---
-sourceBufferGetCanRedo :: SourceBuffer -> IO Bool
+-- | Determines whether a source buffer can redo the last action (i.e. if the last operation was an
+-- undo).
+sourceBufferGetCanRedo :: SourceBufferClass buffer => buffer 
+                       -> IO Bool -- ^ returns 'True' if a redo is possible. 
 sourceBufferGetCanRedo sb = liftM toBool $
-  {#call unsafe source_buffer_can_redo#} sb
+  {#call unsafe source_buffer_can_redo#} (toSourceBuffer sb)
 
--- | 
---
-sourceBufferUndo :: SourceBuffer -> IO ()
+-- | Undoes the last user action which modified the buffer. Use 'sourceBufferCanUndo' to check
+-- whether a call to this function will have any effect.
+-- 
+-- Actions are defined as groups of operations between a call to 'textBufferBeginUserAction'
+-- and 'textBufferEndUserAction' on the
+-- same line.
+sourceBufferUndo :: SourceBufferClass buffer => buffer -> IO ()
 sourceBufferUndo sb =
-  {#call source_buffer_undo#} sb
+  {#call source_buffer_undo#} (toSourceBuffer sb)
   
--- | 
---
-sourceBufferRedo :: SourceBuffer -> IO ()
+-- | Redoes the last undo operation. Use 'sourceBufferCanRedo' to check whether a call to this
+-- function will have any effect.
+sourceBufferRedo :: SourceBufferClass buffer => buffer -> IO ()
 sourceBufferRedo sb =
-  {#call source_buffer_redo#} sb
+  {#call source_buffer_redo#} (toSourceBuffer sb)
 
--- | 
---
-sourceBufferBeginNotUndoableAction :: SourceBuffer -> IO ()
+-- | Marks the beginning of a not undoable action on the buffer, disabling the undo manager. Typically
+-- you would call this function before initially setting the contents of the buffer (e.g. when loading
+-- a file in a text editor).
+-- 
+-- You may nest 'sourceBufferBeginNotUndoableAction' /
+-- 'sourceBufferEndNotUndoableAction' blocks.
+sourceBufferBeginNotUndoableAction :: SourceBufferClass buffer => buffer -> IO ()
 sourceBufferBeginNotUndoableAction sb =
-  {#call source_buffer_begin_not_undoable_action#} sb
+  {#call source_buffer_begin_not_undoable_action#} (toSourceBuffer sb)
   
--- | 
---
-sourceBufferEndNotUndoableAction :: SourceBuffer -> IO ()
+-- | Marks the end of a not undoable action on the buffer. When the last not undoable block is closed
+-- through the call to this function, the list of undo actions is cleared and the undo manager is
+-- re-enabled.
+sourceBufferEndNotUndoableAction :: SourceBufferClass buffer => buffer -> IO ()
 sourceBufferEndNotUndoableAction sb =
-  {#call source_buffer_end_not_undoable_action#} sb
+  {#call source_buffer_end_not_undoable_action#} (toSourceBuffer sb)
 
 -- | Creates a marker in the buffer of the given type.
 --
@@ -210,7 +282,7 @@
 --    passed name is @Nothing@.  Also, the buffer owns the markers so you
 --    shouldn't unreference it.
 
-sourceBufferCreateSourceMark :: SourceBuffer -- the buffer
+sourceBufferCreateSourceMark :: SourceBufferClass buffer => buffer -- the buffer
                          -> Maybe String -- the name of the mark
                          -> String -- the category of the mark
                          -> TextIter -> IO SourceMark
@@ -218,50 +290,164 @@
   makeNewGObject mkSourceMark $
   maybeWith withCString name       $ \strPtr1 ->
   withCString category $ \strPtr2 ->
-  {#call source_buffer_create_source_mark#} sb strPtr1 strPtr2 iter
+  {#call source_buffer_create_source_mark#} (toSourceBuffer sb) strPtr1 strPtr2 iter
 
--- |
+-- | Returns the list of marks of the given category at line. If category is empty, all marks at line are
+-- returned.
+sourceBufferGetSourceMarksAtLine :: SourceBufferClass buffer => buffer  -- ^ @buffer@   a 'SourceBuffer'.             
+                                 -> Int -- ^ @line@     a line number.                 
+                                 -> String -- ^ @category@ category to search for or empty 
+                                 -> IO [SourceMark]
+sourceBufferGetSourceMarksAtLine buffer line category = 
+  withCString category $ \categoryPtr ->
+  {#call gtk_source_buffer_get_source_marks_at_line #}
+    (toSourceBuffer buffer) 
+    (fromIntegral line)
+    categoryPtr
+  >>= readGSList
+  >>= mapM (\markPtr -> makeNewGObject mkSourceMark (return markPtr))
+
+-- | Returns the list of marks of the given category at iter. If category is empty it returns all marks at
+-- iter.
+sourceBufferGetSourceMarksAtIter :: SourceBufferClass buffer => buffer -- ^ @buffer@   a 'SourceBuffer'.             
+                                 -> TextIter -- ^ @iter@     an iterator.                   
+                                 -> String -- ^ @category@ category to search for or empty
+                                 -> IO [SourceMark]
+sourceBufferGetSourceMarksAtIter buffer iter category =
+  withCString category $ \categoryPtr ->
+  {#call gtk_source_buffer_get_source_marks_at_iter #}
+    (toSourceBuffer buffer)
+    iter
+    categoryPtr
+  >>= readGSList
+  >>= mapM (\markPtr -> makeNewGObject mkSourceMark (return markPtr))
+
+-- | Remove all marks of category between start and end from the buffer. If category is empty, all marks
+-- in the range will be removed.
+sourceBufferRemoveSourceMarks :: SourceBufferClass buffer => buffer -- ^ @buffer@   a 'SourceBuffer'.             
+                              -> TextIter -- ^ @start@    a 'TextIter'                  
+                              -> TextIter -- ^ @end@      a 'TextIter'                  
+                              -> String -- ^ @category@ category to search for or empty
+                              -> IO ()
+sourceBufferRemoveSourceMarks buffer start end category =
+  withCString category $ \categoryPtr ->
+  {#call gtk_source_buffer_remove_source_marks #}
+     (toSourceBuffer buffer)
+     start
+     end
+     categoryPtr
+
+-- | Moves iter to the position of the next 'SourceMark' of the given category. Returns 'True' if iter was
+-- moved. If category is empty, the next source mark can be of any category.
+sourceBufferForwardIterToSourceMark :: SourceBufferClass buffer => buffer -- ^ @buffer@   a 'SourceBuffer'.             
+                                    -> TextIter -- ^ @iter@     an iterator.                   
+                                    -> String -- ^ @category@ category to search for or emtpy
+                                    -> IO Bool -- ^ returns  whether iter moved.            
+sourceBufferForwardIterToSourceMark buffer iter category =
+  liftM toBool $
+  withCString category $ \categoryPtr ->
+  {#call gtk_source_buffer_forward_iter_to_source_mark #}
+    (toSourceBuffer buffer)
+    iter
+    categoryPtr
+
+-- | Moves iter to the position of the previous 'SourceMark' of the given category. Returns 'True' if iter
+-- was moved. If category is empty, the previous source mark can be of any category.
+sourceBufferBackwardIterToSourceMark :: SourceBufferClass buffer => buffer  -- ^ @buffer@   a 'SourceBuffer'.             
+                                     -> TextIter -- ^ @iter@     an iterator.                   
+                                     -> String -- ^ @category@ category to search for or emtpy
+                                     -> IO Bool -- ^ returns  whether iter moved.            
+sourceBufferBackwardIterToSourceMark buffer iter category =
+  liftM toBool $
+  withCString category $ \categoryPtr ->
+  {#call gtk_source_buffer_backward_iter_to_source_mark #}
+    (toSourceBuffer buffer)
+    iter
+    categoryPtr
+
+-- | Forces buffer to analyze and highlight the given area synchronously.
 -- 
-sourceBufferEnsureHighlight :: SourceBuffer -> TextIter -> TextIter -> IO ()
+-- Note
+-- 
+-- This is a potentially slow operation and should be used only when you need to make sure that some
+-- text not currently visible is highlighted, for instance before printing.
+sourceBufferEnsureHighlight :: SourceBufferClass buffer => buffer 
+                            -> TextIter  -- ^ @start@  start of the area to highlight. 
+                            -> TextIter  -- ^ @end@    end of the area to highlight.   
+                            -> IO ()
 sourceBufferEnsureHighlight sb start end =
-    {#call source_buffer_ensure_highlight#} sb start end
+    {#call source_buffer_ensure_highlight#} (toSourceBuffer sb) start end
 
--- |
+-- | Whether Redo operation is possible.
 -- 
-sourceBufferCanRedo :: ReadAttr SourceBuffer Bool
+-- Default value: 'False'
+-- 
+sourceBufferCanRedo :: SourceBufferClass buffer => ReadAttr buffer Bool
 sourceBufferCanRedo = readAttrFromBoolProperty "can-redo"
 
--- |
+-- | Whether Undo operation is possible.
 -- 
-sourceBufferCanUndo :: ReadAttr SourceBuffer Bool
+-- Default value: 'False'
+sourceBufferCanUndo :: SourceBufferClass buffer => ReadAttr buffer Bool
 sourceBufferCanUndo = readAttrFromBoolProperty "can-undo"
 
--- |
+-- | Whether to highlight matching brackets in the buffer.
+-- 
+-- Default value: 'True'
 --
-sourceBufferHighlightMatchingBrackets :: Attr SourceBuffer Bool
+sourceBufferHighlightMatchingBrackets :: SourceBufferClass buffer => Attr buffer Bool
 sourceBufferHighlightMatchingBrackets = newAttrFromBoolProperty "highlight-matching-brackets"
 
--- |
+-- | Whether to highlight syntax in the buffer.
+-- 
+-- Default value: 'True'
 --
-sourceBufferHighlightSyntax :: Attr SourceBuffer Bool
+sourceBufferHighlightSyntax :: SourceBufferClass buffer => Attr buffer Bool
 sourceBufferHighlightSyntax = newAttrFromBoolProperty "highlight-matching-brackets"
 
--- |
+-- | Language object to get highlighting patterns from.
 -- 
-sourceBufferLanguage :: Attr SourceBuffer (Maybe SourceLanguage)
+sourceBufferLanguage :: SourceBufferClass buffer => Attr buffer (Maybe SourceLanguage)
 sourceBufferLanguage = newAttrFromMaybeObjectProperty "language" gTypeSourceLanguage
 
--- |
+-- | Number of undo levels for the buffer. -1 means no limit. This property will only affect the default
+-- undo manager.
+-- 
+-- Allowed values: >= GMaxulong
+-- 
+-- Default value: 1000
 --
-sourceBufferMaxUndoLevels :: Attr SourceBuffer Int
+sourceBufferMaxUndoLevels :: SourceBufferClass buffer => Attr buffer Int
 sourceBufferMaxUndoLevels = newAttrFromIntProperty "max-undo-levels"
 
--- |
+-- | Style scheme. It contains styles for syntax highlighting, optionally foreground, background, cursor
+-- color, current line color, and matching brackets style.
 -- 
-sourceBufferSourceStyleScheme :: Attr SourceBuffer (Maybe SourceStyleScheme)
+sourceBufferSourceStyleScheme :: SourceBufferClass buffer => Attr buffer (Maybe SourceStyleScheme)
 sourceBufferSourceStyleScheme = newAttrFromMaybeObjectProperty "style-scheme" gTypeSourceStyleScheme
 
+-- | The buffer undo manager.
+sourceBufferUndoManager :: SourceBufferClass buffer => Attr buffer SourceUndoManager
+sourceBufferUndoManager = newAttrFromObjectProperty "undo-manager"
+                          {# call pure unsafe gtk_source_undo_manager_get_type #}
+
 -- |
 --
-sourceBufferHighlightUpdated :: Signal SourceBuffer (TextIter -> TextIter -> IO ())
+sourceBufferHighlightUpdated :: SourceBufferClass buffer => Signal buffer (TextIter -> TextIter -> IO ())
 sourceBufferHighlightUpdated = Signal $ connect_BOXED_BOXED__NONE "highlight-updated" mkTextIterCopy mkTextIterCopy
+
+-- |
+--
+sourceBufferRedoSignal :: SourceBufferClass buffer => Signal buffer (IO ())
+sourceBufferRedoSignal = Signal $ connect_NONE__NONE "redo"
+
+-- |
+--
+sourceBufferUndoSignal :: SourceBufferClass buffer => Signal buffer (IO ())
+sourceBufferUndoSignal = Signal $ connect_NONE__NONE "undo"
+
+-- | The 'sourceBufferMarkUpdated' signal is emitted each time a mark is added to, moved or removed from the
+-- buffer.
+--
+sourceBufferSourceMarkUpdated :: SourceBufferClass buffer => Signal buffer (TextMark -> IO ())
+sourceBufferSourceMarkUpdated = Signal $ connect_OBJECT__NONE "source-mark-updated" 
diff --git a/Graphics/UI/Gtk/SourceView/SourceCompletion.chs b/Graphics/UI/Gtk/SourceView/SourceCompletion.chs
new file mode 100644
--- /dev/null
+++ b/Graphics/UI/Gtk/SourceView/SourceCompletion.chs
@@ -0,0 +1,289 @@
+{-# LANGUAGE CPP #-}
+-- -*-haskell-*-
+--  GIMP Toolkit (GTK) Widget SourceCompletion
+--
+--  Author : Andy Stewart
+--
+--  Created: 08 Aug 2010
+--
+--  Copyright (C) 2010 Andy Stewart
+--
+--  This library is free software; you can redistribute it and/or
+--  modify it under the terms of the GNU Lesser General Public
+--  License as published by the Free Software Foundation; either
+--  version 2.1 of the License, or (at your option) any later version.
+--
+--  This library is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+--  Lesser General Public License for more details.
+--
+-- |
+-- Maintainer  : gtk2hs-users@lists.sourceforge.net
+-- Stability   : provisional
+-- Portability : portable (depends on GHC)
+--
+module Graphics.UI.Gtk.SourceView.SourceCompletion (
+-- * Types
+    SourceCompletion,
+    SourceCompletionClass,
+
+-- * Methods
+    sourceCompletionAddProvider,
+    sourceCompletionRemoveProvider,
+    sourceCompletionGetProviders,
+    sourceCompletionShow,
+    sourceCompletionHide,
+    sourceCompletionGetInfoWindow,
+    sourceCompletionCreateContext,
+    sourceCompletionMoveWindow,
+    sourceCompletionBlockInteractive,
+    sourceCompletionUnblockInteractive,
+
+-- * Attributes
+    sourceCompletionAccelerators,
+    sourceCompletionAutoCompleteDelay,
+    sourceCompletionProposalPageSize,
+    sourceCompletionProviderPageSize,
+    sourceCompletionRememberInfoVisibility,
+    sourceCompletionSelectOnShow,
+    sourceCompletionShowHeaders,
+    sourceCompletionShowIcons,
+    sourceCompletionView,
+
+-- * Signals
+    sourceCompletionActivateProposal,
+    sourceCompletionHideSignal,
+    sourceCompletionMoveCursor,
+    sourceCompletionMovePage,
+    sourceCompletionPopulateContext,
+    sourceCompletionShowSignal,
+) where
+
+import Control.Monad	(liftM)
+import Data.Maybe (fromMaybe)
+
+import Graphics.UI.Gtk.Abstract.Object	(makeNewObject)
+import Graphics.UI.Gtk.General.Enums (ScrollStep (..))
+import Graphics.UI.Gtk.Multiline.TextView (TextWindowType (..))
+import System.Glib.Attributes
+import System.Glib.FFI
+import System.Glib.GError
+import System.Glib.GList		(fromGList, withGList)
+import System.Glib.GObject	(makeNewGObject)
+import System.Glib.Properties
+import System.Glib.UTFString
+
+{#import Graphics.UI.Gtk.SourceView.Signals#}
+{#import Graphics.UI.Gtk.SourceView.Types#}
+
+{# context lib="gtk" prefix="gtk" #}
+
+-- | Add a new 'SourceCompletionProvider' to the completion object. This will add a reference provider,
+-- so make sure to unref your own copy when you no longer need it.
+sourceCompletionAddProvider :: SourceCompletionClass sc => sc 
+                            -> SourceCompletionProvider
+                            -> IO Bool -- ^ returns    'True' if provider was successfully added, otherwise if error is provided, it will be set with the error and     
+sourceCompletionAddProvider sc provider = 
+  liftM toBool $
+  propagateGError $ \gErrorPtr -> 
+      {# call gtk_source_completion_add_provider #}  
+          (toSourceCompletion sc)
+          provider
+          gErrorPtr
+
+-- | Remove provider from the completion.
+sourceCompletionRemoveProvider :: SourceCompletionClass sc => sc 
+                               -> SourceCompletionProvider
+                               -> IO Bool  -- ^ returns    'True' if provider was successfully removed, otherwise if error is provided, it will be set with the error and   
+sourceCompletionRemoveProvider sc provider =
+  liftM toBool $
+  propagateGError $ \gErrorPtr -> 
+      {#call gtk_source_completion_remove_provider #}
+         (toSourceCompletion sc)
+         provider
+         gErrorPtr
+      
+-- | Get list of providers registered on completion. The returned list is owned by the completion and
+-- should not be freed.
+sourceCompletionGetProviders :: SourceCompletionClass sc => sc -> IO [SourceCompletionProvider]
+sourceCompletionGetProviders sc = do
+  glist <- {#call gtk_source_completion_get_providers #} (toSourceCompletion sc)
+  glistPtrs <- fromGList glist
+  mapM (makeNewGObject mkSourceCompletionProvider . return) glistPtrs  
+
+-- | Starts a new completion with the specified 'SourceCompletionContext' and a list of potential
+-- candidate providers for completion.
+sourceCompletionShow :: SourceCompletionClass sc => sc
+                     -> [SourceCompletionProvider] -- ^ @providers@  A list of 'SourceCompletionProvider' 
+                     -> SourceCompletionContext -- ^ @context@    The 'SourceCompletionContext' with which to start the completion
+                     -> IO Bool -- ^ returns    'True' if it was possible to the show completion window.           
+sourceCompletionShow sc providers context =
+  liftM toBool $
+  withForeignPtrs (map unSourceCompletionProvider providers) $ \providersPtr ->
+  withGList providersPtr $ \glist ->
+  {#call gtk_source_completion_show #}
+    (toSourceCompletion sc)
+    glist
+    context
+
+-- | Hides the completion if it is active (visible).
+sourceCompletionHide :: SourceCompletionClass sc => sc -> IO ()
+sourceCompletionHide sc =
+  {#call gtk_source_completion_hide #} (toSourceCompletion sc)
+
+-- | The info widget is the window where the completion displays optional extra information of the
+-- proposal.
+sourceCompletionGetInfoWindow :: SourceCompletionClass sc => sc -> IO SourceCompletionInfo
+sourceCompletionGetInfoWindow sc =
+  makeNewObject mkSourceCompletionInfo $
+  {#call gtk_source_completion_get_info_window #}
+    (toSourceCompletion sc)
+
+-- | Create a new 'SourceCompletionContext' for completion. The position at which the completion using
+-- the new context will consider completion can be provider by position. If position is 'Nothing', the
+-- current cursor position will be used.
+sourceCompletionCreateContext :: SourceCompletionClass sc => sc
+                              -> Maybe TextIter
+                              -> IO SourceCompletionContext
+sourceCompletionCreateContext sc iter = 
+  makeNewGObject mkSourceCompletionContext $
+  {#call gtk_source_completion_create_context #}
+    (toSourceCompletion sc)
+    (fromMaybe (TextIter nullForeignPtr) iter)
+
+-- | Move the completion window to a specific iter.
+sourceCompletionMoveWindow :: SourceCompletionClass sc => sc
+                           -> TextIter 
+                           -> IO ()
+sourceCompletionMoveWindow sc iter = 
+  {#call gtk_source_completion_move_window #}
+    (toSourceCompletion sc)
+    iter
+
+-- | Block interactive completion. This can be used to disable interactive completion when inserting or
+-- deleting text from the buffer associated with the completion. Use
+-- 'sourceCompletionUnblockInteractive' to enable interactive completion again.
+sourceCompletionBlockInteractive :: SourceCompletionClass sc => sc -> IO ()
+sourceCompletionBlockInteractive sc =
+  {#call gtk_source_completion_block_interactive #}
+     (toSourceCompletion sc)
+
+-- | Unblock interactive completion. This can be used after using 'sourceCompletionBlockInteractive'
+-- to enable interactive completion again.
+sourceCompletionUnblockInteractive :: SourceCompletionClass sc => sc -> IO ()
+sourceCompletionUnblockInteractive sc =
+  {#call gtk_source_completion_unblock_interactive #}
+     (toSourceCompletion sc)
+
+-- | Number of accelerators to show for the first proposals.
+-- 
+-- Allowed values: <= 10
+-- 
+-- Default value: 5
+--
+sourceCompletionAccelerators :: SourceCompletionClass sc => Attr sc Int
+sourceCompletionAccelerators = newAttrFromIntProperty "accelerators"
+
+-- | Determines the popup delay (in milliseconds) at which the completion will be shown for interactive
+-- completion.
+-- 
+-- Default value: 250
+--
+sourceCompletionAutoCompleteDelay :: SourceCompletionClass sc => Attr sc Int
+sourceCompletionAutoCompleteDelay = newAttrFromIntProperty "auto-complete-delay"
+
+-- | The scroll page size of the proposals in the completion window.
+-- 
+-- Allowed values: >= 1
+-- 
+-- Default value: 5
+--
+sourceCompletionProposalPageSize :: SourceCompletionClass sc => Attr sc Int
+sourceCompletionProposalPageSize = newAttrFromIntProperty "proposal-page-size"
+
+-- | The scroll page size of the provider pages in the completion window.
+-- 
+-- Allowed values: >= 1
+-- 
+-- Default value: 5
+--
+sourceCompletionProviderPageSize :: SourceCompletionClass sc => Attr sc Int
+sourceCompletionProviderPageSize = newAttrFromIntProperty "provider-page-size"
+
+-- | Determines whether the visibility of the info window should be saved when the completion is hidden,
+-- and restored when the completion is shown again.
+-- 
+-- Default value: 'False'
+--
+sourceCompletionRememberInfoVisibility :: SourceCompletionClass sc => Attr sc Bool
+sourceCompletionRememberInfoVisibility = newAttrFromBoolProperty "remember-info-visibility"
+
+-- | Determines whether the first proposal should be selected when the completion is first shown.
+-- 
+-- Default value: 'True'
+--
+sourceCompletionSelectOnShow :: SourceCompletionClass sc => Attr sc Bool
+sourceCompletionSelectOnShow = newAttrFromBoolProperty "select-on-show"
+
+-- | Determines whether provider headers should be shown in the proposal list if there is more than one
+-- provider with proposals.
+-- 
+-- Default value: 'True'
+sourceCompletionShowHeaders :: SourceCompletionClass sc => Attr sc Bool
+sourceCompletionShowHeaders = newAttrFromBoolProperty "show-headers"
+
+-- | Determines whether provider and proposal icons should be shown in the completion popup.
+-- 
+-- Default value: 'True'
+--
+sourceCompletionShowIcons :: SourceCompletionClass sc => Attr sc Bool
+sourceCompletionShowIcons = newAttrFromBoolProperty "show-icons"
+
+-- | The 'SourceView' bound to the completion object.
+--
+sourceCompletionView :: SourceCompletionClass sc => Attr sc SourceView
+sourceCompletionView = newAttrFromObjectProperty "view"
+                       {#call pure unsafe gtk_source_view_get_type #}
+
+-- | The 'activateProposal' signal is a keybinding signal which gets emitted when the user initiates a
+-- proposal activation.
+-- 
+-- Applications should not connect to it, but may emit it with @gSignalEmitByName@ if they need to
+-- control the proposal activation programmatically.
+sourceCompletionActivateProposal :: SourceCompletionClass sc => Signal sc (IO ())
+sourceCompletionActivateProposal = 
+  Signal $ connect_NONE__NONE "activate-proposal"
+
+-- | Emitted when the completion window is hidden. The default handler will actually hide the window.
+sourceCompletionHideSignal :: SourceCompletionClass sc => Signal sc (IO ())
+sourceCompletionHideSignal =
+  Signal $ connect_NONE__NONE "hide"
+
+-- | The 'moveCursor' signal is a keybinding signal which gets emitted when the user initiates a cursor
+-- movement.
+-- 
+-- Applications should not connect to it, but may emit it with @gSignalEmitByName@ if they need to
+-- control the cursor programmatically.
+sourceCompletionMoveCursor :: SourceCompletionClass sc => Signal sc (ScrollStep -> Int -> IO ())
+sourceCompletionMoveCursor =
+  Signal $ connect_ENUM_INT__NONE "move-cursor"
+
+-- | The 'movePage' signal is a keybinding signal which gets emitted when the user initiates a page
+-- movement (i.e. switches between provider pages).
+-- 
+-- Applications should not connect to it, but may emit it with @gSignalEmitByName@ if they need to
+-- control the page selection programmatically.
+sourceCompletionMovePage :: SourceCompletionClass sc => Signal sc (ScrollStep -> Int -> IO ())
+sourceCompletionMovePage =
+  Signal $ connect_ENUM_INT__NONE "move-page"
+
+-- | Emitted just before starting to populate the completion with providers. You can use this signal to
+-- add additional attributes in the context.
+sourceCompletionPopulateContext :: SourceCompletionClass sc => Signal sc (SourceCompletionContext -> IO ())
+sourceCompletionPopulateContext = Signal $ connect_OBJECT__NONE "populate-context"
+
+-- | Emitted when the completion window is shown. The default handler will actually show the window.
+sourceCompletionShowSignal :: SourceCompletionClass sc => Signal sc (IO ())
+sourceCompletionShowSignal =
+  Signal $ connect_NONE__NONE "show"
diff --git a/Graphics/UI/Gtk/SourceView/SourceCompletionContext.chs b/Graphics/UI/Gtk/SourceView/SourceCompletionContext.chs
new file mode 100644
--- /dev/null
+++ b/Graphics/UI/Gtk/SourceView/SourceCompletionContext.chs
@@ -0,0 +1,103 @@
+{-# LANGUAGE CPP #-}
+-- -*-haskell-*-
+--  GIMP Toolkit (GTK) Widget SourceCompletionContext
+--
+--  Author : Andy Stewart
+--
+--  Created: 08 Aug 2010
+--
+--  Copyright (C) 2010 Andy Stewart
+--
+--  This library is free software; you can redistribute it and/or
+--  modify it under the terms of the GNU Lesser General Public
+--  License as published by the Free Software Foundation; either
+--  version 2.1 of the License, or (at your option) any later version.
+--
+--  This library is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+--  Lesser General Public License for more details.
+--
+-- |
+-- Maintainer  : gtk2hs-users@lists.sourceforge.net
+-- Stability   : provisional
+-- Portability : portable (depends on GHC)
+--
+module Graphics.UI.Gtk.SourceView.SourceCompletionContext (
+-- * Types
+   SourceCompletionContext,
+   SourceCompletionContextClass,
+
+-- * Enums
+   SourceCompletionActivation,
+
+-- * Methods
+   sourceCompletionContextAddProposals,
+   sourceCompletionContextGetIter,
+
+-- * Attributes   
+   sourceCompletionContextActivation,
+   sourceCompletionContextCompletion,
+
+-- * Signals   
+   sourceCompletionContextCancelled,
+) where
+
+import Control.Monad	(liftM)
+
+import Graphics.UI.Gtk.SourceView.Enums
+import System.Glib.Attributes
+import System.Glib.FFI
+import System.Glib.GList		(fromGList, withGList)
+import System.Glib.GObject	(makeNewGObject)
+import System.Glib.Properties
+import System.Glib.UTFString
+
+{#import Graphics.UI.Gtk.SourceView.Signals#}
+{#import Graphics.UI.Gtk.SourceView.Types#}
+
+{# context lib="gtk" prefix="gtk" #}
+
+-- | Providers can use this function to add proposals to the completion. They can do so asynchronously by
+-- means of the finished argument. Providers must ensure that they always call this function with
+-- finished set to 'True' once each population (even if no proposals need to be added).
+sourceCompletionContextAddProposals :: SourceCompletionContextClass scc => scc
+                                    -> SourceCompletionProvider
+                                    -> [SourceCompletionProposal] -- ^ @proposals@ The list of proposals to add                      
+                                    -> Bool -- ^ @finished@  Whether the provider is finished adding proposals 
+                                    -> IO ()
+sourceCompletionContextAddProposals scc provider proposals finished = 
+    withForeignPtrs (map unSourceCompletionProposal proposals) $ \proposalsPtr ->
+    withForeignPtr (unSourceCompletionProvider provider) $ \providerPtr ->
+    withGList proposalsPtr $ \glist ->
+    {#call gtk_source_completion_context_add_proposals #}
+      (toSourceCompletionContext scc)
+      (castPtr providerPtr)
+      glist
+      (fromBool finished)
+
+-- | Get the iter at which the completion was invoked. Providers can use this to determine how and if to
+-- match proposals.
+sourceCompletionContextGetIter :: SourceCompletionContextClass scc => scc
+                               -> IO TextIter
+sourceCompletionContextGetIter scc = do
+  iter <- makeEmptyTextIter
+  {#call gtk_source_completion_context_get_iter #}
+    (toSourceCompletionContext scc)
+    iter
+  return iter
+
+-- | The completion activation
+sourceCompletionContextActivation :: SourceCompletionContextClass scc => Attr scc SourceCompletionActivation
+sourceCompletionContextActivation = newAttrFromEnumProperty "activation"
+                                    {#call pure unsafe gtk_source_completion_activation_get_type #}
+
+-- | The 'SourceCompletion' associated with the context.
+sourceCompletionContextCompletion :: SourceCompletionContextClass scc => Attr scc SourceCompletion
+sourceCompletionContextCompletion = newAttrFromObjectProperty "completion"
+                                    {#call pure unsafe gtk_source_completion_get_type #}
+
+-- | Emitted when the current population of proposals has been cancelled. Providers adding proposals
+-- asynchronously should connect to this signal to know when to cancel running proposal queries.
+sourceCompletionContextCancelled :: SourceCompletionContextClass scc => Signal scc (IO ())
+sourceCompletionContextCancelled = Signal $ connect_NONE__NONE "cancelled"
diff --git a/Graphics/UI/Gtk/SourceView/SourceCompletionInfo.chs b/Graphics/UI/Gtk/SourceView/SourceCompletionInfo.chs
new file mode 100644
--- /dev/null
+++ b/Graphics/UI/Gtk/SourceView/SourceCompletionInfo.chs
@@ -0,0 +1,158 @@
+{-# LANGUAGE CPP #-}
+-- -*-haskell-*-
+--  GIMP Toolkit (GTK) Widget SourceCompletionInfo
+--
+--  Author : Andy Stewart
+--
+--  Created: 08 Aug 2010
+--
+--  Copyright (C) 2010 Andy Stewart
+--
+--  This library is free software; you can redistribute it and/or
+--  modify it under the terms of the GNU Lesser General Public
+--  License as published by the Free Software Foundation; either
+--  version 2.1 of the License, or (at your option) any later version.
+--
+--  This library is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+--  Lesser General Public License for more details.
+--
+-- |
+-- Maintainer  : gtk2hs-users@lists.sourceforge.net
+-- Stability   : provisional
+-- Portability : portable (depends on GHC)
+--
+module Graphics.UI.Gtk.SourceView.SourceCompletionInfo (
+-- * Description
+-- | This object can be used to show a calltip or help for the .* current completion proposal.
+
+-- * Types
+   SourceCompletionInfo,
+   SourceCompletionInfoClass,
+
+-- * Methods
+   sourceCompletionInfoNew,
+   sourceCompletionInfoMoveToIter,
+   sourceCompletionInfoSetSizing,
+   sourceCompletionInfoSetWidget,
+   sourceCompletionInfoGetWidget,
+   sourceCompletionInfoProcessResize,
+
+-- * Attributes
+   sourceCompletionInfoMaxHeight,
+   sourceCompletionInfoMaxWidth,
+   sourceCompletionInfoShrinkHeight,
+   sourceCompletionInfoShrinkWidth,
+
+-- * Signals
+   sourceCompletionInfoBeforeShow,
+) where
+import Control.Monad	(liftM)
+import Data.Maybe (fromMaybe)
+
+import Graphics.UI.Gtk.Abstract.Object	(makeNewObject)
+import System.Glib.Attributes
+import System.Glib.FFI
+import System.Glib.GObject	(makeNewGObject)
+import System.Glib.Properties
+import System.Glib.UTFString
+
+{#import Graphics.UI.Gtk.SourceView.Signals#}
+{#import Graphics.UI.Gtk.SourceView.Types#}
+
+{# context lib="gtk" prefix="gtk" #}
+
+-- |
+sourceCompletionInfoNew :: IO SourceCompletionInfo
+sourceCompletionInfoNew = 
+  makeNewObject mkSourceCompletionInfo $
+  {#call gtk_source_completion_info_new #}
+
+-- | Moves the 'SourceCompletionInfo' to iter. If iter is 'Nothing' info is moved to the cursor
+-- position. Moving will respect the 'Gravity' setting of the info window and will ensure the line at
+-- iter is not occluded by the window.
+sourceCompletionInfoMoveToIter :: SourceCompletionInfoClass info => info 
+                               -> TextView -- ^ @view@ A 'TextView' on which the info window should be positioned 
+                               -> Maybe TextIter -- ^ @iter@ A 'TextIter' or 'Nothing'
+                               -> IO ()
+sourceCompletionInfoMoveToIter info view iter =
+  {#call gtk_source_completion_info_move_to_iter #}
+    (toSourceCompletionInfo info)
+    view
+    (fromMaybe (TextIter nullForeignPtr) iter)
+
+-- | Set sizing information for the info window. If @shrinkWidth@ or @shrinkHeight@ is 'True', the info
+-- window will try to resize to fit the window contents, with a maximum size given by width and
+-- height. Setting width or height to -1 removes the maximum size of respectively the width and height
+-- of the window.
+sourceCompletionInfoSetSizing :: SourceCompletionInfoClass info => info 
+                              -> Int -- ^ @width@         The maximum/requested width of the window (-1 to default)     
+                              -> Int -- ^ @height@        The maximum/requested height of the window (-1 to default)    
+                              -> Bool -- ^ @shrinkWidth@  Whether to shrink the width of the window to fit its contents 
+                              -> Bool -- ^ @shrinkHeight@ Whether to shrink the height of the window to fit its contents
+                              -> IO ()
+sourceCompletionInfoSetSizing info width height shrinkWidth shrinkHeight = 
+  {#call gtk_source_completion_info_set_sizing #}
+     (toSourceCompletionInfo info)
+     (fromIntegral width)
+     (fromIntegral height)
+     (fromBool shrinkWidth)
+     (fromBool shrinkHeight)
+
+-- | Sets the content widget of the info window. If widget does not fit within the size requirements of
+-- the window, a 'ScrolledWindow' will automatically be created and added to the window.
+sourceCompletionInfoSetWidget :: (SourceCompletionInfoClass info, WidgetClass widget) => info 
+                              -> widget
+                              -> IO ()
+sourceCompletionInfoSetWidget info widget =
+  {#call gtk_source_completion_info_set_widget #}
+    (toSourceCompletionInfo info)
+    (toWidget widget)
+
+-- | Get the current content widget.
+sourceCompletionInfoGetWidget :: SourceCompletionInfoClass info => info 
+                              -> IO Widget -- ^ returns The current content widget. 
+sourceCompletionInfoGetWidget info =
+  makeNewObject mkWidget $
+  {#call gtk_source_completion_info_get_widget #}
+     (toSourceCompletionInfo info)
+
+-- |
+sourceCompletionInfoProcessResize :: SourceCompletionInfoClass info => info 
+                                  -> IO ()
+sourceCompletionInfoProcessResize info =
+  {#call gtk_source_completion_info_process_resize #}
+     (toSourceCompletionInfo info)
+
+-- | The maximum allowed height.
+-- 
+-- Allowed values: >= GMaxulong
+-- 
+-- Default value: -1
+sourceCompletionInfoMaxHeight :: SourceCompletionInfoClass info => Attr info Int
+sourceCompletionInfoMaxHeight = newAttrFromIntProperty "max-height"
+
+-- | The maximum allowed width.
+-- 
+-- Allowed values: >= GMaxulong
+-- 
+-- Default value: -1
+sourceCompletionInfoMaxWidth :: SourceCompletionInfoClass info => Attr info Int
+sourceCompletionInfoMaxWidth = newAttrFromIntProperty "max-width"
+
+-- | Whether the window should shrink height to fit the contents.
+-- 
+-- Default value: 'True'
+sourceCompletionInfoShrinkHeight :: SourceCompletionInfoClass info => Attr info Bool
+sourceCompletionInfoShrinkHeight = newAttrFromBoolProperty "shrink-height"
+
+-- | Whether the window should shrink width to fit the contents.
+-- 
+-- Default value: 'True'
+sourceCompletionInfoShrinkWidth :: SourceCompletionInfoClass info => Attr info Bool
+sourceCompletionInfoShrinkWidth = newAttrFromBoolProperty "shrink-width"
+
+-- |
+sourceCompletionInfoBeforeShow :: SourceCompletionInfoClass info => Signal info (IO ())
+sourceCompletionInfoBeforeShow = Signal $ connect_NONE__NONE "before-show"
diff --git a/Graphics/UI/Gtk/SourceView/SourceCompletionItem.chs b/Graphics/UI/Gtk/SourceView/SourceCompletionItem.chs
new file mode 100644
--- /dev/null
+++ b/Graphics/UI/Gtk/SourceView/SourceCompletionItem.chs
@@ -0,0 +1,143 @@
+{-# LANGUAGE CPP #-}
+-- -*-haskell-*-
+--  GIMP Toolkit (GTK) Widget SourceCompletionItem
+--
+--  Author : Andy Stewart
+--
+--  Created: 08 Aug 2010
+--
+--  Copyright (C) 2010 Andy Stewart
+--
+--  This library is free software; you can redistribute it and/or
+--  modify it under the terms of the GNU Lesser General Public
+--  License as published by the Free Software Foundation; either
+--  version 2.1 of the License, or (at your option) any later version.
+--
+--  This library is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+--  Lesser General Public License for more details.
+--
+-- |
+-- Maintainer  : gtk2hs-users@lists.sourceforge.net
+-- Stability   : provisional
+-- Portability : portable (depends on GHC)
+--
+module Graphics.UI.Gtk.SourceView.SourceCompletionItem (
+-- * Types
+   SourceCompletionItem,
+   SourceCompletionItemClass,
+
+-- * Methods
+   sourceCompletionItemNew,
+   sourceCompletionItemNewWithMarkup,
+   sourceCompletionItemNewFromStock,
+
+-- * Attributes
+   sourceCompletionItemIcon,
+   sourceCompletionItemInfo,
+   sourceCompletionItemLabel,
+   sourceCompletionItemMarkup,
+   sourceCompletionItemText,
+) where
+
+import Control.Monad	(liftM)
+import Data.Maybe (fromMaybe)
+
+import System.Glib.Attributes
+import System.Glib.FFI
+import System.Glib.GObject	(makeNewGObject)
+import System.Glib.Properties
+import System.Glib.UTFString
+
+{#import Graphics.UI.Gtk.SourceView.Signals#}
+{#import Graphics.UI.Gtk.SourceView.Types#}
+
+{# context lib="gtk" prefix="gtk" #}
+
+-- | Create a new 'SourceCompletionItem' with label label, icon icon and extra information info. Both
+-- icon and info can be 'Nothing' in which case there will be no icon shown and no extra information
+-- available.
+sourceCompletionItemNew :: String -- ^ @label@   The item label                   
+                        -> String -- ^ @text@    The item text                    
+                        -> Maybe Pixbuf -- ^ @icon@    The item icon or 'Nothing'
+                        -> String -- ^ @info@    The item extra information       
+                        -> IO SourceCompletionItem
+sourceCompletionItemNew label text icon info =
+  makeNewGObject mkSourceCompletionItem $
+  withUTFString label $ \ labelPtr -> 
+  withUTFString text $ \ textPtr -> 
+  withUTFString info $ \ infoPtr -> 
+  {#call gtk_source_completion_item_new #}
+    labelPtr
+    textPtr
+    (fromMaybe (Pixbuf nullForeignPtr) icon)
+    infoPtr
+  
+  
+-- | Create a new 'SourceCompletionItem' with markup label markup, icon icon and extra information
+-- info. Both icon and info can be 'Nothing' in which case there will be no icon shown and no extra
+-- information available.
+sourceCompletionItemNewWithMarkup :: String
+                                  -> String
+                                  -> Maybe Pixbuf
+                                  -> String
+                                  -> IO SourceCompletionItem
+sourceCompletionItemNewWithMarkup markup text icon info = 
+  makeNewGObject mkSourceCompletionItem $ 
+  withUTFString markup $ \ markupPtr -> 
+  withUTFString text $ \ textPtr -> 
+  withUTFString info $ \ infoPtr -> 
+  {#call gtk_source_completion_item_new_with_markup #}
+    markupPtr
+    textPtr
+    (fromMaybe (Pixbuf nullForeignPtr) icon)
+    infoPtr
+  
+-- | Creates a new 'SourceCompletionItem' from a stock item. If label is 'Nothing', the stock label will be
+-- used.
+sourceCompletionItemNewFromStock :: Maybe String -- ^ @label@   The item label or 'Nothing'
+                                 -> String -- ^ @text@    The item text                                  
+                                 -> String -- ^ @stock@   The stock icon                                 
+                                 -> String -- ^ @info@    The item extra information                     
+                                 -> IO SourceCompletionItem
+sourceCompletionItemNewFromStock label text stock info =
+  makeNewGObject mkSourceCompletionItem $
+  maybeWith withUTFString label $ \ labelPtr -> 
+  withUTFString text $ \ textPtr -> 
+  withUTFString stock $ \ stockPtr -> 
+  withUTFString info $ \ infoPtr -> 
+  {#call gtk_source_completion_item_new_from_stock #}
+    labelPtr
+    textPtr
+    stockPtr
+    infoPtr
+   
+-- | Icon to be shown for this proposal.
+sourceCompletionItemIcon :: SourceCompletionItemClass item => Attr item Pixbuf
+sourceCompletionItemIcon = newAttrFromObjectProperty "icon"
+                           {# call pure unsafe gdk_pixbuf_get_type #}
+
+-- | Optional extra information to be shown for this proposal.
+-- 
+-- Default value: \"\"
+sourceCompletionItemInfo :: SourceCompletionItemClass item => Attr item String
+sourceCompletionItemInfo = newAttrFromStringProperty "info"
+
+-- | Optional extra labelrmation to be shown for this proposal.
+-- 
+-- Default value: \"\"
+sourceCompletionItemLabel :: SourceCompletionItemClass item => Attr item String
+sourceCompletionItemLabel = newAttrFromStringProperty "label"
+
+-- | Optional extra markuprmation to be shown for this proposal.
+-- 
+-- Default value: \"\"
+sourceCompletionItemMarkup :: SourceCompletionItemClass item => Attr item String
+sourceCompletionItemMarkup = newAttrFromStringProperty "markup"
+
+-- | Optional extra textrmation to be shown for this proposal.
+-- 
+-- Default value: \"\"
+sourceCompletionItemText :: SourceCompletionItemClass item => Attr item String
+sourceCompletionItemText = newAttrFromStringProperty "text"
diff --git a/Graphics/UI/Gtk/SourceView/SourceCompletionProposal.chs b/Graphics/UI/Gtk/SourceView/SourceCompletionProposal.chs
new file mode 100644
--- /dev/null
+++ b/Graphics/UI/Gtk/SourceView/SourceCompletionProposal.chs
@@ -0,0 +1,133 @@
+{-# LANGUAGE CPP #-}
+-- -*-haskell-*-
+--  GIMP Toolkit (GTK) Widget SourceCompletionProposal
+--
+--  Author : Andy Stewart
+--
+--  Created: 08 Aug 2010
+--
+--  Copyright (C) 2010 Andy Stewart
+--
+--  This library is free software; you can redistribute it and/or
+--  modify it under the terms of the GNU Lesser General Public
+--  License as published by the Free Software Foundation; either
+--  version 2.1 of the License, or (at your option) any later version.
+--
+--  This library is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+--  Lesser General Public License for more details.
+--
+-- |
+-- Maintainer  : gtk2hs-users@lists.sourceforge.net
+-- Stability   : provisional
+-- Portability : portable (depends on GHC)
+--
+module Graphics.UI.Gtk.SourceView.SourceCompletionProposal (
+-- * Description
+-- | The proposal interface represents a completion item in the completion window. It provides
+-- information on how to display the completion item and what action should be taken when the
+-- completion item is activated.
+
+-- * Types
+   SourceCompletionProposal,
+   SourceCompletionProposalClass,
+
+-- * Methods
+   sourceCompletionProposalGetLabel,
+   sourceCompletionProposalGetMarkup,
+   sourceCompletionProposalGetText,
+   sourceCompletionProposalGetIcon,
+   sourceCompletionProposalGetInfo,
+   sourceCompletionProposalHash,
+   sourceCompletionProposalEqual,
+
+-- * Signals
+   sourceCompletionProposalChanged,
+) where
+
+import Control.Monad	(liftM)
+
+import System.Glib.Attributes
+import System.Glib.FFI
+import System.Glib.GObject	(makeNewGObject)
+import System.Glib.Properties
+import System.Glib.UTFString
+
+{#import Graphics.UI.Gtk.SourceView.Signals#}
+{#import Graphics.UI.Gtk.SourceView.Types#}
+
+{# context lib="gtk" prefix="gtk" #}
+
+-- | Gets the label of proposal. The label is shown in the list of proposals as plain text. If you need
+-- any markup (such as bold or italic text), you have to implement
+-- 'sourceCompletionProposalGetMarkup'.
+sourceCompletionProposalGetLabel :: SourceCompletionProposalClass scp => scp
+                                 -> IO String -- ^ returns  A new string containing the label of proposal. 
+sourceCompletionProposalGetLabel scp =
+  {#call gtk_source_completion_proposal_get_label #}
+    (toSourceCompletionProposal scp)
+  >>= peekUTFString
+
+-- | Gets the label of proposal with markup. The label is shown in the list of proposals and may contain
+-- markup. This will be used instead of 'sourceCompletionProposalGetLabel' if implemented.
+sourceCompletionProposalGetMarkup :: SourceCompletionProposalClass scp => scp
+                                  -> IO String -- ^ returns  A new string containing the label of proposal with markup. 
+sourceCompletionProposalGetMarkup scp =
+  {#call gtk_source_completion_proposal_get_markup #}
+    (toSourceCompletionProposal scp)
+  >>= peekUTFString
+
+-- | Gets the text of proposal. The text that is inserted into the text buffer when the proposal is
+-- activated by the default activation. You are free to implement a custom activation handler in the
+-- provider and not implement this function.
+sourceCompletionProposalGetText :: SourceCompletionProposalClass scp => scp
+                                -> IO String -- ^ returns  A new string containing the text of proposal. 
+sourceCompletionProposalGetText scp =
+  {#call gtk_source_completion_proposal_get_text #}
+    (toSourceCompletionProposal scp)
+  >>= peekUTFString
+
+-- | Gets the icon of proposal.
+sourceCompletionProposalGetIcon :: SourceCompletionProposalClass scp => scp
+                                -> IO Pixbuf -- ^ returns  The icon of proposal.         
+sourceCompletionProposalGetIcon scp =
+  makeNewGObject mkPixbuf $
+  {#call gtk_source_completion_proposal_get_icon #}
+    (toSourceCompletionProposal scp)
+
+-- | Gets extra information associated to the proposal. This information will be used to present the user
+-- with extra, detailed information about the selected proposal.
+sourceCompletionProposalGetInfo :: SourceCompletionProposalClass scp => scp
+                                -> IO String -- ^ returns  A new string containing extra information of proposal or empty if no extra information is associated to proposal.
+sourceCompletionProposalGetInfo scp =
+  {#call gtk_source_completion_proposal_get_info #}
+    (toSourceCompletionProposal scp)
+  >>= peekUTFString
+
+-- | Get the hash value of proposal. This is used to (together with 'sourceCompletionProposalEqual')
+-- to match proposals in the completion model. 
+sourceCompletionProposalHash :: SourceCompletionProposalClass scp => scp
+                             -> IO Int  -- ^ returns  The hash value of proposal    
+sourceCompletionProposalHash scp =
+  liftM fromIntegral $
+  {#call gtk_source_completion_proposal_hash #}
+    (toSourceCompletionProposal scp)
+
+-- | Get whether two proposal objects are the same. This is used to (together with
+-- 'sourceCompletionProposalHash') to match proposals in the completion model. 
+sourceCompletionProposalEqual :: (SourceCompletionProposalClass scp1, SourceCompletionProposalClass scp2) 
+                              => scp1
+                              -> scp2
+                              -> IO Bool  -- ^ returns  'True' if proposal and object are the same proposal 
+sourceCompletionProposalEqual scp1 scp2 =
+    liftM toBool $
+    {#call gtk_source_completion_proposal_equal #}
+      (toSourceCompletionProposal scp1)
+      (toSourceCompletionProposal scp2)
+
+-- | Emitted when the proposal has changed. The completion popup will react to this by updating the shown
+-- information.
+sourceCompletionProposalChanged :: SourceCompletionProposalClass scp => Signal scp (IO ())
+sourceCompletionProposalChanged = Signal $ connect_NONE__NONE "changed"
+
diff --git a/Graphics/UI/Gtk/SourceView/SourceCompletionProvider.chs b/Graphics/UI/Gtk/SourceView/SourceCompletionProvider.chs
new file mode 100644
--- /dev/null
+++ b/Graphics/UI/Gtk/SourceView/SourceCompletionProvider.chs
@@ -0,0 +1,182 @@
+{-# LANGUAGE CPP #-}
+-- -*-haskell-*-
+--  GIMP Toolkit (GTK) Widget SourceCompletionProvider
+--
+--  Author : Andy Stewart
+--
+--  Created: 08 Aug 2010
+--
+--  Copyright (C) 2010 Andy Stewart
+--
+--  This library is free software; you can redistribute it and/or
+--  modify it under the terms of the GNU Lesser General Public
+--  License as published by the Free Software Foundation; either
+--  version 2.1 of the License, or (at your option) any later version.
+--
+--  This library is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+--  Lesser General Public License for more details.
+--
+-- |
+-- Maintainer  : gtk2hs-users@lists.sourceforge.net
+-- Stability   : provisional
+-- Portability : portable (depends on GHC)
+--
+module Graphics.UI.Gtk.SourceView.SourceCompletionProvider (
+-- * Description
+-- | You must implement this interface to provide proposals to 'SourceCompletion'
+
+-- * Types  
+   SourceCompletionProvider,
+   SourceCompletionProviderClass,
+
+-- * Methods
+   sourceCompletionProviderGetName,
+   sourceCompletionProviderGetIcon,
+   sourceCompletionProviderGetInteractiveDelay,
+   sourceCompletionProviderGetPriority,
+   sourceCompletionProviderGetInfoWidget,
+   sourceCompletionProviderGetActivation,
+   sourceCompletionProviderGetStartIter,
+   sourceCompletionProviderMatch,
+   sourceCompletionProviderUpdateInfo,
+   sourceCompletionProviderPopulate,
+   sourceCompletionProviderActivateProposal,
+) where
+
+import Control.Monad	(liftM)
+
+import Graphics.UI.Gtk.Abstract.Object	(makeNewObject)
+import Graphics.UI.Gtk.SourceView.Enums
+import System.Glib.Attributes
+import System.Glib.FFI
+import System.Glib.GObject	(makeNewGObject)
+import System.Glib.Properties
+import System.Glib.UTFString
+
+{#import Graphics.UI.Gtk.SourceView.Signals#}
+{#import Graphics.UI.Gtk.SourceView.Types#}
+
+{# context lib="gtk" prefix="gtk" #}
+
+-- | Get the name of the provider. This should be a translatable name for display to the user. For
+-- example: _("Document word completion provider"). 
+sourceCompletionProviderGetName :: SourceCompletionProviderClass scp => scp 
+                                -> IO String -- ^ returns  A new string containing the name of the provider. 
+sourceCompletionProviderGetName scp =
+  {#call gtk_source_completion_provider_get_name #}
+    (toSourceCompletionProvider scp)
+  >>= peekUTFString
+
+-- | Get the icon of the provider.
+sourceCompletionProviderGetIcon :: SourceCompletionProviderClass scp => scp 
+                                -> IO (Maybe Pixbuf)
+sourceCompletionProviderGetIcon scp =
+  maybeNull (makeNewGObject mkPixbuf) $
+  {#call gtk_source_completion_provider_get_icon #}
+    (toSourceCompletionProvider scp)
+
+-- | Get the delay in milliseconds before starting interactive completion for this provider. A value of
+-- -1 indicates to use the default value as set by 'autoCompleteDelay'.
+sourceCompletionProviderGetInteractiveDelay :: SourceCompletionProviderClass scp => scp 
+                                            -> IO Int -- ^ returns  the interactive delay in milliseconds. 
+sourceCompletionProviderGetInteractiveDelay scp =
+  liftM fromIntegral $
+  {#call gtk_source_completion_provider_get_interactive_delay #}
+     (toSourceCompletionProvider scp)
+
+-- | Get the provider priority. The priority determines the order in which proposals appear in the
+-- completion popup. Higher priorities are sorted before lower priorities. The default priority is 0.
+sourceCompletionProviderGetPriority :: SourceCompletionProviderClass scp => scp 
+                                    -> IO Int -- ^ returns  the provider priority.          
+sourceCompletionProviderGetPriority scp =
+  liftM fromIntegral $
+  {#call gtk_source_completion_provider_get_priority #}
+    (toSourceCompletionProvider scp)
+  
+-- | Get a customized info widget to show extra information of a proposal. This allows for customized
+-- widgets on a proposal basis, although in general providers will have the same custom widget for all
+-- their proposals and proposal can be ignored.  The implementation of this function is optional. If
+-- implemented, 'sourceCompletionProviderUpdateInfo' MUST also be implemented. If not
+-- implemented, the default 'sourceCompletionProposalGetInfo' will be used to display extra
+-- information about a 'SourceCompletionProposal'.
+sourceCompletionProviderGetInfoWidget :: SourceCompletionProviderClass scp => scp
+                                      -> SourceCompletionProposal -- ^ @proposal@ The currently selected 'SourceCompletionProposal'           
+                                     -> IO Widget -- ^ returns  a custom 'Widget' to show extra information about proposal. 
+sourceCompletionProviderGetInfoWidget scp proposal =
+  makeNewObject mkWidget $
+  {#call gtk_source_completion_provider_get_info_widget #}
+    (toSourceCompletionProvider scp)
+    proposal
+
+-- | Get with what kind of activation the provider should be activated.
+sourceCompletionProviderGetActivation :: SourceCompletionProviderClass scp => scp
+                                      -> IO SourceCompletionActivation
+sourceCompletionProviderGetActivation scp =
+    liftM (toEnum . fromIntegral) $
+    {#call gtk_source_completion_provider_get_activation #}
+      (toSourceCompletionProvider scp)
+
+-- | Get the 'TextIter' at which the completion for proposal starts. When implemented, the completion
+-- can use this information to position the completion window accordingly when a proposal is selected
+-- in the completion window.
+sourceCompletionProviderGetStartIter :: SourceCompletionProviderClass scp => scp
+                                     -> SourceCompletionContext
+                                     -> SourceCompletionProposal
+                                     -> IO (Maybe TextIter)
+sourceCompletionProviderGetStartIter scp context proposal = do
+  iter <- makeEmptyTextIter
+  success <- liftM toBool $ {#call gtk_source_completion_provider_get_start_iter #}
+                (toSourceCompletionProvider scp)
+                context
+                proposal
+                iter
+  if success 
+     then return (Just iter)
+     else return Nothing
+
+-- | Get whether the provider match the context of completion detailed in context.
+sourceCompletionProviderMatch :: SourceCompletionProviderClass scp => scp
+                              -> SourceCompletionContext
+                              -> IO Bool  -- ^ returns  'True' if provider matches the completion context, 'False' otherwise
+sourceCompletionProviderMatch scp context =
+  liftM toBool $
+  {#call gtk_source_completion_provider_match #}
+   (toSourceCompletionProvider scp)
+   context
+
+-- | Update extra information shown in info for proposal. This should be implemented if your provider
+-- sets a custom info widget for proposal. This function MUST be implemented when
+-- 'sourceCompletionProviderGetInfoWidget' is implemented.
+sourceCompletionProviderUpdateInfo :: SourceCompletionProviderClass scp => scp
+                                   -> SourceCompletionProposal
+                                   -> SourceCompletionInfo
+                                   -> IO ()
+sourceCompletionProviderUpdateInfo scp proposal info =
+  {#call gtk_source_completion_provider_update_info #}
+    (toSourceCompletionProvider scp)
+    proposal
+    info
+
+-- | Populate context with proposals from provider
+sourceCompletionProviderPopulate :: SourceCompletionProviderClass scp => scp
+                                 -> SourceCompletionContext
+                                 -> IO ()
+sourceCompletionProviderPopulate scp context =
+  {#call gtk_source_completion_provider_populate #}
+     (toSourceCompletionProvider scp)
+     context
+
+-- | Activate proposal at iter. When this functions returns 'False', the default activation of proposal
+-- will take place which replaces the word at iter with the label of proposal.
+sourceCompletionProviderActivateProposal :: SourceCompletionProviderClass scp => scp
+                                         -> SourceCompletionProposal
+                                         -> TextIter
+                                         -> IO Bool -- ^ returns  'True' to indicate that the proposal activation has been handled, 'False' otherwise.
+sourceCompletionProviderActivateProposal scp proposal iter =
+  liftM toBool $
+  {#call gtk_source_completion_provider_activate_proposal #}
+    (toSourceCompletionProvider scp)
+    proposal
+    iter
diff --git a/Graphics/UI/Gtk/SourceView/SourceGutter.chs b/Graphics/UI/Gtk/SourceView/SourceGutter.chs
new file mode 100644
--- /dev/null
+++ b/Graphics/UI/Gtk/SourceView/SourceGutter.chs
@@ -0,0 +1,152 @@
+{-# LANGUAGE CPP #-}
+-- -*-haskell-*-
+--  GIMP Toolkit (GTK) Widget SourceGutter
+--
+--  Author : Andy Stewart
+--
+--  Created: 08 Aug 2010
+--
+--  Copyright (C) 2010 Andy Stewart
+--
+--  This library is free software; you can redistribute it and/or
+--  modify it under the terms of the GNU Lesser General Public
+--  License as published by the Free Software Foundation; either
+--  version 2.1 of the License, or (at your option) any later version.
+--
+--  This library is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+--  Lesser General Public License for more details.
+--
+-- |
+-- Maintainer  : gtk2hs-users@lists.sourceforge.net
+-- Stability   : provisional
+-- Portability : portable (depends on GHC)
+--
+module Graphics.UI.Gtk.SourceView.SourceGutter (
+-- * Description
+-- | The 'SourceGutter' object represents the left and right gutters of the text view. It is used by
+-- 'SourceView' to draw the line numbers and category marks that might be present on a line. By
+-- packing additional 'CellRenderer' objects in the gutter, you can extend the gutter with your own
+-- custom drawings.
+-- 
+-- The gutter works very much the same way as cells rendered in a 'TreeView'. The concept is similar,
+-- with the exception that the gutter does not have an underlying 'TreeModel'. Instead, you should use
+-- 'sourceGutterSetCellDataFunc' to set a callback to fill in any of the cell renderers
+-- properties, given the line for which the cell is to be rendered. Renderers are inserted into the
+-- gutter at a certain position. 
+-- The builtin line number renderer is at position
+-- 'SourceViewGutterPositionLines (-30)' and the marks renderer is at
+-- 'SourceViewGutterPositionMarks (-20)'. You can use these values to position custom renderers
+-- accordingly. The width of a cell renderer can be specified as either fixed (using
+-- 'cellRendererSetFixedSize') or dynamic, in which case you must set
+-- 'sourceGutterSetCellSizeFunc'. This callback is used to set the properties of the renderer
+-- such that @gtkCellRendererGetSize@ yields the maximum width of the cell.
+
+-- * Types
+    SourceGutter,
+    SourceGutterClass,
+
+-- * Methods
+    sourceGutterGetWindow,
+    sourceGutterInsert,
+    sourceGutterReorder,
+    sourceGutterRemove,
+    sourceGutterQueueDraw,
+
+-- * Attributes
+    sourceGutterView,
+    sourceGutterWindowType,
+
+-- * Signals
+    sourceGutterCellActivated,
+    sourceGutterQueryTooltip,
+) where
+
+import Control.Monad	(liftM)
+import Control.Monad.Reader ( runReaderT )
+
+import Graphics.UI.Gtk.Gdk.EventM (EventM, EAny)
+import Graphics.UI.Gtk.Multiline.TextView (TextWindowType (..))
+import Graphics.UI.GtkInternals  ( TextIter, mkTextIterCopy )
+import System.Glib.Attributes
+import System.Glib.FFI
+import System.Glib.GObject	(makeNewGObject)
+import System.Glib.Properties
+import System.Glib.UTFString
+
+{#import Graphics.UI.Gtk.SourceView.Signals#}
+{#import Graphics.UI.Gtk.SourceView.Types#}
+
+{# context lib="gtk" prefix="gtk" #}
+
+-- | Get the 'Window' of the gutter. The window will only be available when the gutter has at least one,
+-- non-zero width, cell renderer packed.
+sourceGutterGetWindow :: SourceGutterClass sg => sg -> IO (Maybe DrawWindow)
+sourceGutterGetWindow sb =
+    maybeNull (makeNewGObject mkDrawWindow) $
+    {#call gtk_source_gutter_get_window #} (toSourceGutter sb)
+
+-- | Inserts renderer into gutter at position.
+sourceGutterInsert :: (CellRendererClass cell, SourceGutterClass sg) => sg
+                   -> cell -- ^ @renderer@ a 'CellRenderer'      
+                   -> Int -- ^ @position@ the renderers position 
+                   -> IO ()
+sourceGutterInsert gutter renderer position =
+  {#call gtk_source_gutter_insert #}
+     (toSourceGutter gutter)
+     (toCellRenderer renderer)
+     (fromIntegral position)
+
+-- | Reorders renderer in gutter to new position.
+sourceGutterReorder :: (CellRendererClass cell, SourceGutterClass sg) => sg
+                    -> cell -- ^ @renderer@ a 'CellRenderer'         
+                    -> Int -- ^ @position@ the new renderer position 
+                    -> IO ()
+sourceGutterReorder gutter renderer position =
+  {#call gtk_source_gutter_reorder #}
+     (toSourceGutter gutter)
+     (toCellRenderer renderer)
+     (fromIntegral position)
+
+-- | Removes renderer from gutter.
+sourceGutterRemove :: (CellRendererClass cell, SourceGutterClass sg) => sg
+                   -> cell -- ^ @renderer@ a 'CellRenderer' 
+                   -> IO ()
+sourceGutterRemove gutter renderer =
+  {#call gtk_source_gutter_remove #}
+     (toSourceGutter gutter)
+     (toCellRenderer renderer)
+
+-- | Invalidates the drawable area of the gutter. You can use this to force a redraw of the gutter if
+-- something has changed and needs to be redrawn.
+sourceGutterQueueDraw :: SourceGutterClass sg => sg -> IO ()
+sourceGutterQueueDraw sb =
+  {#call gtk_source_gutter_queue_draw #} (toSourceGutter sb)
+
+-- | The 'SourceView' of the gutter
+sourceGutterView :: SourceGutterClass sg => Attr sg SourceView
+sourceGutterView = newAttrFromObjectProperty "view"
+                   {#call pure unsafe gtk_source_view_get_type #}
+
+-- | The text window type on which the window is placed
+-- 
+-- Default value: 'TextWindowPrivate'
+sourceGutterWindowType :: SourceGutterClass sg => Attr sg TextWindowType
+sourceGutterWindowType = newAttrFromEnumProperty "window-type"
+                         {#call pure unsafe gtk_text_window_type_get_type #}
+                         
+-- | Emitted when a cell has been activated (for instance when there was a button press on the cell). The
+-- signal is only emitted for cells that have the activatable property set to 'True'.
+sourceGutterCellActivated :: SourceGutterClass sg => Signal sg (CellRenderer -> TextIter -> EventM EAny ())                         
+sourceGutterCellActivated =
+  Signal (\after obj fun -> 
+           connect_OBJECT_PTR_BOXED__NONE "cell-activated" mkTextIterCopy after obj
+                                   (\cr eventPtr iter -> runReaderT (fun cr iter) eventPtr)
+         )
+
+-- | Emitted when a tooltip is requested for a specific cell. Signal handlers can return 'True' to notify
+-- the tooltip has been handled.
+sourceGutterQueryTooltip :: SourceGutterClass sg => Signal sg (CellRenderer -> TextIter -> Tooltip -> IO Bool)
+sourceGutterQueryTooltip = 
+    Signal $ connect_OBJECT_BOXED_OBJECT__BOOL "query-tooltip" mkTextIterCopy
diff --git a/Graphics/UI/Gtk/SourceView/SourceIter.chs b/Graphics/UI/Gtk/SourceView/SourceIter.chs
--- a/Graphics/UI/Gtk/SourceView/SourceIter.chs
+++ b/Graphics/UI/Gtk/SourceView/SourceIter.chs
@@ -30,7 +30,10 @@
 -- * There is no SourceIter object, just extra methods for "TextIter"
 --
 module Graphics.UI.Gtk.SourceView.SourceIter (
+-- * Enums
   SourceSearchFlags(..),
+
+-- * Methods
   sourceIterForwardSearch,
   sourceIterBackwardSearch,
 ) where
@@ -38,24 +41,32 @@
 import Control.Monad	(liftM)
 import Data.Maybe    (fromMaybe)
 
+import Graphics.UI.Gtk.Abstract.Object	(makeNewObject)
+import Graphics.UI.Gtk.SourceView.Enums
 import System.Glib.FFI
 import System.Glib.Flags		(Flags, fromFlags)
 import System.Glib.UTFString
-import Graphics.UI.Gtk.Abstract.Object	(makeNewObject)
-{#import Graphics.UI.Gtk.SourceView.Types#}
+
 {#import Graphics.UI.Gtk.Multiline.TextIter#}
+{#import Graphics.UI.Gtk.SourceView.Types#}
 
 {# context lib="gtk" prefix="gtk" #}
 
-{# enum SourceSearchFlags {underscoreToCase} deriving(Eq,Bounded,Show,Read) #}
-
-instance Flags SourceSearchFlags
-
 -- methods
 
--- | same as 'textIterForwardSearch' but allows
--- case insensitive search and possibly in the future regular expressions.
---
+-- | Searches forward for str. Any match is returned by setting @matchStart@ to the first character of the
+-- match and @matchEnd@ to the first character after the match. The search will not continue past
+-- limit. Note that a search is a linear or O(n) operation, so you may wish to use limit to avoid
+-- locking up your UI on large buffers.
+-- 
+-- If the 'SourceSearchVisibleOnly' flag is present, the match may have invisible text
+-- interspersed in str. i.e. str will be a possibly-noncontiguous subsequence of the matched
+-- range. similarly, if you specify 'SourceSearchTextOnly', the match may have pixbufs or child
+-- widgets mixed inside the matched range. If these flags are not given, the match must be exact; the
+-- special 0xFFFC character in str will match embedded pixbufs or child widgets. If you specify the
+-- 'SourceSearchCaseInsensitive' flag, the text will be matched regardless of what case it is in.
+-- 
+-- Same as 'textIterForwardSearch', but supports case insensitive searching.
 sourceIterForwardSearch :: TextIter -> String -> [SourceSearchFlags] -> 
                            Maybe TextIter -> IO (Maybe (TextIter, TextIter))
 sourceIterForwardSearch ti str flags limit = do
diff --git a/Graphics/UI/Gtk/SourceView/SourceLanguage.chs b/Graphics/UI/Gtk/SourceView/SourceLanguage.chs
--- a/Graphics/UI/Gtk/SourceView/SourceLanguage.chs
+++ b/Graphics/UI/Gtk/SourceView/SourceLanguage.chs
@@ -2,12 +2,13 @@
 -- -*-haskell-*-
 --  GIMP Toolkit (GTK) Widget SourceView
 --
---  Author : Peter Gavin
+--  Author : Peter Gavin, Andy Stewart
 --  derived from sourceview bindings by Axel Simon and Duncan Coutts
 --
 --  Created: 18 December 2008
 --
 --  Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon
+--  Copyright (C) Andy Stewart
 --
 --  This library is free software; you can redistribute it and/or
 --  modify it under the terms of the GNU Lesser General Public
@@ -25,8 +26,16 @@
 -- Portability : portable (depends on GHC)
 --
 module Graphics.UI.Gtk.SourceView.SourceLanguage (
+-- * Description
+-- | 'SourceLanguage' encapsulates syntax and highlighting styles for a particular language. Use
+-- 'SourceLanguageManager' to obtain a 'SourceLanguage' instance, and
+-- 'sourceBufferSetLanguage' to apply it to a 'SourceBuffer'.
+
+-- * Types
   SourceLanguage,
   SourceLanguageClass,
+
+-- * Methods
   castToSourceLanguage,
   sourceLanguageGetId,
   sourceLanguageGetName,
@@ -35,6 +44,10 @@
   sourceLanguageGetMetadata,
   sourceLanguageGetMimeTypes,
   sourceLanguageGetGlobs,
+  sourceLanguageGetStyleName,
+  sourceLanguageGetStyleIds,
+
+-- * Attributes
   sourceLanguageHidden,
   sourceLanguageId,
   sourceLanguageName,
@@ -44,82 +57,123 @@
 import Control.Monad	(liftM)
 import Data.Maybe (fromMaybe)
 
+import System.Glib.Attributes
 import System.Glib.FFI
 import System.Glib.UTFString
-{#import System.Glib.Properties#}
-import System.Glib.Attributes
-{#import Graphics.UI.Gtk.SourceView.Types#}
+
 {#import Graphics.UI.Gtk.SourceView.SourceStyleScheme#}
+{#import Graphics.UI.Gtk.SourceView.Types#}
+{#import System.Glib.Properties#}
 
 {# context lib="gtk" prefix="gtk" #}
 
-
 -- methods
 
--- | 
+-- | Returns the ID of the language. The ID is not locale-dependent.
 --
-sourceLanguageGetId :: SourceLanguage -> IO String
+sourceLanguageGetId :: SourceLanguageClass sl => sl
+                    -> IO String -- ^ returns  the ID of language. The returned string is owned by language and should not be freed or modified.
 sourceLanguageGetId sl =
-  {#call unsafe source_language_get_id#} sl >>= peekUTFString
+  {#call unsafe source_language_get_id#} (toSourceLanguage sl) >>= peekUTFString
 
--- | 
+-- | Returns the localized name of the language.
 --
-sourceLanguageGetName :: SourceLanguage -> IO String
+sourceLanguageGetName :: SourceLanguageClass sl => sl 
+                      -> IO String -- ^ returns  the name of language. The returned string is owned by language and should not be freed or modified.
 sourceLanguageGetName sl =
-  {#call unsafe source_language_get_name#} sl >>= peekUTFString
+  {#call unsafe source_language_get_name#} (toSourceLanguage sl) >>= peekUTFString
 
--- | 
+-- | Returns the localized section of the language. Each language belong to a section (ex. HTML belogs to
+-- the Markup section).
 --
-sourceLanguageGetSection :: SourceLanguage -> IO String
+sourceLanguageGetSection :: SourceLanguageClass sl => sl 
+                         -> IO String -- ^ returns  the section of language. The returned string is owned by language and should not be freed or modified.
 sourceLanguageGetSection sl =
-  {#call unsafe source_language_get_section#} sl >>= peekUTFString
+  {#call unsafe source_language_get_section#} (toSourceLanguage sl) >>= peekUTFString
 
--- |
+-- | Returns whether the language should be hidden from the user.
 --
-sourceLanguageGetHidden :: SourceLanguage -> IO Bool
+sourceLanguageGetHidden :: SourceLanguageClass sl => sl 
+                        -> IO Bool -- ^ returns  'True' if the language should be hidden, 'False' otherwise. 
 sourceLanguageGetHidden sl = liftM toBool $
-  {#call unsafe source_language_get_hidden#} sl
+  {#call unsafe source_language_get_hidden#} (toSourceLanguage sl)
 
 -- |
 --
-sourceLanguageGetMetadata :: SourceLanguage -> String -> IO String
+sourceLanguageGetMetadata :: SourceLanguageClass sl => sl 
+                          -> String  -- ^ @name@     metadata property name.
+                          -> IO String -- ^ returns  value of property name stored in the metadata of language or empty if language doesn't contain that metadata
 sourceLanguageGetMetadata sl name = do
-  withUTFString name ({#call unsafe source_language_get_metadata#} sl) >>= peekUTFString
+  withUTFString name ({#call unsafe source_language_get_metadata#} (toSourceLanguage sl)) >>= peekUTFString
 
--- |
+-- | Returns the mime types associated to this language. This is just an utility wrapper around
+-- 'sourceLanguageGetMetadata ' to retrieve the "mimetypes" metadata property and split it into
+-- an array.
 --
-sourceLanguageGetMimeTypes :: SourceLanguage -> IO [String]
+sourceLanguageGetMimeTypes :: SourceLanguageClass sl => sl 
+                           -> IO [String] -- ^ returns  an array containing the mime types or empty if no mime types are found. The        
 sourceLanguageGetMimeTypes sl = do
-  mimeTypesArray <- {#call unsafe source_language_get_mime_types#} sl
+  mimeTypesArray <- {#call unsafe source_language_get_mime_types#} (toSourceLanguage sl)
   mimeTypes <- liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 mimeTypesArray
   {# call g_strfreev #} mimeTypesArray
   return mimeTypes
 
--- |
+-- | Returns the globs associated to this language. This is just an utility wrapper around
+-- 'sourceLanguageGetMetadata' to retrieve the "globs" metadata property and split it into an
+-- array.
 --
-sourceLanguageGetGlobs :: SourceLanguage -> IO [String]
+sourceLanguageGetGlobs :: SourceLanguageClass sl => sl 
+                       -> IO [String] -- ^ returns  an array containing the globs or empty if no globs are found. 
 sourceLanguageGetGlobs sl = do
-  globsArray <- {#call unsafe source_language_get_globs#} sl
+  globsArray <- {#call unsafe source_language_get_globs#} (toSourceLanguage sl)
   globs <- liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 globsArray
   {# call g_strfreev #} globsArray
   return globs
 
--- |
+-- | Returns the name of the style with ID @styleId@ defined by this language.
+sourceLanguageGetStyleName :: SourceLanguageClass sl => sl 
+                           -> String -- ^ @styleId@ a style ID
+                           -> IO String  -- ^ returns the name of the style with ID @styleId@ defined by this language or empty if the style has no name or there is no style with ID @styleId@ defined by this language. The returned string is owned by the language and must not be modified.
+sourceLanguageGetStyleName sl styleId =
+    withUTFString styleId $ \styleIdPtr ->
+    {#call gtk_source_language_get_style_name#}
+       (toSourceLanguage sl)
+       styleIdPtr
+    >>= peekUTFString
+
+-- | Returns the ids of the styles defined by this language.
+sourceLanguageGetStyleIds :: SourceLanguageClass sl => sl 
+                          -> IO [String] -- ^ returns  an array containing ids of the styles defined by this language or empty if no style is defined. 
+sourceLanguageGetStyleIds sl = do
+  globsArray <- {#call gtk_source_language_get_style_ids#} (toSourceLanguage sl)
+  globs <- liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 globsArray
+  {# call g_strfreev #} globsArray
+  return globs
+
+-- | Whether the language should be hidden from the user.
+-- 
+-- Default value: 'False'
 --
-sourceLanguageHidden :: ReadAttr SourceLanguage Bool
+sourceLanguageHidden :: SourceLanguageClass sl => ReadAttr sl Bool
 sourceLanguageHidden = readAttrFromBoolProperty "hidden"
 
--- |
+-- | Language id.
+-- 
+-- Default value: \"\"
 --
-sourceLanguageId :: ReadAttr SourceLanguage String
+sourceLanguageId :: SourceLanguageClass sl => ReadAttr sl String
 sourceLanguageId = readAttrFromStringProperty "id"
 
--- |
+-- | Language name.
+-- 
+-- Default value: \"\"
 --
-sourceLanguageName :: ReadAttr SourceLanguage String
+sourceLanguageName :: SourceLanguageClass sl => ReadAttr sl String
 sourceLanguageName = readAttrFromStringProperty "name"
 
--- |
+-- | Language section.
+-- 
+-- Default value: \"\"
 --
-sourceLanguageSection :: ReadAttr SourceLanguage String
+sourceLanguageSection :: SourceLanguageClass sl => ReadAttr sl String
 sourceLanguageSection = readAttrFromStringProperty "section"
diff --git a/Graphics/UI/Gtk/SourceView/SourceLanguageManager.chs b/Graphics/UI/Gtk/SourceView/SourceLanguageManager.chs
--- a/Graphics/UI/Gtk/SourceView/SourceLanguageManager.chs
+++ b/Graphics/UI/Gtk/SourceView/SourceLanguageManager.chs
@@ -2,12 +2,13 @@
 -- -*-haskell-*-
 --  GIMP Toolkit (GTK) Widget SourceView
 --
---  Author : Peter Gavin
+--  Author : Peter Gavin, Andy Stewart
 --  derived from sourceview bindings by Axel Simon and Duncan Coutts
 --
 --  Created: 18 December 2008
 --
 --  Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon
+--  Copyright (C) 2010 Andy Stewart
 --
 --  This library is free software; you can redistribute it and/or
 --  modify it under the terms of the GNU Lesser General Public
@@ -25,8 +26,18 @@
 -- Portability : portable (depends on GHC)
 --
 module Graphics.UI.Gtk.SourceView.SourceLanguageManager (
+-- * Description
+-- | 'SourceLanguageManager' is an object which processes language description files and creates and
+-- stores 'SourceLanguage' objects, and provides API to access them. Use
+-- 'sourceLanguageManagerGetDefault' to retrieve the default instance of
+-- 'SourceLanguageManager', and 'sourceLanguageManagerGuessLanguage' to get a
+-- 'SourceLanguage' for given file name and content type.
+
+-- * Types
   SourceLanguageManager,
   SourceLanguageManagerClass,
+
+-- * Methods
   castToSourceLanguageManager,
   sourceLanguageManagerNew,
   sourceLanguageManagerGetDefault,
@@ -34,88 +45,105 @@
   sourceLanguageManagerGetSearchPath,
   sourceLanguageManagerGetLanguageIds,
   sourceLanguageManagerGetLanguage,
-  sourceLanguageManagerGuessLanguage
+  sourceLanguageManagerGuessLanguage,
+
+-- * Attributes
+  sourceLanguageManagerLanguageIds,
+  sourceLanguageManagerSearchPath,
   ) where
 
 import Control.Monad	(liftM)
 import Data.Maybe (fromMaybe)
 
+import System.Glib.Attributes
 import System.Glib.FFI
 import System.Glib.GObject (constructNewGObject, makeNewGObject)
-import System.Glib.UTFString
-import System.Glib.Attributes
 import System.Glib.Properties
+import System.Glib.UTFString
+
 {#import Graphics.UI.Gtk.SourceView.Types#}
 
 {# context lib="gtk" prefix="gtk" #}
 
-{# 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 :: SourceLanguageManagerClass slm => slm -> Maybe [String] -> IO ()
 sourceLanguageManagerSetSearchPath slm dirs =
   maybeWith withUTFStringArray0 dirs $ \dirsPtr -> do
-    {#call unsafe source_language_manager_set_search_path#} slm dirsPtr
+    {#call unsafe source_language_manager_set_search_path#} (toSourceLanguageManager slm) dirsPtr
 
--- |
+-- | Gets the list directories where lm looks for language files.
 --
-sourceLanguageManagerGetSearchPath :: SourceLanguageManager -> IO [String]
+sourceLanguageManagerGetSearchPath :: SourceLanguageManagerClass slm => slm -> IO [String]
 sourceLanguageManagerGetSearchPath slm = do
-  dirsPtr <- {#call unsafe source_language_manager_get_search_path#} slm
+  dirsPtr <- {#call unsafe source_language_manager_get_search_path#} (toSourceLanguageManager slm)
   liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 dirsPtr
 
--- |
+-- | Returns the ids of the available languages.
 --
-sourceLanguageManagerGetLanguageIds :: SourceLanguageManager -> IO [String]
+sourceLanguageManagerGetLanguageIds :: SourceLanguageManagerClass slm => slm -> IO [String]
 sourceLanguageManagerGetLanguageIds slm = do
-  idsPtr <- {#call unsafe source_language_manager_get_language_ids#} slm
+  idsPtr <- {#call unsafe source_language_manager_get_language_ids#} (toSourceLanguageManager slm)
   liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 idsPtr
 
--- |
+-- | Gets the 'SourceLanguage' identified by the given id in the language manager.
 --
-sourceLanguageManagerGetLanguage :: SourceLanguageManager -> String -> IO (Maybe SourceLanguage)
+sourceLanguageManagerGetLanguage :: SourceLanguageManagerClass slm => slm 
+                                 -> 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)
+    withUTFString id ({#call unsafe source_language_manager_get_language#} (toSourceLanguageManager slm))
   if slPtr /= nullPtr
     then liftM Just $ makeNewGObject mkSourceLanguage $ return slPtr
     else return Nothing
 
--- |
+-- | Picks a 'SourceLanguage' for given file name and content type, according to the information in lang
+-- files. Either filename or @contentType@ may be 'Nothing'.
 --
-sourceLanguageManagerGuessLanguage :: SourceLanguageManager -> Maybe String -> Maybe String -> IO (Maybe SourceLanguage)
+sourceLanguageManagerGuessLanguage :: SourceLanguageManagerClass slm => slm 
+                                   -> Maybe String  -- ^ @filename@     a filename in Glib filename encoding, or 'Nothing'.
+                                   -> Maybe String  -- ^ @contentType@ a content type (as in GIO API), or 'Nothing'.
+                                   -> IO (Maybe SourceLanguage) -- ^ returns      a 'SourceLanguage', or 'Nothing' if there is no suitable language for given filename and/or @contentType@. 
 sourceLanguageManagerGuessLanguage slm filename contentType =
   maybeWith withUTFString filename $ \cFilename ->
   maybeWith withUTFString contentType $ \cContentType -> do
     slPtr <- liftM castPtr $
-      {#call unsafe source_language_manager_guess_language#} slm cFilename cContentType
+      {#call unsafe source_language_manager_guess_language#} (toSourceLanguageManager slm) cFilename cContentType
     if slPtr /= nullPtr
       then liftM Just $ makeNewGObject mkSourceLanguage $ return slPtr
       else return Nothing
 
--- |
+-- | List of the ids of the available languages.
 --
-sourceLanguageManagerLanguageIds :: ReadAttr SourceLanguageManager [String]
+sourceLanguageManagerLanguageIds :: SourceLanguageManagerClass slm => ReadAttr slm [String]
 sourceLanguageManagerLanguageIds =
   readAttrFromBoxedOpaqueProperty (liftM (fromMaybe []) . maybePeek peekUTFStringArray0 . castPtr)
                                   "language-ids" {#call pure g_strv_get_type#}
 
--- |
+-- | List of directories where the language specification files (.lang) are located.
 --
-sourceLanguageManagerSearchPath :: ReadWriteAttr SourceLanguageManager [String] (Maybe [String])
+sourceLanguageManagerSearchPath :: SourceLanguageManagerClass slm => ReadWriteAttr slm [String] (Maybe [String])
 sourceLanguageManagerSearchPath =
   newAttr (objectGetPropertyBoxedOpaque (peekUTFStringArray0 . castPtr) gtype "search-path")
           (objectSetPropertyBoxedOpaque (\dirs f -> maybeWith withUTFStringArray0 dirs (f . castPtr)) gtype "search-path")
diff --git a/Graphics/UI/Gtk/SourceView/SourceMark.chs b/Graphics/UI/Gtk/SourceView/SourceMark.chs
--- a/Graphics/UI/Gtk/SourceView/SourceMark.chs
+++ b/Graphics/UI/Gtk/SourceView/SourceMark.chs
@@ -2,12 +2,13 @@
 -- -*-haskell-*-
 --  GIMP Toolkit (GTK) SourceMark
 --
---  Author : Duncan Coutts
+--  Author : Duncan Coutts, Andy Stewart
 --  derived from GtkTextView bindings by Axel Simon
 --
 --  Created: 26 October 2003
 --
 --  Copyright (C) 2003-2005 Duncan Coutts, Axel Simon
+--  Copyright (C) 2010 Andy Stewart
 --
 --  This library is free software; you can redistribute it and/or
 --  modify it under the terms of the GNU Lesser General Public
@@ -25,42 +26,98 @@
 -- Portability : portable (depends on GHC)
 --
 module Graphics.UI.Gtk.SourceView.SourceMark (
+-- * Description
+-- | A 'SourceMark' marks a position in the text where you want to display additional info. It is based
+-- on 'TextMark' and thus is still valid after the text has changed though its position may change.
+-- 
+-- 'SourceMarks' are organised in categories which you have to set when you create the mark. Each
+-- category can have a pixbuf and a priority associated using @gtkSourceViewSetMarkCategoryPixbuf@
+-- and @gtkSourceViewSetMarkCategoryPriority@. The pixbuf will be displayed in the margin at the
+-- line where the mark residents if the 'showLineMarks' property is set to 'True'. If there are
+-- multiple marks in the same line, the pixbufs will be drawn on top of each other. The mark with the
+-- highest priority will be drawn on top.
+
+-- * Types
   SourceMark,
+  SourceMarkClass,
+
+-- * Methods
   castToSourceMark,
+  sourceMarkNew,
   sourceMarkGetCategory,
   sourceMarkNext,
-  sourceMarkPrev
+  sourceMarkPrev,
+
+-- * Attributes
+  sourceMarkCategory
 ) where
 
 import Control.Monad	(liftM)
 
+import System.Glib.Attributes
 import System.Glib.FFI
-import System.Glib.UTFString
 import System.Glib.GObject	(makeNewGObject)
+import System.Glib.Properties
+import System.Glib.UTFString
+
 {#import Graphics.UI.Gtk.SourceView.Types#}
 
 {# context lib="gtk" prefix="gtk" #}
 
 -- methods
 
--- | 
+-- | Creates a text mark. Add it to a buffer using 'textBufferAddMark'. If name is 'Nothing', the mark
+-- is anonymous; otherwise, the mark can be retrieved by name using
+-- 'textBufferGetMark'. Normally marks are created using the utility function
+-- 'sourceBufferCreateMark'.
+sourceMarkNew :: Maybe String -- ^ @name@     Name of the 'SourceMark', can be 'Nothing' when not using a name
+              -> String  -- ^ @category@ is used to classify marks according to common characteristics (e.g. all the marks representing a bookmark could  
+              -> IO SourceMark
+sourceMarkNew name category = 
+  makeNewGObject mkSourceMark $
+  maybeWith withUTFString name $ \namePtr ->
+  withUTFString category $ \categoryPtr ->
+  {#call gtk_source_mark_new#}
+    namePtr
+    categoryPtr
+
+-- | Returns the mark category
 -- 
-sourceMarkGetCategory :: SourceMark -> IO String
+sourceMarkGetCategory :: SourceMarkClass mark => mark
+                      -> IO String -- ^ returns the category of the 'SourceMark' 
 sourceMarkGetCategory mark = do
-  strPtr <- {#call unsafe source_mark_get_category#} mark
+  strPtr <- {#call unsafe source_mark_get_category#} (toSourceMark mark)
   markType <- peekUTFString strPtr
   {#call unsafe g_free#} (castPtr strPtr)
   return markType
 
--- | 
+-- | Returns the next 'SourceMark' in the buffer or 'Nothing' if the mark was not added to a buffer. If there
+-- is no next mark, 'Nothing' will be returned.
 -- 
-sourceMarkNext :: SourceMark -> String -> IO SourceMark
-sourceMarkNext mark category = makeNewGObject mkSourceMark $
-  withUTFString category $ {#call unsafe source_mark_next#} mark
+-- If category is 'Nothing', looks for marks of any category
+-- 
+sourceMarkNext :: SourceMarkClass mark => mark 
+               -> Maybe String  -- ^ @category@ a string specifying the mark category or 'Nothing' 
+               -> IO (Maybe SourceMark) -- ^ returns  the next 'SourceMark' or 'Nothing'                
+sourceMarkNext mark category = 
+    maybeNull (makeNewGObject mkSourceMark) $
+    maybeWith withUTFString category $ {#call unsafe source_mark_next#} (toSourceMark mark)
 
--- | 
+-- | Returns the previous 'SourceMark' in the buffer or 'Nothing' if the mark was not added to a buffer. If
+-- there is no previous mark, 'Nothing' is returned.
 -- 
-sourceMarkPrev :: SourceMark -> String -> IO SourceMark
-sourceMarkPrev mark category = makeNewGObject mkSourceMark $
-  withUTFString category $ {#call unsafe source_mark_prev#} mark
+-- If category is 'Nothing', looks for marks of any category
+-- 
+sourceMarkPrev :: SourceMarkClass mark => mark 
+               -> Maybe String  -- ^ @category@ a string specifying the mark category or 'Nothing' 
+               -> IO (Maybe SourceMark) -- ^ returns  the previous 'SourceMark' or 'Nothing'            
+sourceMarkPrev mark category = 
+    maybeNull (makeNewGObject mkSourceMark) $
+    maybeWith withUTFString category $ {#call unsafe source_mark_prev#} (toSourceMark mark)
 
+-- | The category of the 'SourceMark', classifies the mark and controls which pixbuf is used and with
+-- which priority it is drawn.
+-- Default value: \"\"
+--
+sourceMarkCategory :: SourceMarkClass mark => Attr mark String
+sourceMarkCategory = newAttrFromStringProperty "category"
diff --git a/Graphics/UI/Gtk/SourceView/SourceStyle/Internal.chs b/Graphics/UI/Gtk/SourceView/SourceStyle/Internal.chs
--- a/Graphics/UI/Gtk/SourceView/SourceStyle/Internal.chs
+++ b/Graphics/UI/Gtk/SourceView/SourceStyle/Internal.chs
@@ -34,15 +34,16 @@
 import Control.Monad (liftM, sequence)
 import Data.Maybe (catMaybes)
 
+import Graphics.UI.Gtk.SourceView.SourceStyle
 import System.Glib.FFI
-{#import System.Glib.GObject#}              (objectNew, constructNewGObject)
 import System.Glib.GType (GType)
-import qualified System.Glib.GTypeConstants as GType
 import System.Glib.GValue (GValue, valueInit, allocaGValue)
 import System.Glib.GValueTypes (valueSetString, valueSetBool)
-{#import System.Glib.Properties#}
+import qualified System.Glib.GTypeConstants as GType
+
 {#import Graphics.UI.Gtk.SourceView.Types#}
-import Graphics.UI.Gtk.SourceView.SourceStyle
+{#import System.Glib.GObject#}              (objectNew, constructNewGObject)
+{#import System.Glib.Properties#}
 
 {# context lib="gtk" prefix="gtk" #}
 
diff --git a/Graphics/UI/Gtk/SourceView/SourceStyleScheme.chs b/Graphics/UI/Gtk/SourceView/SourceStyleScheme.chs
--- a/Graphics/UI/Gtk/SourceView/SourceStyleScheme.chs
+++ b/Graphics/UI/Gtk/SourceView/SourceStyleScheme.chs
@@ -25,7 +25,19 @@
 -- Portability : portable (depends on GHC)
 --
 module Graphics.UI.Gtk.SourceView.SourceStyleScheme (
+-- * Description
+-- | 'SourceStyleScheme' contains all the text styles to be used in 'SourceView' and
+-- 'SourceBuffer'. For instance, it contains text styles for syntax highlighting, it may contain
+-- foreground and background color for non-highlighted text, color for the line numbers, etc.
+-- 
+-- Style schemes are stored in XML files. The format of a scheme file is the documented in the style
+-- scheme reference.
+
+-- * Types
   SourceStyleScheme,
+  SourceStyleSchemeClass,
+
+-- * Methods  
   castToSourceStyleScheme,
   sourceStyleSchemeGetId,
   sourceStyleSchemeGetName,
@@ -33,6 +45,8 @@
   sourceStyleSchemeGetAuthors,
   sourceStyleSchemeGetFilename,
   sourceStyleSchemeGetStyle,
+
+-- * Attributes  
   sourceStyleSchemeDescription,
   sourceStyleSchemeFilename,
   sourceStyleSchemeId,
@@ -41,14 +55,15 @@
 
 import Control.Monad	(liftM)
 
+import Graphics.UI.Gtk.SourceView.SourceStyle
+import System.Glib.Attributes
 import System.Glib.FFI
-import System.Glib.UTFString
 import System.Glib.GObject	(constructNewGObject)
-import System.Glib.Attributes
-{#import System.Glib.Properties#}
-{#import Graphics.UI.Gtk.SourceView.Types#}
-import Graphics.UI.Gtk.SourceView.SourceStyle
+import System.Glib.UTFString
+
 {#import Graphics.UI.Gtk.SourceView.SourceStyle.Internal#}
+{#import Graphics.UI.Gtk.SourceView.Types#}
+{#import System.Glib.Properties#}
 
 {# context lib="gtk" prefix="gtk" #}
 
@@ -56,58 +71,73 @@
 
 -- | 
 -- 
-sourceStyleSchemeGetId :: SourceStyleScheme -> IO String
+sourceStyleSchemeGetId :: SourceStyleSchemeClass sss => sss
+                       -> IO String -- ^ returns scheme id.              
 sourceStyleSchemeGetId ss =
-  {#call source_style_scheme_get_id#} ss >>= peekUTFString
+  {#call source_style_scheme_get_id#} (toSourceStyleScheme ss) >>= peekUTFString
 
 -- | 
 -- 
-sourceStyleSchemeGetName :: SourceStyleScheme -> IO String
+sourceStyleSchemeGetName :: SourceStyleSchemeClass sss => sss 
+                         -> IO String -- ^ returns scheme name.            
 sourceStyleSchemeGetName ss =
-  {#call source_style_scheme_get_name#} ss >>= peekUTFString
+  {#call source_style_scheme_get_name#} (toSourceStyleScheme ss) >>= peekUTFString
 
 -- | 
 -- 
-sourceStyleSchemeGetDescription :: SourceStyleScheme -> IO String
+sourceStyleSchemeGetDescription :: SourceStyleSchemeClass sss => sss 
+                                -> IO String -- ^ returns scheme description (if defined) or empty. 
 sourceStyleSchemeGetDescription ss =
-  {#call source_style_scheme_get_description#} ss >>= peekUTFString
+  {#call source_style_scheme_get_description#} (toSourceStyleScheme ss) >>= peekUTFString
 
 -- |
 --
-sourceStyleSchemeGetAuthors :: SourceStyleScheme -> IO [String]
+sourceStyleSchemeGetAuthors :: SourceStyleSchemeClass sss => sss 
+                            -> IO [String] -- ^ returns an array containing the scheme authors or empty if no author is specified by the style scheme.
 sourceStyleSchemeGetAuthors ss =
-  {#call source_style_scheme_get_authors#} ss >>= peekUTFStringArray0
+  {#call source_style_scheme_get_authors#} (toSourceStyleScheme ss) >>= peekUTFStringArray0
 
 -- | 
 -- 
-sourceStyleSchemeGetFilename :: SourceStyleScheme -> IO String
+sourceStyleSchemeGetFilename :: SourceStyleSchemeClass sss => sss 
+                             -> IO String -- ^ returns scheme file name if the scheme was created parsing a style scheme file or empty in the other cases.
 sourceStyleSchemeGetFilename ss =
-  {#call source_style_scheme_get_filename#} ss >>= peekUTFString
+  {#call source_style_scheme_get_filename#} (toSourceStyleScheme ss) >>= peekUTFString
 
 -- | 
 -- 
-sourceStyleSchemeGetStyle :: SourceStyleScheme -> String -> IO SourceStyle
+sourceStyleSchemeGetStyle :: SourceStyleSchemeClass sss => sss 
+                          -> String  -- ^ @styleId@ id of the style to retrieve.
+                          -> IO SourceStyle -- ^ returns  style which corresponds to @styleId@ in the scheme
 sourceStyleSchemeGetStyle ss id = do
   styleObj <- makeNewGObject mkSourceStyleObject $
-              withUTFString id ({#call source_style_scheme_get_style#} ss)
+              withUTFString id ({#call source_style_scheme_get_style#} (toSourceStyleScheme ss))
   sourceStyleFromObject styleObj
 
--- |
+-- | Style scheme description.
+-- 
+-- Default value: \"\"
 --
-sourceStyleSchemeDescription :: ReadAttr SourceStyleScheme String
+sourceStyleSchemeDescription :: SourceStyleSchemeClass sss => ReadAttr sss String
 sourceStyleSchemeDescription = readAttrFromStringProperty "description"
 
--- |
+-- | Style scheme filename or 'Nothing'.
+-- 
+-- Default value: \"\"
 --
-sourceStyleSchemeFilename :: ReadAttr SourceStyleScheme FilePath
+sourceStyleSchemeFilename :: SourceStyleSchemeClass sss => ReadAttr sss FilePath
 sourceStyleSchemeFilename = readAttrFromStringProperty "filename"
 
--- |
+-- | Style scheme id, a unique string used to identify the style scheme in 'SourceStyleSchemeManager'.
+-- 
+-- Default value: \"\"
 --
-sourceStyleSchemeId :: ReadAttr SourceStyleScheme String
+sourceStyleSchemeId :: SourceStyleSchemeClass sss => ReadAttr sss String
 sourceStyleSchemeId = readAttrFromStringProperty "id"
 
--- |
+-- | Style scheme name, a translatable string to present to user.
+-- 
+-- Default value: \"\"
 --
-sourceStyleSchemeName :: ReadAttr SourceStyleScheme String
+sourceStyleSchemeName :: SourceStyleSchemeClass sss => ReadAttr sss String
 sourceStyleSchemeName = readAttrFromStringProperty "name"
diff --git a/Graphics/UI/Gtk/SourceView/SourceStyleSchemeManager.chs b/Graphics/UI/Gtk/SourceView/SourceStyleSchemeManager.chs
--- a/Graphics/UI/Gtk/SourceView/SourceStyleSchemeManager.chs
+++ b/Graphics/UI/Gtk/SourceView/SourceStyleSchemeManager.chs
@@ -25,8 +25,11 @@
 -- Portability : portable (depends on GHC)
 --
 module Graphics.UI.Gtk.SourceView.SourceStyleSchemeManager (
+-- * Types
   SourceStyleSchemeManager,
   SourceStyleSchemeManagerClass,
+
+-- * Methods  
   sourceStyleSchemeManagerNew,
   sourceStyleSchemeManagerGetDefault,
   sourceStyleSchemeManagerSetSearchPath,
@@ -36,6 +39,8 @@
   sourceStyleSchemeManagerGetSchemeIds,
   sourceStyleSchemeManagerGetScheme,
   sourceStyleSchemeManagerForceRescan,
+
+-- * Attributes
   sourceStyleSchemeManagerStyleIds,
   sourceStyleSchemeManagerSearchPath
   ) where
@@ -45,81 +50,95 @@
 import Control.Monad	(liftM)
 import Data.Maybe (fromMaybe)
 
+import System.Glib.Attributes
 import System.Glib.FFI
 import System.Glib.GObject (constructNewGObject, makeNewGObject)
 import System.Glib.UTFString
-import System.Glib.Attributes
-{#import System.Glib.Properties#}
-{#import Graphics.UI.Gtk.SourceView.Types#}
+
 {#import Graphics.UI.Gtk.SourceView.SourceStyleScheme#}
+{#import Graphics.UI.Gtk.SourceView.Types#}
+{#import System.Glib.Properties#}
 
--- |
+-- | Creates a new style manager. If you do not need more than one style manager then use
+-- 'sourceStyleSchemeManagerGetDefault' instead.
 --
 sourceStyleSchemeManagerNew :: IO SourceStyleSchemeManager
 sourceStyleSchemeManagerNew = constructNewGObject mkSourceStyleSchemeManager $ liftM castPtr
   {#call unsafe source_style_scheme_manager_new#}
 
--- |
+-- | Returns the default 'SourceStyleSchemeManager' instance.
 --
-sourceStyleSchemeManagerGetDefault :: IO SourceStyleSchemeManager
+sourceStyleSchemeManagerGetDefault :: IO SourceStyleSchemeManager -- ^ returns a 'SourceStyleSchemeManager'. Return value is owned by 'SourceView' library and must not be unref'ed.
 sourceStyleSchemeManagerGetDefault = makeNewGObject mkSourceStyleSchemeManager $ liftM castPtr
   {#call unsafe source_style_scheme_manager_get_default#}
 
--- |
+-- | Sets the list of directories where the manager looks for style scheme files. If dirs is 'Nothing', the
+-- search path is reset to default.
 --
-sourceStyleSchemeManagerSetSearchPath :: SourceStyleSchemeManager -> Maybe [String] -> IO ()
+sourceStyleSchemeManagerSetSearchPath :: SourceStyleSchemeManagerClass sssm => sssm -> Maybe [String] -> IO ()
 sourceStyleSchemeManagerSetSearchPath ssm dirs =
   maybeWith withUTFStringArray0 dirs $ \dirsPtr -> do
-    {#call unsafe source_style_scheme_manager_set_search_path#} ssm dirsPtr
+    {#call unsafe source_style_scheme_manager_set_search_path#} (toSourceStyleSchemeManager ssm) dirsPtr
 
--- |
+-- | Appends path to the list of directories where the manager looks for style scheme files. See
+-- 'sourceStyleSchemeManagerSetSearchPath' for details.
 --
-sourceStyleSchemeManagerAppendSearchPath :: SourceStyleSchemeManager -> String -> IO ()
+sourceStyleSchemeManagerAppendSearchPath :: SourceStyleSchemeManagerClass sssm => sssm 
+                                         -> String  -- ^ @path@    a directory or a filename.     
+                                         -> IO ()
 sourceStyleSchemeManagerAppendSearchPath ssm dir =
-  withUTFString dir $ {#call unsafe source_style_scheme_manager_append_search_path#} ssm
+  withUTFString dir $ {#call unsafe source_style_scheme_manager_append_search_path#} (toSourceStyleSchemeManager ssm)
 
--- |
+-- | Prepends path to the list of directories where the manager looks for style scheme files. See
+-- 'sourceStyleSchemeManagerSetSearchPath' for details.
 --
-sourceStyleSchemeManagerPrependSearchPath :: SourceStyleSchemeManager -> String -> IO ()
+sourceStyleSchemeManagerPrependSearchPath :: SourceStyleSchemeManagerClass sssm => sssm 
+                                          -> String  -- ^ @path@    a directory or a filename.     
+                                          -> IO ()
 sourceStyleSchemeManagerPrependSearchPath ssm dir =
-  withUTFString dir $ {#call unsafe source_style_scheme_manager_prepend_search_path#} ssm
+  withUTFString dir $ {#call unsafe source_style_scheme_manager_prepend_search_path#} (toSourceStyleSchemeManager ssm)
 
--- |
+-- | Returns the current search path for the manager. See
+-- 'sourceStyleSchemeManagerSetSearchPath' for details.
 --
-sourceStyleSchemeManagerGetSearchPath :: SourceStyleSchemeManager -> IO [String]
+sourceStyleSchemeManagerGetSearchPath :: SourceStyleSchemeManagerClass sssm => sssm 
+                                      -> IO [String]
 sourceStyleSchemeManagerGetSearchPath ssm = do
-  dirsPtr <- {#call unsafe source_style_scheme_manager_get_search_path#} ssm
+  dirsPtr <- {#call unsafe source_style_scheme_manager_get_search_path#} (toSourceStyleSchemeManager ssm)
   peekUTFStringArray0 dirsPtr
 
--- |
+-- | Returns the ids of the available style schemes.
 --
-sourceStyleSchemeManagerGetSchemeIds :: SourceStyleSchemeManager -> IO [String]
+sourceStyleSchemeManagerGetSchemeIds :: SourceStyleSchemeManagerClass sssm => sssm -> IO [String]
 sourceStyleSchemeManagerGetSchemeIds ssm = do
-  idsPtr <- {#call unsafe source_style_scheme_manager_get_scheme_ids#} ssm
+  idsPtr <- {#call unsafe source_style_scheme_manager_get_scheme_ids#} (toSourceStyleSchemeManager ssm)
   liftM (fromMaybe []) $ maybePeek peekUTFStringArray0 idsPtr
 
--- |
+-- | Looks up style scheme by id.
 --
-sourceStyleSchemeManagerGetScheme :: SourceStyleSchemeManager -> String -> IO SourceStyleScheme
+sourceStyleSchemeManagerGetScheme :: SourceStyleSchemeManagerClass sssm => sssm 
+                                  -> String  -- ^ @schemeId@ style scheme id to find
+                                  -> IO SourceStyleScheme
 sourceStyleSchemeManagerGetScheme ssm id = makeNewGObject mkSourceStyleScheme $
-  withUTFString id $ {#call unsafe source_style_scheme_manager_get_scheme#} ssm
+  withUTFString id $ {#call unsafe source_style_scheme_manager_get_scheme#} (toSourceStyleSchemeManager ssm)
 
--- |
+-- | Mark any currently cached information about the available style scehems as invalid. All the
+-- available style schemes will be reloaded next time the manager is accessed.
 --
-sourceStyleSchemeManagerForceRescan :: SourceStyleSchemeManager -> IO ()
-sourceStyleSchemeManagerForceRescan =
-  {#call unsafe source_style_scheme_manager_force_rescan#}
+sourceStyleSchemeManagerForceRescan :: SourceStyleSchemeManagerClass sssm => sssm -> IO ()
+sourceStyleSchemeManagerForceRescan ssm =
+  {#call unsafe source_style_scheme_manager_force_rescan#} (toSourceStyleSchemeManager ssm)
 
--- |
+-- | List of the ids of the available style schemes.
 --
-sourceStyleSchemeManagerStyleIds :: ReadAttr SourceStyleSchemeManager [String]
+sourceStyleSchemeManagerStyleIds :: SourceStyleSchemeManagerClass sssm => ReadAttr sssm [String]
 sourceStyleSchemeManagerStyleIds =
   readAttrFromBoxedOpaqueProperty (liftM (fromMaybe []) . maybePeek peekUTFStringArray0 . castPtr)
                                   "style-ids" {#call pure g_strv_get_type#}
 
--- |
+-- | List of directories and files where the style schemes are located.
 --
-sourceStyleSchemeManagerSearchPath :: ReadWriteAttr SourceStyleSchemeManager [String] (Maybe [String])
+sourceStyleSchemeManagerSearchPath :: SourceStyleSchemeManagerClass sssm => ReadWriteAttr sssm [String] (Maybe [String])
 sourceStyleSchemeManagerSearchPath =
   newAttr (objectGetPropertyBoxedOpaque (peekUTFStringArray0 . castPtr) gtype "search-path")
           (objectSetPropertyBoxedOpaque (\dirs f -> maybeWith withUTFStringArray0 dirs (f . castPtr)) gtype "search-path")
diff --git a/Graphics/UI/Gtk/SourceView/SourceUndoManager.chs b/Graphics/UI/Gtk/SourceView/SourceUndoManager.chs
new file mode 100644
--- /dev/null
+++ b/Graphics/UI/Gtk/SourceView/SourceUndoManager.chs
@@ -0,0 +1,111 @@
+{-# LANGUAGE CPP #-}
+-- -*-haskell-*-
+--  GIMP Toolkit (GTK) SourceUndoManager
+--
+--  Author : Andy Stewart
+--
+--  Created: 08 Aug 2010
+--
+--  Copyright (C) 2010 Andy Stewart
+--
+--  This library is free software; you can redistribute it and/or
+--  modify it under the terms of the GNU Lesser General Public
+--  License as published by the Free Software Foundation; either
+--  version 2.1 of the License, or (at your option) any later version.
+--
+--  This library is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+--  Lesser General Public License for more details.
+--
+-- |
+-- Maintainer  : gtk2hs-users@lists.sourceforge.net
+-- Stability   : provisional
+-- Portability : portable (depends on GHC)
+--
+module Graphics.UI.Gtk.SourceView.SourceUndoManager (
+-- * Description
+-- | The 'SourceUndoManager' interface can be implemented to provide custom undo management to a
+-- 'SourceBuffer'. Use 'sourceBufferSetUndoManager' to install a custom undo manager for a
+-- particular source buffer.
+-- 
+-- Use 'sourceUndoManagerCanUndoChanged' and 'sourceUndoManagerCanRedoChanged' when
+-- respectively the undo state or redo state of the undo stack has changed.
+
+-- * Types  
+    SourceUndoManager,
+    SourceUndoManagerClass,
+  
+-- * Methods  
+    sourceUndoManagerCanUndo,
+    sourceUndoManagerCanRedo,
+    sourceUndoManagerUndo,
+    sourceUndoManagerRedo,
+    sourceUndoManagerBeginNotUndoableAction,
+    sourceUndoManagerEndNotUndoableAction,
+
+-- * Signals
+    sourceUndoManagerCanRedoChanged,
+    sourceUndoManagerCanUndoChanged,
+) where
+
+import Control.Monad	(liftM)
+
+import System.Glib.Attributes
+import System.Glib.FFI
+import System.Glib.GObject	(makeNewGObject)
+import System.Glib.Properties
+import System.Glib.UTFString
+
+{#import Graphics.UI.Gtk.SourceView.Signals#}
+{#import Graphics.UI.Gtk.SourceView.Types#}
+
+{# context lib="gtk" prefix="gtk" #}
+
+-- | Get whether there are undo operations available.
+sourceUndoManagerCanUndo :: SourceUndoManagerClass sum => sum
+                         -> IO Bool  -- ^ returns 'True' if there are undo operations available, 'False' otherwise 
+sourceUndoManagerCanUndo sm =
+  liftM toBool $
+  {#call gtk_source_undo_manager_can_undo #} (toSourceUndoManager sm)
+
+-- | Get whether there are redo operations available.
+sourceUndoManagerCanRedo :: SourceUndoManagerClass sum => sum
+                         -> IO Bool  -- ^ returns 'True' if there are redo operations available, 'False' otherwise 
+sourceUndoManagerCanRedo sm =
+  liftM toBool $
+  {#call gtk_source_undo_manager_can_redo #} (toSourceUndoManager sm)
+
+-- | Perform a single undo. Calling this function when there are no undo operations available is an
+-- error. Use @gtkSourceUndoManagerCanUndo@ to find out if there are undo operations available.
+sourceUndoManagerUndo :: SourceUndoManagerClass sum => sum -> IO ()
+sourceUndoManagerUndo sm =
+  {#call gtk_source_undo_manager_undo #} (toSourceUndoManager sm)
+
+-- | Perform a single redo. Calling this function when there are no redo operations available is an
+-- error. Use @gtkSourceUndoManagerCanRedo@ to find out if there are redo operations available.
+sourceUndoManagerRedo :: SourceUndoManagerClass sum => sum -> IO ()
+sourceUndoManagerRedo sm =
+  {#call gtk_source_undo_manager_redo #} (toSourceUndoManager sm)
+
+-- | Begin a not undoable action on the buffer. All changes between this call and the call to
+-- @gtkSourceUndoManagerEndNotUndoableAction@ cannot be undone. This function should be
+-- re-entrant.
+sourceUndoManagerBeginNotUndoableAction :: SourceUndoManagerClass sum => sum -> IO ()
+sourceUndoManagerBeginNotUndoableAction sm =
+  {#call gtk_source_undo_manager_begin_not_undoable_action #} (toSourceUndoManager sm)
+
+-- | Ends a not undoable action on the buffer.
+sourceUndoManagerEndNotUndoableAction :: SourceUndoManagerClass sum => sum -> IO ()
+sourceUndoManagerEndNotUndoableAction sm =
+  {#call gtk_source_undo_manager_end_not_undoable_action #} (toSourceUndoManager sm)
+
+-- | Emitted when the ability to redo has changed.
+--
+sourceUndoManagerCanRedoChanged :: SourceUndoManagerClass sum => Signal sum (IO ())
+sourceUndoManagerCanRedoChanged = Signal $ connect_NONE__NONE "can-redo-changed"
+
+-- | Emitted when the ability to undo has changed.
+--
+sourceUndoManagerCanUndoChanged :: SourceUndoManagerClass sum => Signal sum (IO ())
+sourceUndoManagerCanUndoChanged = Signal $ connect_NONE__NONE "can-undo-changed"
diff --git a/Graphics/UI/Gtk/SourceView/SourceView.chs b/Graphics/UI/Gtk/SourceView/SourceView.chs
--- a/Graphics/UI/Gtk/SourceView/SourceView.chs
+++ b/Graphics/UI/Gtk/SourceView/SourceView.chs
@@ -8,6 +8,7 @@
 --  Created: 18 December 2008
 --
 --  Copyright (C) 2004-2008 Peter Gavin, Duncan Coutts, Axel Simon
+--  Copyright (C) 2010 Andy Stewart
 --
 --  This library is free software; you can redistribute it and/or
 --  modify it under the terms of the GNU Lesser General Public
@@ -25,9 +26,20 @@
 -- Portability : portable (depends on GHC)
 --
 module Graphics.UI.Gtk.SourceView.SourceView (
+-- * Description
+-- | 'SourceView' is the main object of the gtksourceview library. It provides a text view which syntax
+-- highlighting, undo/redo and text marks. Use a 'SourceBuffer' to display text with a 'SourceView'.
+
+-- * Types
   SourceView,
   SourceViewClass,
+
+-- * Enums
   SourceSmartHomeEndType(..),
+  SourceDrawSpacesFlags(..),
+  SourceViewGutterPosition (..),
+
+-- * Methods  
   castToSourceView,
   sourceViewNew,
   sourceViewNewWithBuffer,
@@ -41,6 +53,13 @@
   sourceViewGetInsertSpacesInsteadOfTabs,
   sourceViewSetSmartHomeEnd,
   sourceViewGetSmartHomeEnd,
+  sourceViewSetMarkCategoryPriority,
+  sourceViewGetMarkCategoryPriority,
+  sourceViewSetMarkCategoryIconFromPixbuf,
+  sourceViewSetMarkCategoryIconFromStock,
+  sourceViewSetMarkCategoryIconFromIconName,
+  sourceViewSetMarkCategoryBackground,
+  sourceViewGetMarkCategoryBackground,
   sourceViewSetHighlightCurrentLine,
   sourceViewGetHighlightCurrentLine,
   sourceViewSetShowLineMarks,
@@ -53,9 +72,14 @@
   sourceViewGetRightMarginPosition,
   sourceViewSetTabWidth,
   sourceViewGetTabWidth,
-  sourceViewSetMarkCategoryPixbuf,
-  sourceViewGetMarkCategoryPixbuf,
+  sourceViewSetDrawSpaces,
+  sourceViewGetDrawSpaces,
+  sourceViewGetGutter,
+
+-- * Attributes  
   sourceViewAutoIndent,
+  sourceViewCompletion,
+  sourceViewDrawSpaces,
   sourceViewHighlightCurrentLine,
   sourceViewIndentOnTab,
   sourceViewIndentWidth,
@@ -65,23 +89,40 @@
   sourceViewShowRightMargin,
   sourceViewSmartHomeEnd,
   sourceViewTabWidth,
+
+-- * Signals
   sourceViewUndo,
-  sourceViewRedo
+  sourceViewRedo,
+  sourceViewMoveLines,
+  sourceViewShowCompletion,
+  sourceViewLineMarkActivated,
+
+-- * Deprecated
+#ifndef DISABLE_DEPRECATED
+  sourceViewSetMarkCategoryPixbuf,
+  sourceViewGetMarkCategoryPixbuf,
+#endif
   ) where
 
 import Control.Monad	(liftM)
+import Control.Monad.Reader ( runReaderT )
+import Data.Maybe    (fromMaybe)
 
-import System.Glib.FFI
-{#import System.Glib.Properties#}
-import System.Glib.Attributes
 import Graphics.UI.Gtk.Abstract.Object	(makeNewObject)
-{#import Graphics.UI.Gtk.SourceView.Types#}
+import Graphics.UI.Gtk.Abstract.Widget (Color)
+import Graphics.UI.Gtk.Gdk.EventM (EventM, EAny)
+import Graphics.UI.Gtk.Multiline.TextView (TextWindowType (..))
+import Graphics.UI.Gtk.SourceView.Enums
+import Graphics.UI.GtkInternals  ( TextIter, mkTextIterCopy )
+import System.Glib.Attributes
+import System.Glib.FFI
+
 {#import Graphics.UI.Gtk.SourceView.Signals#}
+{#import Graphics.UI.Gtk.SourceView.Types#}
+{#import System.Glib.Properties#}
 
 {# context lib="gtk" prefix="gtk" #}
 
-{# enum SourceSmartHomeEndType {underscoreToCase} deriving (Eq, Bounded, Show, Read) #}
-
 -- | Create a new 'SourceView' widget with a default 'SourceBuffer'.
 --
 sourceViewNew :: IO SourceView
@@ -95,210 +136,382 @@
 sourceViewNewWithBuffer sb = makeNewObject mkSourceView $ liftM castPtr $
   {#call source_view_new_with_buffer#} sb
 
--- | 
+-- | If 'True' auto indentation of text is enabled.
 --
-sourceViewSetAutoIndent :: SourceViewClass sv => sv -> Bool -> IO ()
-sourceViewSetAutoIndent sv newVal =
-  {#call source_view_set_auto_indent#} (toSourceView sv) (fromBool newVal)
+sourceViewSetAutoIndent :: SourceViewClass sv => sv 
+                        -> Bool  -- ^ @enable@ whether to enable auto indentation. 
+                        -> IO ()
+sourceViewSetAutoIndent sv enable =
+  {#call source_view_set_auto_indent#} (toSourceView sv) (fromBool enable)
   
--- | 
+-- | Returns whether auto indentation of text is enabled.
 --
-sourceViewGetAutoIndent :: SourceViewClass sv => sv -> IO Bool 
+sourceViewGetAutoIndent :: SourceViewClass sv => sv 
+                        -> IO Bool  -- ^ returns 'True' if auto indentation is enabled. 
 sourceViewGetAutoIndent sv = liftM toBool $
   {#call unsafe source_view_get_auto_indent#} (toSourceView sv)
 
--- | 
+-- | If 'True', when the tab key is pressed and there is a selection, the selected text is indented of one
+-- level instead of being replaced with the \t characters. Shift+Tab unindents the selection.
 --
-sourceViewSetIndentOnTab :: SourceViewClass sv => sv -> Bool -> IO ()
-sourceViewSetIndentOnTab sv newVal =
-  {#call source_view_set_indent_on_tab#} (toSourceView sv) (fromBool newVal)
+sourceViewSetIndentOnTab :: SourceViewClass sv => sv 
+                         -> Bool  -- ^ @enable@ whether to indent a block when tab is pressed. 
+                         -> IO ()
+sourceViewSetIndentOnTab sv enable =
+  {#call source_view_set_indent_on_tab#} (toSourceView sv) (fromBool enable)
   
--- | 
+-- | Returns whether when the tab key is pressed the current selection should get indented instead of
+-- replaced with the \t character.
 --
-sourceViewGetIndentOnTab :: SourceViewClass sv => sv -> IO Bool 
+sourceViewGetIndentOnTab :: SourceViewClass sv => sv 
+                         -> IO Bool  -- ^ returns 'True' if the selection is indented when tab is pressed. 
 sourceViewGetIndentOnTab sv = liftM toBool $
   {#call unsafe source_view_get_indent_on_tab#} (toSourceView sv)
 
--- | 
+-- | Sets the number of spaces to use for each step of indent. If width is -1, the value of the
+-- 'tabWidth' property will be used.
 --
-sourceViewSetIndentWidth :: SourceViewClass sv => sv -> Int -> IO ()
-sourceViewSetIndentWidth sv newVal =
-  {#call source_view_set_indent_width#} (toSourceView sv) (fromIntegral newVal)
+sourceViewSetIndentWidth :: SourceViewClass sv => sv 
+                         -> Int  -- ^ @width@ indent width in characters. 
+                         -> IO ()
+sourceViewSetIndentWidth sv width =
+  {#call source_view_set_indent_width#} (toSourceView sv) (fromIntegral width)
 
--- | 
+-- | Returns the number of spaces to use for each step of indent. See 'sourceViewSetIndentWidth'
+-- for details.
 --
-sourceViewGetIndentWidth :: SourceViewClass sv => sv -> IO Int
+sourceViewGetIndentWidth :: SourceViewClass sv => sv 
+                         -> IO Int -- ^ returns indent width.    
 sourceViewGetIndentWidth sv = liftM fromIntegral $
   {#call unsafe source_view_get_indent_width#} (toSourceView sv)
 
--- | 
+-- | If 'True' any tabulator character inserted is replaced by a group of space characters.
 --
-sourceViewSetInsertSpacesInsteadOfTabs :: SourceViewClass sv => sv -> Bool -> IO ()
-sourceViewSetInsertSpacesInsteadOfTabs sv newVal =
-  {#call source_view_set_insert_spaces_instead_of_tabs#} (toSourceView sv) (fromBool newVal)
+sourceViewSetInsertSpacesInsteadOfTabs :: SourceViewClass sv => sv 
+                                       -> Bool  -- ^ @enable@ whether to insert spaces instead of tabs. 
+                                       -> IO ()
+sourceViewSetInsertSpacesInsteadOfTabs sv enable =
+  {#call source_view_set_insert_spaces_instead_of_tabs#} (toSourceView sv) (fromBool enable)
   
--- | 
+-- | Returns whether when inserting a tabulator character it should be replaced by a group of space
+-- characters.
 --
-sourceViewGetInsertSpacesInsteadOfTabs :: SourceViewClass sv => sv -> IO Bool 
+sourceViewGetInsertSpacesInsteadOfTabs :: SourceViewClass sv => sv 
+                                       -> IO Bool  -- ^ returns 'True' if spaces are inserted instead of tabs. 
 sourceViewGetInsertSpacesInsteadOfTabs sv = liftM toBool $
   {#call unsafe source_view_get_insert_spaces_instead_of_tabs#} (toSourceView sv)
 
--- | 
+-- | Set the desired movement of the cursor when HOME and END keys are pressed.
 --
-sourceViewSetSmartHomeEnd :: SourceViewClass sv => sv -> SourceSmartHomeEndType -> IO ()
+sourceViewSetSmartHomeEnd :: SourceViewClass sv => sv 
+                          -> SourceSmartHomeEndType  -- ^ @smartHe@ the desired behavior among 'SourceSmartHomeEndType'. 
+                          -> IO ()
 sourceViewSetSmartHomeEnd sv newVal =
   {#call source_view_set_smart_home_end#} (toSourceView sv) (fromIntegral $ fromEnum newVal)
   
--- | 
+-- | Returns a 'SourceSmartHomeEndType' end value specifying how the cursor will move when HOME and END
+-- keys are pressed.
 --
-sourceViewGetSmartHomeEnd :: SourceViewClass sv => sv -> IO SourceSmartHomeEndType
+sourceViewGetSmartHomeEnd :: SourceViewClass sv => sv 
+                          -> IO SourceSmartHomeEndType -- ^ returns a 'SourceSmartHomeEndTypeend' value. 
 sourceViewGetSmartHomeEnd sv = liftM (toEnum . fromIntegral) $
   {#call unsafe source_view_get_smart_home_end#} (toSourceView sv)
 
--- | 
+-- | If show is 'True' the current line is highlighted.
 --
-sourceViewSetHighlightCurrentLine :: SourceViewClass sv => sv -> Bool -> IO ()
+sourceViewSetHighlightCurrentLine :: SourceViewClass sv => sv 
+                                  -> Bool  -- ^ @show@ whether to highlight the current line 
+                                  -> IO ()
 sourceViewSetHighlightCurrentLine sv newVal =
   {#call source_view_set_highlight_current_line#} (toSourceView sv) (fromBool newVal)
   
--- | 
+-- | Returns whether the current line is highlighted
 --
-sourceViewGetHighlightCurrentLine :: SourceViewClass sv => sv -> IO Bool 
+sourceViewGetHighlightCurrentLine :: SourceViewClass sv => sv 
+                                  -> IO Bool  -- ^ returns 'True' if the current line is highlighted. 
 sourceViewGetHighlightCurrentLine sv = liftM toBool $
   {#call unsafe source_view_get_highlight_current_line#} (toSourceView sv)
 
--- | 
+-- | If 'True' line marks will be displayed beside the text.
 --
-sourceViewSetShowLineMarks :: SourceViewClass sv => sv -> Bool -> IO ()
+sourceViewSetShowLineMarks :: SourceViewClass sv => sv 
+                           -> Bool  -- ^ @show@ whether line marks should be displayed. 
+                           -> IO ()
 sourceViewSetShowLineMarks sv newVal =
   {#call source_view_set_show_line_marks#} (toSourceView sv) (fromBool newVal)
   
--- | 
+-- | Returns whether line marks are displayed beside the text.
 --
-sourceViewGetShowLineMarks :: SourceViewClass sv => sv -> IO Bool 
+sourceViewGetShowLineMarks :: SourceViewClass sv => sv 
+                           -> IO Bool  -- ^ returns 'True' if the line marks are displayed. 
 sourceViewGetShowLineMarks sv = liftM toBool $
   {#call unsafe source_view_get_show_line_marks#} (toSourceView sv)
 
---- | 
+-- | If 'True' line numbers will be displayed beside the text.
 --
-sourceViewSetShowLineNumbers :: SourceViewClass sv => sv -> Bool -> IO ()
+sourceViewSetShowLineNumbers :: SourceViewClass sv => sv 
+                             -> Bool  -- ^ @show@ whether line numbers should be displayed. 
+                             -> IO ()
 sourceViewSetShowLineNumbers sv newVal =
   {#call source_view_set_show_line_numbers#} (toSourceView sv) (fromBool newVal)
   
--- | 
+-- | Returns whether line numbers are displayed beside the text.
 --
-sourceViewGetShowLineNumbers :: SourceViewClass sv => sv -> IO Bool 
+sourceViewGetShowLineNumbers :: SourceViewClass sv => sv 
+                             -> IO Bool  -- ^ returns 'True' if the line numbers are displayed. 
 sourceViewGetShowLineNumbers sv = liftM toBool $
   {#call unsafe source_view_get_show_line_numbers#} (toSourceView sv)
 
--- | 
+-- | If 'True' a right margin is displayed
 --
-sourceViewSetShowRightMargin :: SourceViewClass sv => sv -> Bool -> IO ()
+sourceViewSetShowRightMargin :: SourceViewClass sv => sv 
+                             -> Bool  -- ^ @show@ whether to show a right margin. 
+                             -> IO ()
 sourceViewSetShowRightMargin sv newVal =
   {#call source_view_set_show_right_margin#} (toSourceView sv) (fromBool newVal)
   
--- | 
+-- | Returns whether a right margin is displayed.
 --
-sourceViewGetShowRightMargin :: SourceViewClass sv => sv -> IO Bool
+sourceViewGetShowRightMargin :: SourceViewClass sv => sv 
+                             -> IO Bool -- ^ returns 'True' if the right margin is shown. 
 sourceViewGetShowRightMargin sv = liftM toBool $
   {#call source_view_get_show_right_margin#} (toSourceView sv)
   
--- | 
+-- | Sets the position of the right margin in the given view.
 --
-sourceViewSetRightMarginPosition :: SourceViewClass sv => sv -> Word -> IO ()
+sourceViewSetRightMarginPosition :: SourceViewClass sv => sv 
+                                 -> Word -- ^ @pos@  the width in characters where to position the right margin.  
+                                 -> IO ()
 sourceViewSetRightMarginPosition sv margin =
   {#call source_view_set_right_margin_position#} (toSourceView sv) (fromIntegral margin)
   
--- | 
+-- | Gets the position of the right margin in the given view.
 --
-sourceViewGetRightMarginPosition :: SourceViewClass sv => sv -> IO Int 
+sourceViewGetRightMarginPosition :: SourceViewClass sv => sv 
+                                 -> IO Int  -- ^ returns the position of the right margin. 
 sourceViewGetRightMarginPosition sv = liftM fromIntegral $
   {#call unsafe source_view_get_right_margin_position#} (toSourceView sv)
 
--- | 
+-- | Sets the width of tabulation in characters.
 --
-sourceViewSetTabWidth :: SourceViewClass sv => sv -> Int -> IO ()
+sourceViewSetTabWidth :: SourceViewClass sv => sv 
+                      -> Int  -- ^ @width@ width of tab in characters. 
+                      -> IO ()
 sourceViewSetTabWidth sv width =
   {#call source_view_set_tab_width#} (toSourceView sv) (fromIntegral width)
   
--- | 
+-- | Returns the width of tabulation in characters.
 --
-sourceViewGetTabWidth :: SourceViewClass sv => sv -> IO Int 
+sourceViewGetTabWidth :: SourceViewClass sv => sv 
+                      -> IO Int -- ^ returns width of tab.     
 sourceViewGetTabWidth sv = liftM fromIntegral $
   {#call unsafe source_view_get_tab_width#} (toSourceView sv)
 
--- |
+-- | Set if and how the spaces should be visualized. Specifying flags as 0 will disable display of
+-- spaces.
+sourceViewSetDrawSpaces :: SourceViewClass sv => sv
+                        -> SourceDrawSpacesFlags -- ^ @flags@ 'SourceDrawSpacesFlags' specifing how white spaces should be displayed
+                        -> IO ()
+sourceViewSetDrawSpaces view flags =
+  {#call gtk_source_view_set_draw_spaces #}  
+    (toSourceView view)
+    (fromIntegral $ fromEnum flags)
+
+-- | Returns the 'SourceDrawSpacesFlags' specifying if and how spaces should be displayed for this view.
+sourceViewGetDrawSpaces :: SourceViewClass sv => sv
+                        -> IO SourceDrawSpacesFlags -- ^ returns the 'SourceDrawSpacesFlags', 0 if no spaces should be drawn. 
+sourceViewGetDrawSpaces view =                        
+  liftM (toEnum . fromIntegral) $
+  {#call gtk_source_view_get_draw_spaces #}
+     (toSourceView view)
+
+-- | Returns the 'SourceGutter' object associated with @windowType@ for view. Only 'TextWindowLeft'
+-- and 'TextWindowRight' are supported, respectively corresponding to the left and right
+-- gutter. The line numbers and mark category icons are rendered in the gutter corresponding to
+-- 'TextWindowLeft'.
+sourceViewGetGutter :: SourceViewClass sv => sv 
+                    -> TextWindowType  -- ^ @windowType@ the gutter window type 
+                    -> IO SourceGutter
+sourceViewGetGutter sv windowType =
+  makeNewGObject mkSourceGutter $
+  {#call gtk_source_view_get_gutter #}
+    (toSourceView sv)
+    (fromIntegral $ fromEnum windowType)
+
+-- | Set the priority for the given mark category. When there are multiple marks on the same line, marks
+-- of categories with higher priorities will be drawn on top.
 --
-sourceViewSetMarkCategoryPriority :: SourceViewClass sv => sv -> String -> Int -> IO ()
+sourceViewSetMarkCategoryPriority :: SourceViewClass sv => sv 
+                                  -> String  -- ^ @category@ a mark category.              
+                                  -> Int  -- ^ @priority@ the priority for the category 
+                                  -> IO ()
 sourceViewSetMarkCategoryPriority sv markerType priority = withCString markerType $ \strPtr ->
   {#call source_view_set_mark_category_priority#} (toSourceView sv) strPtr (fromIntegral priority)
 
--- |
+-- | Gets the priority which is associated with the given category.
 --
-sourceViewGetMarkCategoryPriority :: SourceViewClass sv => sv -> String -> IO Int
+sourceViewGetMarkCategoryPriority :: SourceViewClass sv => sv 
+                                  -> String  -- ^ @category@ a mark category.   
+                                  -> IO Int -- ^ returns  the priority or if category exists but no priority was set, it defaults to 0.
 sourceViewGetMarkCategoryPriority sv markerType = withCString markerType $ \strPtr ->
   liftM fromIntegral $
   {#call unsafe source_view_get_mark_category_priority#} (toSourceView sv) strPtr
 
---- |
---
-sourceViewSetMarkCategoryPixbuf :: SourceViewClass sv => sv -> String -> Pixbuf -> IO ()
-sourceViewSetMarkCategoryPixbuf sv markerType marker = withCString markerType $ \strPtr ->
-  {#call source_view_set_mark_category_pixbuf#} (toSourceView sv) strPtr marker
+-- | Sets the icon to be used for category to pixbuf. If pixbuf is 'Nothing', the icon is unset.
+sourceViewSetMarkCategoryIconFromPixbuf :: SourceViewClass sv => sv
+                                        -> String -- ^ @category@ a mark category.     
+                                        -> Maybe Pixbuf -- ^ @pixbuf@   a 'Pixbuf' or 'Nothing'. 
+                                        -> IO ()
+sourceViewSetMarkCategoryIconFromPixbuf sv category pixbuf =
+  withCString category $ \categoryPtr ->
+  {#call gtk_source_view_set_mark_category_icon_from_pixbuf #}
+     (toSourceView sv)
+     categoryPtr
+     (fromMaybe (Pixbuf nullForeignPtr) pixbuf)
 
--- |
---
-sourceViewGetMarkCategoryPixbuf :: SourceViewClass sv => sv -> String -> IO Pixbuf
-sourceViewGetMarkCategoryPixbuf sv markerType = withCString markerType $ \strPtr ->
-  constructNewGObject mkPixbuf $
-  {#call unsafe source_view_get_mark_category_pixbuf#} (toSourceView sv) strPtr
+-- | Sets the icon to be used for category to the stock item @stockId@. If @stockId@ is 'Nothing', the icon is
+-- unset.
+sourceViewSetMarkCategoryIconFromStock :: SourceViewClass sv => sv
+                                       -> String -- ^ @category@ a mark category.      
+                                       -> Maybe String -- ^ @stockId@ the stock id or 'Nothing'. 
+                                       -> IO ()
+sourceViewSetMarkCategoryIconFromStock sv category stockId =
+  withCString category $ \categoryPtr ->
+  maybeWith withCString stockId $ \stockIdPtr ->
+  {#call gtk_source_view_set_mark_category_icon_from_stock #}
+    (toSourceView sv)
+    categoryPtr
+    stockIdPtr
 
--- |
+-- | Sets the icon to be used for category to the named theme item name. If name is 'Nothing', the icon is
+-- unset.
+sourceViewSetMarkCategoryIconFromIconName :: SourceViewClass sv => sv
+                                       -> String -- ^ @category@ a mark category.      
+                                       -> Maybe String -- ^ @name@     the themed icon name or 'Nothing'. 
+                                       -> IO ()
+sourceViewSetMarkCategoryIconFromIconName sv category name =
+  withCString category $ \categoryPtr ->
+  maybeWith withCString name $ \namePtr ->
+  {#call gtk_source_view_set_mark_category_icon_from_icon_name #}
+    (toSourceView sv)
+    categoryPtr
+    namePtr
+
+-- | Sets given background color for mark category. If color is 'Nothing', the background color is unset.
+sourceViewSetMarkCategoryBackground :: SourceViewClass sv => sv
+                                    -> String -- ^ @category@ a mark category.                      
+                                    -> Maybe Color  -- ^ @color@    background color or 'Nothing' to unset it. 
+                                    -> IO ()
+sourceViewSetMarkCategoryBackground sv category color =
+  let withMB :: Storable a => Maybe a -> (Ptr a -> IO b) -> IO b
+      withMB Nothing f = f nullPtr
+      withMB (Just x) f = with x f
+  in withCString category $ \categoryPtr ->
+     withMB color $ \colorPtr ->
+     {#call gtk_source_view_set_mark_category_background #}
+       (toSourceView sv)
+       categoryPtr
+       (castPtr colorPtr)
+
+-- | Gets the background color associated with given category.
+sourceViewGetMarkCategoryBackground :: SourceViewClass sv => sv
+                                    -> String -- ^ @category@ a mark category.
+                                    -> Color -- ^ @dest@     destination 'Color' structure to fill in.
+                                    -> IO Bool -- ^ returns  'True' if background color for category was set and dest is set to a valid color, or 'False' otherwise.
+sourceViewGetMarkCategoryBackground sv category color = 
+    liftM toBool $
+    withCString category $ \ categoryPtr ->
+    with color $ \ colorPtr ->
+    {#call gtk_source_view_get_mark_category_background #}
+      (toSourceView sv)
+      categoryPtr
+      (castPtr colorPtr)
+
+-- | Whether to enable auto indentation.
+-- 
+-- Default value: 'False'
 --
 sourceViewAutoIndent :: SourceViewClass sv => Attr sv Bool
 sourceViewAutoIndent = newAttrFromBoolProperty "auto-indent"
 
--- |
+-- | The completion object associated with the view.
 --
+sourceViewCompletion :: SourceViewClass sv => ReadAttr sv SourceCompletion
+sourceViewCompletion = readAttrFromObjectProperty "completion"
+                       {#call pure unsafe gtk_source_completion_get_type #}
+
+-- | Set if and how the spaces should be visualized.
+--
+sourceViewDrawSpaces :: SourceViewClass sv => Attr sv SourceDrawSpacesFlags
+sourceViewDrawSpaces = newAttrFromEnumProperty "draw-spaces" {#call fun gtk_source_draw_spaces_flags_get_type#}
+
+-- | Whether to highlight the current line.
+-- 
+-- Default value: 'False'
+--
 sourceViewHighlightCurrentLine :: SourceViewClass sv => Attr sv Bool
 sourceViewHighlightCurrentLine = newAttrFromBoolProperty "highlight-current-line"
 
--- |
+-- | Whether to indent the selected text when the tab key is pressed.
+-- 
+-- Default value: 'True'
 --
 sourceViewIndentOnTab :: SourceViewClass sv => Attr sv Bool
 sourceViewIndentOnTab = newAttrFromBoolProperty "indent-on-tab"
 
--- |
+-- | Width of an indentation step expressed in number of spaces.
+-- 
+-- Allowed values: [GMaxulong,32]
+-- 
+-- Default value: -1
 --
 sourceViewIndentWidth :: SourceViewClass sv => Attr sv Int
 sourceViewIndentWidth = newAttrFromIntProperty "indent-width"
 
--- |
+-- | Whether to insert spaces instead of tabs.
+-- 
+-- Default value: 'False'
 --
 sourceViewInsertSpacesInsteadOfTabs :: SourceViewClass sv => Attr sv Bool
 sourceViewInsertSpacesInsteadOfTabs = newAttrFromBoolProperty "insert-spaces-instead-of-tabs"
 
--- |
+-- | Position of the right margin.
+-- 
+-- Allowed values: [1,200]
+-- 
+-- Default value: 80
 --
 sourceViewRightMarginPosition :: SourceViewClass sv => Attr sv Int
 sourceViewRightMarginPosition = newAttrFromUIntProperty "right-margin-position"
 
--- |
+-- | Whether to display line numbers
+-- 
+-- Default value: 'False'
 --
 sourceViewShowLineNumbers :: SourceViewClass sv => Attr sv Bool
 sourceViewShowLineNumbers = newAttrFromBoolProperty "show-line-numbers"
 
--- |
+-- | Whether to display line mark pixbufs
+-- 
+-- Default value: 'False'
 --
 sourceViewShowRightMargin :: SourceViewClass sv => Attr sv Bool
 sourceViewShowRightMargin = newAttrFromBoolProperty "show-right-margin"
 
--- |
+-- | Set the behavior of the HOME and END keys.
+-- 
+-- Default value: 'SourceSmartHomeEndDisabled'
+-- 
+-- Since 2.0
 --
 sourceViewSmartHomeEnd :: SourceViewClass sv => Attr sv SourceSmartHomeEndType
 sourceViewSmartHomeEnd = newAttrFromEnumProperty "smart-home-end" {#call fun gtk_source_smart_home_end_type_get_type#}
 
--- |
+-- | Width of an tab character expressed in number of spaces.
+-- 
+-- Allowed values: [1,32]
+-- 
+-- Default value: 8
 --
 sourceViewTabWidth :: SourceViewClass sv => Attr sv Int
 sourceViewTabWidth = newAttrFromUIntProperty "tab-width"
@@ -312,3 +525,44 @@
 --
 sourceViewRedo :: SourceViewClass sv => Signal sv (IO ())
 sourceViewRedo = Signal $ connect_NONE__NONE "redo"
+
+-- | The 'moveLines' signal is a keybinding which gets emitted when the user initiates moving a
+-- line. The default binding key is Alt+Up/Down arrow. And moves the currently selected lines, or the
+-- current line by count. For the moment, only count of -1 or 1 is valid.
+sourceViewMoveLines :: SourceViewClass sv => Signal sv (Bool -> Int -> IO ())
+sourceViewMoveLines = Signal $ connect_BOOL_INT__NONE "move-lines"
+
+-- | The 'showCompletion' signal is a keybinding signal which gets emitted when the user initiates a
+-- completion in default mode.
+-- 
+-- Applications should not connect to it, but may emit it with @gSignalEmitByName@ if they need to
+-- control the default mode completion activation.
+sourceViewShowCompletion :: SourceViewClass sv => Signal sv (IO ())
+sourceViewShowCompletion = Signal $ connect_NONE__NONE "show-completion"
+
+-- | Emitted when a line mark has been activated (for instance when there was a button press in the line
+-- marks gutter). You can use iter to determine on which line the activation took place.
+sourceViewLineMarkActivated :: SourceViewClass sv => Signal sv (TextIter -> EventM EAny ())
+sourceViewLineMarkActivated = 
+  Signal (\after obj fun -> 
+           connect_PTR_BOXED__NONE "line-mark-activated" mkTextIterCopy after obj
+                                   (\eventPtr iter -> runReaderT (fun iter) eventPtr)
+         )
+
+-- * Deprecated
+#ifndef DISABLE_DEPRECATED
+-- | 'sourceViewSetMarkCategoryPixbuf' is deprecated and should not be used in newly-written
+-- code. Use 'sourceViewSetMarkCategoryIconFromPixbuf' instead
+--
+sourceViewSetMarkCategoryPixbuf :: SourceViewClass sv => sv -> String -> Pixbuf -> IO ()
+sourceViewSetMarkCategoryPixbuf sv markerType marker = withCString markerType $ \strPtr ->
+  {#call source_view_set_mark_category_pixbuf#} (toSourceView sv) strPtr marker
+
+-- | 'sourceViewGetMarkCategoryPixbuf' is deprecated and should not be used in newly-written code.
+--
+sourceViewGetMarkCategoryPixbuf :: SourceViewClass sv => sv -> String -> IO Pixbuf
+sourceViewGetMarkCategoryPixbuf sv markerType = withCString markerType $ \strPtr ->
+  constructNewGObject mkPixbuf $
+  {#call unsafe source_view_get_mark_category_pixbuf#} (toSourceView sv) strPtr
+#endif
+
diff --git a/Graphics/UI/Gtk/SourceView/Types.chs b/Graphics/UI/Gtk/SourceView/Types.chs
--- a/Graphics/UI/Gtk/SourceView/Types.chs
+++ b/Graphics/UI/Gtk/SourceView/Types.chs
@@ -35,6 +35,30 @@
 module Graphics.UI.Gtk.SourceView.Types (
 
   module Graphics.UI.GtkInternals,
+  SourceGutter(SourceGutter), SourceGutterClass,
+  toSourceGutter, 
+  mkSourceGutter, unSourceGutter,
+  castToSourceGutter, gTypeSourceGutter,
+  SourceUndoManager(SourceUndoManager), SourceUndoManagerClass,
+  toSourceUndoManager, 
+  mkSourceUndoManager, unSourceUndoManager,
+  castToSourceUndoManager, gTypeSourceUndoManager,
+  SourceCompletionProvider(SourceCompletionProvider), SourceCompletionProviderClass,
+  toSourceCompletionProvider, 
+  mkSourceCompletionProvider, unSourceCompletionProvider,
+  castToSourceCompletionProvider, gTypeSourceCompletionProvider,
+  SourceCompletionProposal(SourceCompletionProposal), SourceCompletionProposalClass,
+  toSourceCompletionProposal, 
+  mkSourceCompletionProposal, unSourceCompletionProposal,
+  castToSourceCompletionProposal, gTypeSourceCompletionProposal,
+  SourceCompletionContext(SourceCompletionContext), SourceCompletionContextClass,
+  toSourceCompletionContext, 
+  mkSourceCompletionContext, unSourceCompletionContext,
+  castToSourceCompletionContext, gTypeSourceCompletionContext,
+  SourceCompletionItem(SourceCompletionItem), SourceCompletionItemClass,
+  toSourceCompletionItem, 
+  mkSourceCompletionItem, unSourceCompletionItem,
+  castToSourceCompletionItem, gTypeSourceCompletionItem,
   SourceBuffer(SourceBuffer), SourceBufferClass,
   toSourceBuffer, 
   mkSourceBuffer, unSourceBuffer,
@@ -43,6 +67,14 @@
   toSourceMark, 
   mkSourceMark, unSourceMark,
   castToSourceMark, gTypeSourceMark,
+  SourceCompletion(SourceCompletion), SourceCompletionClass,
+  toSourceCompletion, 
+  mkSourceCompletion, unSourceCompletion,
+  castToSourceCompletion, gTypeSourceCompletion,
+  SourceCompletionInfo(SourceCompletionInfo), SourceCompletionInfoClass,
+  toSourceCompletionInfo, 
+  mkSourceCompletionInfo, unSourceCompletionInfo,
+  castToSourceCompletionInfo, gTypeSourceCompletionInfo,
   SourceView(SourceView), SourceViewClass,
   toSourceView, 
   mkSourceView, unSourceView,
@@ -89,6 +121,144 @@
       | otherwise -> error $ "Cannot cast object to " ++ objTypeName
 
 
+-- *************************************************************** SourceGutter
+
+{#pointer *SourceGutter foreign newtype #} deriving (Eq,Ord)
+
+mkSourceGutter = (SourceGutter, objectUnrefFromMainloop)
+unSourceGutter (SourceGutter o) = o
+
+class GObjectClass o => SourceGutterClass o
+toSourceGutter :: SourceGutterClass o => o -> SourceGutter
+toSourceGutter = unsafeCastGObject . toGObject
+
+instance SourceGutterClass SourceGutter
+instance GObjectClass SourceGutter where
+  toGObject = GObject . castForeignPtr . unSourceGutter
+  unsafeCastGObject = SourceGutter . castForeignPtr . unGObject
+
+castToSourceGutter :: GObjectClass obj => obj -> SourceGutter
+castToSourceGutter = castTo gTypeSourceGutter "SourceGutter"
+
+gTypeSourceGutter :: GType
+gTypeSourceGutter =
+  {# call fun unsafe gtk_source_gutter_get_type #}
+
+-- ********************************************************** SourceUndoManager
+
+{#pointer *SourceUndoManager foreign newtype #} deriving (Eq,Ord)
+
+mkSourceUndoManager = (SourceUndoManager, objectUnrefFromMainloop)
+unSourceUndoManager (SourceUndoManager o) = o
+
+class GObjectClass o => SourceUndoManagerClass o
+toSourceUndoManager :: SourceUndoManagerClass o => o -> SourceUndoManager
+toSourceUndoManager = unsafeCastGObject . toGObject
+
+instance SourceUndoManagerClass SourceUndoManager
+instance GObjectClass SourceUndoManager where
+  toGObject = GObject . castForeignPtr . unSourceUndoManager
+  unsafeCastGObject = SourceUndoManager . castForeignPtr . unGObject
+
+castToSourceUndoManager :: GObjectClass obj => obj -> SourceUndoManager
+castToSourceUndoManager = castTo gTypeSourceUndoManager "SourceUndoManager"
+
+gTypeSourceUndoManager :: GType
+gTypeSourceUndoManager =
+  {# call fun unsafe gtk_source_undo_manager_get_type #}
+
+-- *************************************************** SourceCompletionProvider
+
+{#pointer *SourceCompletionProvider foreign newtype #} deriving (Eq,Ord)
+
+mkSourceCompletionProvider = (SourceCompletionProvider, objectUnrefFromMainloop)
+unSourceCompletionProvider (SourceCompletionProvider o) = o
+
+class GObjectClass o => SourceCompletionProviderClass o
+toSourceCompletionProvider :: SourceCompletionProviderClass o => o -> SourceCompletionProvider
+toSourceCompletionProvider = unsafeCastGObject . toGObject
+
+instance SourceCompletionProviderClass SourceCompletionProvider
+instance GObjectClass SourceCompletionProvider where
+  toGObject = GObject . castForeignPtr . unSourceCompletionProvider
+  unsafeCastGObject = SourceCompletionProvider . castForeignPtr . unGObject
+
+castToSourceCompletionProvider :: GObjectClass obj => obj -> SourceCompletionProvider
+castToSourceCompletionProvider = castTo gTypeSourceCompletionProvider "SourceCompletionProvider"
+
+gTypeSourceCompletionProvider :: GType
+gTypeSourceCompletionProvider =
+  {# call fun unsafe gtk_source_completion_provider_get_type #}
+
+-- *************************************************** SourceCompletionProposal
+
+{#pointer *SourceCompletionProposal foreign newtype #} deriving (Eq,Ord)
+
+mkSourceCompletionProposal = (SourceCompletionProposal, objectUnrefFromMainloop)
+unSourceCompletionProposal (SourceCompletionProposal o) = o
+
+class GObjectClass o => SourceCompletionProposalClass o
+toSourceCompletionProposal :: SourceCompletionProposalClass o => o -> SourceCompletionProposal
+toSourceCompletionProposal = unsafeCastGObject . toGObject
+
+instance SourceCompletionProposalClass SourceCompletionProposal
+instance GObjectClass SourceCompletionProposal where
+  toGObject = GObject . castForeignPtr . unSourceCompletionProposal
+  unsafeCastGObject = SourceCompletionProposal . castForeignPtr . unGObject
+
+castToSourceCompletionProposal :: GObjectClass obj => obj -> SourceCompletionProposal
+castToSourceCompletionProposal = castTo gTypeSourceCompletionProposal "SourceCompletionProposal"
+
+gTypeSourceCompletionProposal :: GType
+gTypeSourceCompletionProposal =
+  {# call fun unsafe gtk_source_completion_proposal_get_type #}
+
+-- **************************************************** SourceCompletionContext
+
+{#pointer *SourceCompletionContext foreign newtype #} deriving (Eq,Ord)
+
+mkSourceCompletionContext = (SourceCompletionContext, objectUnrefFromMainloop)
+unSourceCompletionContext (SourceCompletionContext o) = o
+
+class GObjectClass o => SourceCompletionContextClass o
+toSourceCompletionContext :: SourceCompletionContextClass o => o -> SourceCompletionContext
+toSourceCompletionContext = unsafeCastGObject . toGObject
+
+instance SourceCompletionContextClass SourceCompletionContext
+instance GObjectClass SourceCompletionContext where
+  toGObject = GObject . castForeignPtr . unSourceCompletionContext
+  unsafeCastGObject = SourceCompletionContext . castForeignPtr . unGObject
+
+castToSourceCompletionContext :: GObjectClass obj => obj -> SourceCompletionContext
+castToSourceCompletionContext = castTo gTypeSourceCompletionContext "SourceCompletionContext"
+
+gTypeSourceCompletionContext :: GType
+gTypeSourceCompletionContext =
+  {# call fun unsafe gtk_source_completion_context_get_type #}
+
+-- ******************************************************* SourceCompletionItem
+
+{#pointer *SourceCompletionItem foreign newtype #} deriving (Eq,Ord)
+
+mkSourceCompletionItem = (SourceCompletionItem, objectUnrefFromMainloop)
+unSourceCompletionItem (SourceCompletionItem o) = o
+
+class GObjectClass o => SourceCompletionItemClass o
+toSourceCompletionItem :: SourceCompletionItemClass o => o -> SourceCompletionItem
+toSourceCompletionItem = unsafeCastGObject . toGObject
+
+instance SourceCompletionItemClass SourceCompletionItem
+instance GObjectClass SourceCompletionItem where
+  toGObject = GObject . castForeignPtr . unSourceCompletionItem
+  unsafeCastGObject = SourceCompletionItem . castForeignPtr . unGObject
+
+castToSourceCompletionItem :: GObjectClass obj => obj -> SourceCompletionItem
+castToSourceCompletionItem = castTo gTypeSourceCompletionItem "SourceCompletionItem"
+
+gTypeSourceCompletionItem :: GType
+gTypeSourceCompletionItem =
+  {# call fun unsafe gtk_source_completion_item_get_type #}
+
 -- *************************************************************** SourceBuffer
 
 {#pointer *SourceBuffer foreign newtype #} deriving (Eq,Ord)
@@ -136,6 +306,58 @@
 gTypeSourceMark :: GType
 gTypeSourceMark =
   {# call fun unsafe gtk_source_mark_get_type #}
+
+-- *********************************************************** SourceCompletion
+
+{#pointer *SourceCompletion foreign newtype #} deriving (Eq,Ord)
+
+mkSourceCompletion = (SourceCompletion, objectUnrefFromMainloop)
+unSourceCompletion (SourceCompletion o) = o
+
+class ObjectClass o => SourceCompletionClass o
+toSourceCompletion :: SourceCompletionClass o => o -> SourceCompletion
+toSourceCompletion = unsafeCastGObject . toGObject
+
+instance SourceCompletionClass SourceCompletion
+instance ObjectClass SourceCompletion
+instance GObjectClass SourceCompletion where
+  toGObject = GObject . castForeignPtr . unSourceCompletion
+  unsafeCastGObject = SourceCompletion . castForeignPtr . unGObject
+
+castToSourceCompletion :: GObjectClass obj => obj -> SourceCompletion
+castToSourceCompletion = castTo gTypeSourceCompletion "SourceCompletion"
+
+gTypeSourceCompletion :: GType
+gTypeSourceCompletion =
+  {# call fun unsafe gtk_source_completion_get_type #}
+
+-- ******************************************************* SourceCompletionInfo
+
+{#pointer *SourceCompletionInfo foreign newtype #} deriving (Eq,Ord)
+
+mkSourceCompletionInfo = (SourceCompletionInfo, objectUnrefFromMainloop)
+unSourceCompletionInfo (SourceCompletionInfo o) = o
+
+class WindowClass o => SourceCompletionInfoClass o
+toSourceCompletionInfo :: SourceCompletionInfoClass o => o -> SourceCompletionInfo
+toSourceCompletionInfo = unsafeCastGObject . toGObject
+
+instance SourceCompletionInfoClass SourceCompletionInfo
+instance WindowClass SourceCompletionInfo
+instance BinClass SourceCompletionInfo
+instance ContainerClass SourceCompletionInfo
+instance WidgetClass SourceCompletionInfo
+instance ObjectClass SourceCompletionInfo
+instance GObjectClass SourceCompletionInfo where
+  toGObject = GObject . castForeignPtr . unSourceCompletionInfo
+  unsafeCastGObject = SourceCompletionInfo . castForeignPtr . unGObject
+
+castToSourceCompletionInfo :: GObjectClass obj => obj -> SourceCompletionInfo
+castToSourceCompletionInfo = castTo gTypeSourceCompletionInfo "SourceCompletionInfo"
+
+gTypeSourceCompletionInfo :: GType
+gTypeSourceCompletionInfo =
+  {# call fun unsafe gtk_source_completion_info_get_type #}
 
 -- ***************************************************************** SourceView
 
diff --git a/demo/SourceViewTest.hs b/demo/SourceViewTest.hs
--- a/demo/SourceViewTest.hs
+++ b/demo/SourceViewTest.hs
@@ -38,7 +38,7 @@
   scrolledWindowSetPolicy sw PolicyAutomatic PolicyAutomatic
   sw `scrolledWindowSetShadowType` ShadowIn
   win `containerAdd` sw
-  
+
   -- show the widget and run the main loop
   windowSetDefaultSize win 400 500
   widgetShowAll win
diff --git a/gtksourceview2.cabal b/gtksourceview2.cabal
--- a/gtksourceview2.cabal
+++ b/gtksourceview2.cabal
@@ -1,5 +1,5 @@
 Name:           gtksourceview2
-Version:        0.11.1
+Version:        0.12.0
 License:        LGPL-2.1
 License-file:   COPYING
 Copyright:      (c) 2001-2010 The Gtk2Hs Team
@@ -37,7 +37,7 @@
 Source-Repository head
   type:         darcs
   location:     http://code.haskell.org/gtksourceview/
-
+  
 Library
         build-depends:  base >= 4 && < 5, array, containers, haskell98, mtl,
                         glib  >= 0.11 && < 0.12, 
@@ -47,7 +47,15 @@
 						
         exposed-modules:
           Graphics.UI.Gtk.SourceView
+          Graphics.UI.Gtk.SourceView.Enums
           Graphics.UI.Gtk.SourceView.SourceBuffer
+          Graphics.UI.Gtk.SourceView.SourceCompletion
+          Graphics.UI.Gtk.SourceView.SourceCompletionContext
+          Graphics.UI.Gtk.SourceView.SourceCompletionInfo
+          Graphics.UI.Gtk.SourceView.SourceCompletionItem
+          Graphics.UI.Gtk.SourceView.SourceCompletionProposal
+          Graphics.UI.Gtk.SourceView.SourceCompletionProvider
+          Graphics.UI.Gtk.SourceView.SourceGutter
           Graphics.UI.Gtk.SourceView.SourceIter
           Graphics.UI.Gtk.SourceView.SourceLanguage
           Graphics.UI.Gtk.SourceView.SourceLanguageManager
@@ -55,6 +63,7 @@
           Graphics.UI.Gtk.SourceView.SourceStyle
           Graphics.UI.Gtk.SourceView.SourceStyleScheme
           Graphics.UI.Gtk.SourceView.SourceStyleSchemeManager
+          Graphics.UI.Gtk.SourceView.SourceUndoManager
           Graphics.UI.Gtk.SourceView.SourceView
         other-modules:
           Graphics.UI.Gtk.SourceView.SourceStyle.Internal
diff --git a/gtksourceview2.h b/gtksourceview2.h
--- a/gtksourceview2.h
+++ b/gtksourceview2.h
@@ -7,3 +7,5 @@
 #include <gtksourceview/gtksourcestyleschememanager.h>
 #include <gtksourceview/gtksourceview.h>
 #include <gtksourceview/gtksourceview-typebuiltins.h>
+#include <gtksourceview/gtksourceundomanager.h>
+#include <gtksourceview/gtksourcecompletionitem.h>
diff --git a/hierarchy.list b/hierarchy.list
--- a/hierarchy.list
+++ b/hierarchy.list
@@ -17,6 +17,12 @@
 
 
     GObject 
+		GtkSourceGutter if gtksourceview2
+		GtkSourceUndoManager if gtksourceview2
+		GtkSourceCompletionProvider if gtksourceview2
+		GtkSourceCompletionProposal if gtksourceview2
+		GtkSourceCompletionContext if gtksourceview2
+		GtkSourceCompletionItem if gtksourceview2
         GdkDrawable 
             GdkWindow		as DrawWindow, gdk_window_object_get_type
 #            GdkDrawableImplX11
@@ -49,6 +55,7 @@
 	    GtkSourceMarker	if sourceview
             GtkSourceMark       if gtksourceview2
         GtkObject
+		    GtkSourceCompletion if gtksourceview2
             GtkWidget
                 GtkMisc
                     GtkLabel
@@ -79,6 +86,7 @@
                             GtkListItem			if deprecated
 #			    GtkTreeItem
                         GtkWindow
+							GtkSourceCompletionInfo if gtksourceview2
                             GtkDialog
 			    	GtkAboutDialog		if gtk-2.6
                                 GtkColorSelectionDialog
diff --git a/marshal.list b/marshal.list
--- a/marshal.list
+++ b/marshal.list
@@ -43,4 +43,10 @@
 # If it is a Boxed type check that the reference counting is right.
 
 NONE:NONE
+NONE:OBJECT
 NONE:BOXED,BOXED
+NONE:BOOL,INT
+NONE:POINTER,BOXED
+NONE:OBJECT,POINTER,BOXED
+BOOL:OBJECT,BOXED,OBJECT
+NONE:ENUM,INT
