{-# LINE 2 "./Graphics/UI/Gtk/WebKit/NetworkResponse.chs" #-}
-- -*-haskell-*-
-----------------------------------------------------------------------------
-- Module : Graphics.UI.Gtk.WebKit.NetworkResponse
-- 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)
--
-- The response given to a network request
-----------------------------------------------------------------------------

module Graphics.UI.Gtk.WebKit.NetworkResponse (
-- * Description
-- | This class represents the network related aspects of a navigation response.

-- * Types
  NetworkResponse,
  NetworkResponseClass,

-- * Methods
  networkResponseSetUri,
  networkResponseGetUri,
) where

import Control.Monad (liftM)

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

import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.WebKit.Types
{-# LINE 49 "./Graphics/UI/Gtk/WebKit/NetworkResponse.chs" #-}
import System.Glib.GObject
{-# LINE 50 "./Graphics/UI/Gtk/WebKit/NetworkResponse.chs" #-}


{-# LINE 52 "./Graphics/UI/Gtk/WebKit/NetworkResponse.chs" #-}

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

-- | Set the URI of 'NetworkResponse'.
--
networkResponseSetUri ::
    (NetworkResponseClass self, GlibString string) => self
 -> string -- ^ @uri@ - the uri will be set to the response.
 -> IO()
networkResponseSetUri response uri =
    withUTFString uri $ \uriPtr ->
      (\(NetworkResponse arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_network_response_set_uri argPtr1 arg2)
{-# LINE 65 "./Graphics/UI/Gtk/WebKit/NetworkResponse.chs" #-}
        (toNetworkResponse response)
        uriPtr


-- | Return the uri of 'NetworkResponse'.
networkResponseGetUri ::
    (NetworkResponseClass self, GlibString string) => self
 -> IO (Maybe string) -- ^ the URI or @Nothing@ in case failed.
networkResponseGetUri response =
    (\(NetworkResponse arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_network_response_get_uri argPtr1)
{-# LINE 75 "./Graphics/UI/Gtk/WebKit/NetworkResponse.chs" #-}
      (toNetworkResponse response) >>=
      maybePeek peekUTFString

foreign import ccall safe "webkit_network_response_set_uri"
  webkit_network_response_set_uri :: ((Ptr NetworkResponse) -> ((Ptr CChar) -> (IO ())))

foreign import ccall safe "webkit_network_response_get_uri"
  webkit_network_response_get_uri :: ((Ptr NetworkResponse) -> (IO (Ptr CChar)))