module Graphics.UI.Gtk.WebKit.WebDataSource (
WebDataSource,
WebDataSourceClass,
webDataSourceNew,
webDataSourceGetData,
webDataSourceGetEncoding,
webDataSourceGetInitialRequest,
webDataSourceGetMainResource,
webDataSourceGetRequest,
webDataSourceGetSubresources,
webDataSourceGetUnreachableUri,
webDataSourceGetWebFrame,
webDataSourceIsLoading,
) where
import Control.Monad (liftM)
import Data.ByteString (ByteString)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.GList
import System.Glib.GString
import System.Glib.GError
import Graphics.UI.Gtk.Gdk.Events
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.WebKit.Types
import System.Glib.GObject
webDataSourceNew :: IO WebDataSource
webDataSourceNew =
wrapNewGObject mkWebDataSource $ webkit_web_data_source_new
webDataSourceGetData :: WebDataSourceClass self => self
-> IO (Maybe ByteString)
webDataSourceGetData ds = do
gstr <- (\(WebDataSource arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_data_source_get_data argPtr1)
(toWebDataSource ds)
readGStringByteString gstr
webDataSourceGetEncoding ::
(WebDataSourceClass self, GlibString string) => self
-> IO string
webDataSourceGetEncoding ds =
(\(WebDataSource arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_data_source_get_encoding argPtr1) (toWebDataSource ds) >>= peekUTFString
webDataSourceGetInitialRequest ::
WebDataSourceClass self => self
-> IO NetworkRequest
webDataSourceGetInitialRequest ds =
makeNewGObject mkNetworkRequest $ (\(WebDataSource arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_data_source_get_initial_request argPtr1) (toWebDataSource ds)
webDataSourceGetMainResource ::
WebDataSourceClass self => self
-> IO WebResource
webDataSourceGetMainResource ds =
makeNewGObject mkWebResource $ (\(WebDataSource arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_data_source_get_main_resource argPtr1) (toWebDataSource ds)
webDataSourceGetRequest ::
WebDataSourceClass self => self
-> IO NetworkRequest
webDataSourceGetRequest ds =
makeNewGObject mkNetworkRequest $ (\(WebDataSource arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_data_source_get_request argPtr1) (toWebDataSource ds)
webDataSourceGetSubresources ::
WebDataSourceClass self => self
-> IO [WebResource]
webDataSourceGetSubresources ds = do
glist <- (\(WebDataSource arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_data_source_get_subresources argPtr1) (toWebDataSource ds)
resourcePtr <- fromGList glist
mapM (makeNewGObject mkWebResource . return) resourcePtr
webDataSourceGetUnreachableUri ::
(WebDataSourceClass self, GlibString string) => self
-> IO string
webDataSourceGetUnreachableUri ds =
(\(WebDataSource arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_data_source_get_unreachable_uri argPtr1) (toWebDataSource ds) >>= peekUTFString
webDataSourceGetWebFrame ::
WebDataSourceClass self => self
-> IO WebFrame
webDataSourceGetWebFrame ds =
makeNewGObject mkWebFrame $ (\(WebDataSource arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_data_source_get_web_frame argPtr1) (toWebDataSource ds)
webDataSourceIsLoading ::
WebDataSourceClass self => self
-> IO Bool
webDataSourceIsLoading ds =
liftM toBool $ (\(WebDataSource arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_data_source_is_loading argPtr1) (toWebDataSource ds)
foreign import ccall safe "webkit_web_data_source_new"
webkit_web_data_source_new :: (IO (Ptr WebDataSource))
foreign import ccall safe "webkit_web_data_source_get_data"
webkit_web_data_source_get_data :: ((Ptr WebDataSource) -> (IO (Ptr ())))
foreign import ccall safe "webkit_web_data_source_get_encoding"
webkit_web_data_source_get_encoding :: ((Ptr WebDataSource) -> (IO (Ptr CChar)))
foreign import ccall safe "webkit_web_data_source_get_initial_request"
webkit_web_data_source_get_initial_request :: ((Ptr WebDataSource) -> (IO (Ptr NetworkRequest)))
foreign import ccall safe "webkit_web_data_source_get_main_resource"
webkit_web_data_source_get_main_resource :: ((Ptr WebDataSource) -> (IO (Ptr WebResource)))
foreign import ccall safe "webkit_web_data_source_get_request"
webkit_web_data_source_get_request :: ((Ptr WebDataSource) -> (IO (Ptr NetworkRequest)))
foreign import ccall safe "webkit_web_data_source_get_subresources"
webkit_web_data_source_get_subresources :: ((Ptr WebDataSource) -> (IO (Ptr ())))
foreign import ccall safe "webkit_web_data_source_get_unreachable_uri"
webkit_web_data_source_get_unreachable_uri :: ((Ptr WebDataSource) -> (IO (Ptr CChar)))
foreign import ccall safe "webkit_web_data_source_get_web_frame"
webkit_web_data_source_get_web_frame :: ((Ptr WebDataSource) -> (IO (Ptr WebFrame)))
foreign import ccall safe "webkit_web_data_source_is_loading"
webkit_web_data_source_is_loading :: ((Ptr WebDataSource) -> (IO CInt))