    {-# LINE 2 "./Graphics/UI/Gtk/WebKit/WebHistoryItem.chs" #-}
    -- -*-haskell-*-
    -----------------------------------------------------------------------------
    -- Module : Graphics.UI.Gtk.WebKit.WebHistoryItem
    -- Author : Cjacker Huang
    -- Copyright : (c) 2009 Cjacker Huang <jzhuang@redflag-1 .com>
    --
    -- 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)
    --
    -- One item of the 'WebBackForwardList' and or global history
    -----------------------------------------------------------------------------

    module Graphics.UI.Gtk.WebKit.WebHistoryItem (
    -- * Description
    -- | A history item consists out of a title and a uri. It can be part of the WebKitWebBackForwardList and
    -- the global history. The global history is used for coloring the links of visited
    -- sites. WebKitWebHistoryItem's constructed with 'webHistoryItemNew' and
    -- 'webHistoryItemNewWithData' are automatically added to the global history.

    -- * Types
      WebHistoryItem,
      WebHistoryItemClass,

    -- * Constructors
      webHistoryItemNew,
      webHistoryItemNewWithData,

    -- * Attributes
      webHistoryItemTitle,
      webHistoryItemAlternateTitle,
      webHistoryItemUri,
      webHistoryItemOriginalUri,
      webHistoryItemLastVisitedTime,

    -- * Methods
      webHistoryItemGetTitle,
      webHistoryItemGetAlternateTitle,
      webHistoryItemSetAlternateTitle,
      webHistoryItemGetUri,
      webHistoryItemGetOriginalUri,
      webHistoryItemGetLastVisitedTime,

      webHistoryItemCopy,

    ) where

    import Control.Monad (liftM)

    import System.Glib.FFI
    import System.Glib.UTFString
    import System.Glib.GList
    import System.Glib.GError
    import System.Glib.Attributes
    import Graphics.UI.Gtk.Gdk.Events

    import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
    import Graphics.UI.Gtk.WebKit.Types
    {-# LINE 71 "./Graphics/UI/Gtk/WebKit/WebHistoryItem.chs" #-}
    import System.Glib.GObject
    {-# LINE 72 "./Graphics/UI/Gtk/WebKit/WebHistoryItem.chs" #-}

    {-# LINE 74 "./Graphics/UI/Gtk/WebKit/WebHistoryItem.chs" #-}

    ------------------
    -- Constructors

    -- | Create a new 'WebHistoryItem' instance.
    --
    -- A history item consists out of a title and a uri,
    -- it can be part of the WebBackForwardList and the global history.
    --
    -- The global history is used for coloring the links of visited sites.
    -- 'WebHistoryItem' constructed with 'webHistoryItemNew' are
    -- automatically added to the global history.
    webHistoryItemNew :: IO WebHistoryItem
    webHistoryItemNew =
        wrapNewGObject mkWebHistoryItem $ webkit_web_history_item_new
    {-# LINE 91 "./Graphics/UI/Gtk/WebKit/WebHistoryItem.chs" #-}

    -- | Create a new 'WebHistoryItem' instance with the given @uri@ and @title@.
    --
    -- 'WebHistoryItem' constructed with 'webHistoryItemNewWithData' are
    -- automatically added to the global history.
    webHistoryItemNewWithData ::
        String -- ^ @uri@ - the uri of the item
     -> String -- ^ @title@ - the title of the item
     -> IO WebHistoryItem
    webHistoryItemNewWithData uri title =
        withCString uri $ \uriPtr ->
        withCString title $ \titlePtr ->
        wrapNewGObject mkWebHistoryItem $
          webkit_web_history_item_new_with_data
    {-# LINE 106 "./Graphics/UI/Gtk/WebKit/WebHistoryItem.chs" #-}
            uriPtr
            titlePtr

    -- | Return the title of 'WebHistoryItem'.
    webHistoryItemGetTitle ::
        WebHistoryItemClass self => self
     -> IO (Maybe String) -- ^ the title or @Nothing@ in case failed.
    webHistoryItemGetTitle webhistoryitem =
        (\(WebHistoryItem arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_history_item_get_title argPtr1)
    {-# LINE 116 "./Graphics/UI/Gtk/WebKit/WebHistoryItem.chs" #-}
          (toWebHistoryItem webhistoryitem) >>=
          maybePeek peekCString

    -- | Return the alternate title of WebHistoryItem.
    webHistoryItemGetAlternateTitle ::
        WebHistoryItemClass self => self
     -> IO (Maybe String) -- ^ the alternate title or @Nothing@ in case failed.
    webHistoryItemGetAlternateTitle webhistoryitem =
        (\(WebHistoryItem arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_history_item_get_alternate_title argPtr1)
    {-# LINE 125 "./Graphics/UI/Gtk/WebKit/WebHistoryItem.chs" #-}
          (toWebHistoryItem webhistoryitem) >>=
          maybePeek peekCString

    -- | Set an alternate title for WebHistoryItem.
    webHistoryItemSetAlternateTitle ::
        WebHistoryItemClass self => self
     -> (Maybe String) -- ^ @title@ - the alternate title for this history item.
     -> IO()
    webHistoryItemSetAlternateTitle webhistoryitem title =
        maybeWith withCString title $ \titlePtr ->
        (\(WebHistoryItem arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_history_item_set_alternate_title argPtr1 arg2)
    {-# LINE 136 "./Graphics/UI/Gtk/WebKit/WebHistoryItem.chs" #-}
          (toWebHistoryItem webhistoryitem)
          titlePtr

    -- | Return the URI of WebHistoryItem.
    webHistoryItemGetUri ::
        WebHistoryItemClass self => self
     -> IO (Maybe String) -- ^ the URI or @Nothing@ in case failed.
    webHistoryItemGetUri webhistoryitem =
        (\(WebHistoryItem arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_history_item_get_uri argPtr1)
    {-# LINE 145 "./Graphics/UI/Gtk/WebKit/WebHistoryItem.chs" #-}
          (toWebHistoryItem webhistoryitem) >>=
          maybePeek peekCString

    -- | Return the original URI of WebHistoryItem.
    webHistoryItemGetOriginalUri ::
        WebHistoryItemClass self => self
     -> IO (Maybe String) -- ^ the URI or @Nothing@ in case failed
    webHistoryItemGetOriginalUri webhistoryitem =
        (\(WebHistoryItem arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_history_item_get_original_uri argPtr1)
    {-# LINE 154 "./Graphics/UI/Gtk/WebKit/WebHistoryItem.chs" #-}
          (toWebHistoryItem webhistoryitem) >>=
          maybePeek peekCString

    -- | Return the last visited time of WebHistoryItem.
    webHistoryItemGetLastVisitedTime ::
        WebHistoryItemClass self => self
     -> IO Double -- ^ the last visited time of this history item.
    webHistoryItemGetLastVisitedTime webhistoryitem =
        liftM realToFrac $
          (\(WebHistoryItem arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_history_item_get_last_visited_time argPtr1)
    {-# LINE 164 "./Graphics/UI/Gtk/WebKit/WebHistoryItem.chs" #-}
            (toWebHistoryItem webhistoryitem)

    -- | Makes a copy of the item for use with other WebView objects.
    --
    -- * Since 1.1.18
    webHistoryItemCopy :: WebHistoryItemClass self => self
     -> IO WebHistoryItem
    webHistoryItemCopy webhistoryitem =
        makeNewGObject mkWebHistoryItem $
        (\(WebHistoryItem arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_history_item_copy argPtr1) (toWebHistoryItem webhistoryitem)

    -- | The title of the 'WebHistoryItem'
    --
    -- Default value: @Nothing@
    webHistoryItemTitle :: (WebHistoryItemClass self) => ReadAttr self (Maybe String)
    webHistoryItemTitle = readAttr webHistoryItemGetTitle

    -- | The alternate title of the history item.
    --
    -- Default value: @Nothing@
    webHistoryItemAlternateTitle :: (WebHistoryItemClass self) => Attr self (Maybe String)
    webHistoryItemAlternateTitle = newAttr webHistoryItemGetAlternateTitle webHistoryItemSetAlternateTitle

    -- | The URI of the history item.
    --
    -- Default value: @Nothing@
    webHistoryItemUri :: (WebHistoryItemClass self) => ReadAttr self (Maybe String)
    webHistoryItemUri = readAttr webHistoryItemGetUri

    -- | The original URI of the history item.
    --
    -- Default value: @Nothing@
    webHistoryItemOriginalUri :: (WebHistoryItemClass self) => ReadAttr self (Maybe String)
    webHistoryItemOriginalUri = readAttr webHistoryItemGetOriginalUri

    -- | The time at which the history item was last visited.
    --
    -- Allowed values: >= 0
    --
    -- Default value: 0
    webHistoryItemLastVisitedTime :: (WebHistoryItemClass self) => ReadAttr self Double
    webHistoryItemLastVisitedTime = readAttr webHistoryItemGetLastVisitedTime

    foreign import ccall safe "webkit_web_history_item_new"
      webkit_web_history_item_new :: (IO (Ptr WebHistoryItem))

    foreign import ccall safe "webkit_web_history_item_new_with_data"
      webkit_web_history_item_new_with_data :: ((Ptr CChar) -> ((Ptr CChar) -> (IO (Ptr WebHistoryItem))))

    foreign import ccall safe "webkit_web_history_item_get_title"
      webkit_web_history_item_get_title :: ((Ptr WebHistoryItem) -> (IO (Ptr CChar)))

    foreign import ccall safe "webkit_web_history_item_get_alternate_title"
      webkit_web_history_item_get_alternate_title :: ((Ptr WebHistoryItem) -> (IO (Ptr CChar)))

    foreign import ccall safe "webkit_web_history_item_set_alternate_title"
      webkit_web_history_item_set_alternate_title :: ((Ptr WebHistoryItem) -> ((Ptr CChar) -> (IO ())))

    foreign import ccall safe "webkit_web_history_item_get_uri"
      webkit_web_history_item_get_uri :: ((Ptr WebHistoryItem) -> (IO (Ptr CChar)))

    foreign import ccall safe "webkit_web_history_item_get_original_uri"
      webkit_web_history_item_get_original_uri :: ((Ptr WebHistoryItem) -> (IO (Ptr CChar)))

    foreign import ccall safe "webkit_web_history_item_get_last_visited_time"
      webkit_web_history_item_get_last_visited_time :: ((Ptr WebHistoryItem) -> (IO CDouble))

    foreign import ccall safe "webkit_web_history_item_copy"
      webkit_web_history_item_copy :: ((Ptr WebHistoryItem) -> (IO (Ptr WebHistoryItem)))