gi-soup-0.2.50.12: GI/Soup/Objects/CookieJarText.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}
module GI.Soup.Objects.CookieJarText
(
-- * Exported types
CookieJarText(..) ,
CookieJarTextK ,
toCookieJarText ,
noCookieJarText ,
-- * Methods
-- ** cookieJarTextNew
cookieJarTextNew ,
-- * Properties
-- ** Filename
CookieJarTextFilenamePropertyInfo ,
constructCookieJarTextFilename ,
getCookieJarTextFilename ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Soup.Types
import GI.Soup.Callbacks
import qualified GI.GObject as GObject
newtype CookieJarText = CookieJarText (ForeignPtr CookieJarText)
foreign import ccall "soup_cookie_jar_text_get_type"
c_soup_cookie_jar_text_get_type :: IO GType
type instance ParentTypes CookieJarText = CookieJarTextParentTypes
type CookieJarTextParentTypes = '[CookieJar, GObject.Object, SessionFeature]
instance GObject CookieJarText where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_soup_cookie_jar_text_get_type
class GObject o => CookieJarTextK o
instance (GObject o, IsDescendantOf CookieJarText o) => CookieJarTextK o
toCookieJarText :: CookieJarTextK o => o -> IO CookieJarText
toCookieJarText = unsafeCastTo CookieJarText
noCookieJarText :: Maybe CookieJarText
noCookieJarText = Nothing
-- VVV Prop "filename"
-- Type: TBasicType TUTF8
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
getCookieJarTextFilename :: (MonadIO m, CookieJarTextK o) => o -> m T.Text
getCookieJarTextFilename obj = liftIO $ getObjectPropertyString obj "filename"
constructCookieJarTextFilename :: T.Text -> IO ([Char], GValue)
constructCookieJarTextFilename val = constructObjectPropertyString "filename" val
data CookieJarTextFilenamePropertyInfo
instance AttrInfo CookieJarTextFilenamePropertyInfo where
type AttrAllowedOps CookieJarTextFilenamePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint CookieJarTextFilenamePropertyInfo = (~) T.Text
type AttrBaseTypeConstraint CookieJarTextFilenamePropertyInfo = CookieJarTextK
type AttrGetType CookieJarTextFilenamePropertyInfo = T.Text
type AttrLabel CookieJarTextFilenamePropertyInfo = "CookieJarText::filename"
attrGet _ = getCookieJarTextFilename
attrSet _ = undefined
attrConstruct _ = constructCookieJarTextFilename
type instance AttributeList CookieJarText = CookieJarTextAttributeList
type CookieJarTextAttributeList = ('[ '("accept-policy", CookieJarAcceptPolicyPropertyInfo), '("filename", CookieJarTextFilenamePropertyInfo), '("read-only", CookieJarReadOnlyPropertyInfo)] :: [(Symbol, *)])
type instance SignalList CookieJarText = CookieJarTextSignalList
type CookieJarTextSignalList = ('[ '("changed", CookieJarChangedSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
-- method CookieJarText::new
-- method type : Constructor
-- Args : [Arg {argName = "filename", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "read_only", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "filename", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "read_only", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Soup" "CookieJarText"
-- throws : False
-- Skip return : False
foreign import ccall "soup_cookie_jar_text_new" soup_cookie_jar_text_new ::
CString -> -- filename : TBasicType TUTF8
CInt -> -- read_only : TBasicType TBoolean
IO (Ptr CookieJarText)
cookieJarTextNew ::
(MonadIO m) =>
T.Text -> -- filename
Bool -> -- read_only
m CookieJarText
cookieJarTextNew filename read_only = liftIO $ do
filename' <- textToCString filename
let read_only' = (fromIntegral . fromEnum) read_only
result <- soup_cookie_jar_text_new filename' read_only'
checkUnexpectedReturnNULL "soup_cookie_jar_text_new" result
result' <- (wrapObject CookieJarText) result
freeMem filename'
return result'